1 | static L<NativeKeyAdapter> onGlobalKeyPress_listeners = synchroList(); |
2 | |
3 | // f: voidfunc(NativeKeyEvent) |
4 | static AutoCloseable onGlobalKeyPress(fO f) { |
5 | jnativehook_init(); |
6 | final NativeKeyAdapter listener = new { |
7 | public void nativeKeyPressed(NativeKeyEvent e) { |
8 | pcallF(f, e); |
9 | } |
10 | }; |
11 | GlobalScreen.addNativeKeyListener(addAndReturn(onGlobalKeyPress_listeners, listener)); |
12 | ret autoCloseable { GlobalScreen.removeNativeKeyListener(listener); }; |
13 | } |
14 | |
15 | static void cleanMeUp_onGlobalKeyPress() { |
16 | for (NativeKeyAdapter a : getAndClearList(onGlobalKeyPress_listeners)) |
17 | GlobalScreen.removeNativeKeyListener(a); |
18 | } |
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1010548 |
Snippet name: | onGlobalKeyPress [JNativeHook] |
Eternal ID of this version: | #1010548/12 |
Text MD5: | 62f7d648bdf6b6d96752b0d1067d3a38 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-10-05 18:50:58 |
Source code size: | 641 bytes / 18 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 645 / 671 |
Version history: | 11 change(s) |
Referenced in: | [show references] |