Skip to content

Commit cee17b2

Browse files
committed
Extension has been reworked to fit the original library
1 parent bdffefa commit cee17b2

32 files changed

+792
-380
lines changed

.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
.idea/
2+
*.iml
3+
4+
build.gradle
5+
gradle/
6+
/.gradle/
7+
gradlew
8+
gradlew.bat
9+
10+
secret.asc
11+
12+
*.hprof
13+
14+
out/
15+
.gradle/
16+
17+
*.log
18+
*.tmp
19+
20+
build/
21+
22+
vendor/
23+
package.*.yml
24+
!package.php.yml
25+
26+
package-lock.php.yml
27+
28+
jars/
29+
bundle/

package.php.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
name: nativehook
2-
version: 1.0.6
2+
version: 2.0.0
33

44
plugins:
55
- Hub
66
- Doc
77
- Gradle
88

99
deps:
10-
jphp-runtime: '*'
10+
jphp-runtime: '1.2.1'
1111

1212
devDeps:
13-
jphp-core: '*'
13+
dn-bundle-plugin: '*'
1414

1515
sources:
1616
- src
@@ -31,3 +31,12 @@ config:
3131
gradle:
3232
deps:
3333
- com.1stleg:jnativehook:2.0.2
34+
35+
develnext-bundle:
36+
version: 1.1.0
37+
name: NativeHook
38+
author: broelik
39+
icon: "develnext/bundle/nativehook/icon.png"
40+
description: "Расширение для обработки глобального пользовательского ввода"
41+
group: "system"
42+
class: "develnext\\bundle\\nativehook\\NativeHookBundle"

sdk/nativehook/GlobalScreen.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
4+
namespace nativehook;
5+
6+
7+
use nativehook\keyboard\NativeKeyListener;
8+
use nativehook\mouse\NativeMouseListener;
9+
use nativehook\mouse\NativeMouseWheelListener;
10+
11+
class GlobalScreen{
12+
public static function registerNativeHook(){}
13+
public static function unregisterNativeHook(){}
14+
public static function isNativeHookRegistered(): bool{}
15+
16+
public static function addNativeKeyListener(NativeKeyListener $keyListener){}
17+
public static function addNativeMouseListener(NativeMouseListener $mouseListener){}
18+
public static function addNativeMouseMotionListener(NativeMouseListener $mouseMotionListener){}
19+
public static function addNativeMouseWheelListener(NativeMouseWheelListener $mouseWheelListener){}
20+
21+
public static function removeNativeKeyListener(NativeKeyListener $keyListener){}
22+
public static function removeNativeMouseListener(NativeMouseListener $mouseListener){}
23+
public static function removeNativeMouseMotionListener(NativeMouseListener $mouseMotionListener){}
24+
public static function removeNativeMouseWheelListener(NativeMouseWheelListener $mouseWheelListener){}
25+
26+
public static function dispatchEvent(NativeInputEvent $e){}
27+
public static function postNativeEvent(NativeInputEvent $e){}
28+
}

sdk/nativehook/NativeHook.php

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,33 @@
1-
<?php
2-
namespace nativehook;
3-
4-
5-
class NativeInputEvent{
6-
/**
7-
* @var int
8-
*/
9-
public $id;
10-
/**
11-
* @var int
12-
*/
13-
public $when;
1+
<?php
2+
3+
4+
namespace nativehook;
5+
6+
7+
class NativeInputEvent{
8+
/**
9+
* @var int
10+
* @readonly
11+
*/
12+
public $type;
13+
/**
14+
* @var int
15+
*/
16+
public $modifiers;
17+
/**
18+
* @var int
19+
* @readonly
20+
*/
21+
public $when;
22+
23+
public function __construct(int $type, int $when, int $modifiers){
24+
25+
}
26+
27+
/**
28+
* @return string
29+
*/
30+
public function paramString(){
31+
32+
}
1433
}

sdk/nativehook/NativeKeyEvent.php

Lines changed: 0 additions & 16 deletions
This file was deleted.

sdk/nativehook/NativeMouseEvent.php

Lines changed: 0 additions & 22 deletions
This file was deleted.

sdk/nativehook/NativeMouseWheelEvent.php

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
3+
4+
namespace nativehook\keyboard;
5+
6+
7+
use nativehook\NativeInputEvent;
8+
9+
class NativeKeyEvent extends NativeInputEvent{
10+
/**
11+
* @var string
12+
* @readonly
13+
*/
14+
public $keyText;
15+
/**
16+
* @var string
17+
*/
18+
public $keyChar;
19+
/**
20+
* @var int
21+
*/
22+
public $keyCode;
23+
/**
24+
* @var int
25+
*/
26+
public $rawCode;
27+
/**
28+
* @var int
29+
*/
30+
public $keyLocation;
31+
/**
32+
* @var bool
33+
*/
34+
public $isActionKey;
35+
36+
const NATIVE_KEY_PRESSED = 2401;
37+
const NATIVE_KEY_RELEASED = 2402;
38+
const NATIVE_KEY_TYPED = 2400;
39+
40+
public function __construct(int $id, int $when, int $modifiers, int $rawCode, int $keyCode, string $keyChar, int $keyLocation = 0){
41+
42+
}
43+
44+
/**
45+
* @return string
46+
*/
47+
public static function getKeyText(int $keyCode){
48+
49+
}
50+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
4+
namespace nativehook\keyboard;
5+
6+
7+
interface NativeKeyListener{
8+
/**
9+
* @param NativeKeyEvent $event
10+
* @return void
11+
*/
12+
public function nativeKeyPressed($event);
13+
/**
14+
* @param NativeKeyEvent $event
15+
* @return void
16+
*/
17+
public function nativeKeyReleased(NativeKeyEvent $event);
18+
/**
19+
* @param NativeKeyEvent $event
20+
* @return void
21+
*/
22+
public function nativeKeyTyped(NativeKeyEvent $event);
23+
}

0 commit comments

Comments
 (0)