Skip to content

Commit

Permalink
Extension has been reworked to fit the original library
Browse files Browse the repository at this point in the history
  • Loading branch information
broelik committed Aug 24, 2020
1 parent bdffefa commit cee17b2
Show file tree
Hide file tree
Showing 32 changed files with 792 additions and 380 deletions.
29 changes: 29 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.idea/
*.iml

build.gradle
gradle/
/.gradle/
gradlew
gradlew.bat

secret.asc

*.hprof

out/
.gradle/

*.log
*.tmp

build/

vendor/
package.*.yml
!package.php.yml

package-lock.php.yml

jars/
bundle/
15 changes: 12 additions & 3 deletions package.php.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: nativehook
version: 1.0.6
version: 2.0.0

plugins:
- Hub
- Doc
- Gradle

deps:
jphp-runtime: '*'
jphp-runtime: '1.2.1'

devDeps:
jphp-core: '*'
dn-bundle-plugin: '*'

sources:
- src
Expand All @@ -31,3 +31,12 @@ config:
gradle:
deps:
- com.1stleg:jnativehook:2.0.2

develnext-bundle:
version: 1.1.0
name: NativeHook
author: broelik
icon: "develnext/bundle/nativehook/icon.png"
description: "Расширение для обработки глобального пользовательского ввода"
group: "system"
class: "develnext\\bundle\\nativehook\\NativeHookBundle"
28 changes: 28 additions & 0 deletions sdk/nativehook/GlobalScreen.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php


namespace nativehook;


use nativehook\keyboard\NativeKeyListener;
use nativehook\mouse\NativeMouseListener;
use nativehook\mouse\NativeMouseWheelListener;

class GlobalScreen{
public static function registerNativeHook(){}
public static function unregisterNativeHook(){}
public static function isNativeHookRegistered(): bool{}

public static function addNativeKeyListener(NativeKeyListener $keyListener){}
public static function addNativeMouseListener(NativeMouseListener $mouseListener){}
public static function addNativeMouseMotionListener(NativeMouseListener $mouseMotionListener){}
public static function addNativeMouseWheelListener(NativeMouseWheelListener $mouseWheelListener){}

public static function removeNativeKeyListener(NativeKeyListener $keyListener){}
public static function removeNativeMouseListener(NativeMouseListener $mouseListener){}
public static function removeNativeMouseMotionListener(NativeMouseListener $mouseMotionListener){}
public static function removeNativeMouseWheelListener(NativeMouseWheelListener $mouseWheelListener){}

public static function dispatchEvent(NativeInputEvent $e){}
public static function postNativeEvent(NativeInputEvent $e){}
}
26 changes: 0 additions & 26 deletions sdk/nativehook/NativeHook.php

This file was deleted.

45 changes: 32 additions & 13 deletions sdk/nativehook/NativeInputEvent.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
<?php
namespace nativehook;


class NativeInputEvent{
/**
* @var int
*/
public $id;
/**
* @var int
*/
public $when;
<?php


namespace nativehook;


class NativeInputEvent{
/**
* @var int
* @readonly
*/
public $type;
/**
* @var int
*/
public $modifiers;
/**
* @var int
* @readonly
*/
public $when;

public function __construct(int $type, int $when, int $modifiers){

}

/**
* @return string
*/
public function paramString(){

}
}
16 changes: 0 additions & 16 deletions sdk/nativehook/NativeKeyEvent.php

This file was deleted.

22 changes: 0 additions & 22 deletions sdk/nativehook/NativeMouseEvent.php

This file was deleted.

18 changes: 0 additions & 18 deletions sdk/nativehook/NativeMouseWheelEvent.php

This file was deleted.

50 changes: 50 additions & 0 deletions sdk/nativehook/keyboard/NativeKeyEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php


namespace nativehook\keyboard;


use nativehook\NativeInputEvent;

class NativeKeyEvent extends NativeInputEvent{
/**
* @var string
* @readonly
*/
public $keyText;
/**
* @var string
*/
public $keyChar;
/**
* @var int
*/
public $keyCode;
/**
* @var int
*/
public $rawCode;
/**
* @var int
*/
public $keyLocation;
/**
* @var bool
*/
public $isActionKey;

const NATIVE_KEY_PRESSED = 2401;
const NATIVE_KEY_RELEASED = 2402;
const NATIVE_KEY_TYPED = 2400;

public function __construct(int $id, int $when, int $modifiers, int $rawCode, int $keyCode, string $keyChar, int $keyLocation = 0){

}

/**
* @return string
*/
public static function getKeyText(int $keyCode){

}
}
23 changes: 23 additions & 0 deletions sdk/nativehook/keyboard/NativeKeyListener.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php


namespace nativehook\keyboard;


interface NativeKeyListener{
/**
* @param NativeKeyEvent $event
* @return void
*/
public function nativeKeyPressed($event);
/**
* @param NativeKeyEvent $event
* @return void
*/
public function nativeKeyReleased(NativeKeyEvent $event);
/**
* @param NativeKeyEvent $event
* @return void
*/
public function nativeKeyTyped(NativeKeyEvent $event);
}
41 changes: 41 additions & 0 deletions sdk/nativehook/mouse/NativeMouseEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php


namespace nativehook\mouse;


use nativehook\NativeInputEvent;

class NativeMouseEvent extends NativeInputEvent{
const NATIVE_MOUSE_CLICKED = 2500;
const NATIVE_MOUSE_PRESSED = 2501;
const NATIVE_MOUSE_RELEASED = 2502;
const NATIVE_MOUSE_MOVED = 2503;
const NATIVE_MOUSE_DRAGGED = 2504;
const NATIVE_MOUSE_WHEEL = 2505;

/**
* @var int
*/
public $button;
/**
* @var int
*/
public $clickCount;
/**
* @var int
*/
public $x;
/**
* @var int
*/
public $y;

public function __construct(int $id, int $when, int $modifiers, int $x, int $y, int $clickCount, int $button = 0){

}

public function isPrimaryButtonDown(): bool{}
public function isSecondaryButtonDown(): bool{}
public function isMiddleButtonDown(): bool{}
}
13 changes: 13 additions & 0 deletions sdk/nativehook/mouse/NativeMouseListener.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php


namespace nativehook\mouse;


interface NativeMouseListener{
public function nativeMouseClicked(NativeMouseEvent $event);

public function nativeMousePressed(NativeMouseEvent $event);

public function nativeMouseReleased(NativeMouseEvent $event);
}
11 changes: 11 additions & 0 deletions sdk/nativehook/mouse/NativeMouseMotionListener.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php


namespace nativehook\mouse;


interface NativeMouseMotionListener{
public function nativeMouseMoved(NativeMouseEvent $event);

public function nativeMouseDragged(NativeMouseEvent $event);
}
Loading

0 comments on commit cee17b2

Please sign in to comment.