Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

18
LINES

< > BotCompany Repo | #1010548 - onGlobalKeyPress [JNativeHook]

JavaX fragment (include)

static L<NativeKeyAdapter> onGlobalKeyPress_listeners = synchroList();

// f: voidfunc(NativeKeyEvent)
static AutoCloseable onGlobalKeyPress(fO f) {
  jnativehook_init();
  final NativeKeyAdapter listener = new {
    public void nativeKeyPressed(NativeKeyEvent e) {
      pcallF(f, e);
    }
  };
  GlobalScreen.addNativeKeyListener(addAndReturn(onGlobalKeyPress_listeners, listener));
  ret autoCloseable { GlobalScreen.removeNativeKeyListener(listener); };
}

static void cleanMeUp_onGlobalKeyPress() {
  for (NativeKeyAdapter a : getAndClearList(onGlobalKeyPress_listeners))
    GlobalScreen.removeNativeKeyListener(a);
}

download  show line numbers  debug dex   

Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz

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: 322 / 339
Version history: 11 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1010548 & http://1010548.tinybrain.de