diff --git a/lib/native/linux-64/libglobalshortcut.so b/lib/native/linux-64/libglobalshortcut.so index 8abbb768c..3c813b870 100755 Binary files a/lib/native/linux-64/libglobalshortcut.so and b/lib/native/linux-64/libglobalshortcut.so differ diff --git a/lib/native/linux/libglobalshortcut.so b/lib/native/linux/libglobalshortcut.so index 6c8a23b19..72bb02dc0 100755 Binary files a/lib/native/linux/libglobalshortcut.so and b/lib/native/linux/libglobalshortcut.so differ diff --git a/src/native/globalshortcut/net_java_sip_communicator_impl_globalshortcut_NativeKeyboardHook.cc b/src/native/globalshortcut/net_java_sip_communicator_impl_globalshortcut_NativeKeyboardHook.cc index 6bde78a73..44f6a2c4e 100644 --- a/src/native/globalshortcut/net_java_sip_communicator_impl_globalshortcut_NativeKeyboardHook.cc +++ b/src/native/globalshortcut/net_java_sip_communicator_impl_globalshortcut_NativeKeyboardHook.cc @@ -21,7 +21,7 @@ #include #include #include - + #include "javakey.h" /** @@ -699,11 +699,13 @@ static void notify(struct keyboard_hook* keyboard, jint keycode, jint modifiers, static void* x11_event_loop_thread(void* arg) { struct keyboard_hook* keyboard = (struct keyboard_hook*)arg; + keystrok activeHotKey; + bool hotKeyActivated = false; XSelectInput(keyboard->display, keyboard->root, KeyPressMask | KeyReleaseMask); while(keyboard->running) { - XEvent ev; + XEvent ev, next_ev; while(XCheckMaskEvent(keyboard->display, 0xFFFFFFFF, &ev)) { switch (ev.type) @@ -713,10 +715,6 @@ static void* x11_event_loop_thread(void* arg) for(std::list::iterator it = keyboard->keystrokes.begin() ; it != keyboard->keystrokes.end() ; ++it) { keystrok& ks = (*it); - if(ev.type == KeyRelease && !ks.onrelease) - { - continue; - } XKeyEvent* keyEvent = (XKeyEvent*)&ev.xkey; unsigned long keycode = -1; //XKeycodeToKeysym(keyboard->display, keyEvent->keycode, 1); @@ -728,6 +726,35 @@ static void* x11_event_loop_thread(void* arg) if(ks.vkcode == keycode && ks.modifiers == modifiers) { + if(ev.type == KeyRelease) + { + if(hotKeyActivated && activeHotKey.vkcode == keycode && activeHotKey.modifiers == modifiers) + { + if(XEventsQueued(keyboard->display, QueuedAfterReading)) + { + XPeekEvent(keyboard->display, &next_ev); + if(next_ev.type == KeyPress + && next_ev.xkey.time == keyEvent->time + && next_ev.xkey.keycode == keyEvent->keycode + && next_ev.xkey.state == keyEvent->state) + { + //disable the autorepeat event from the queue and continue with next messages + XCheckMaskEvent(keyboard->display, 0xFFFFFFFF, &ev); + continue; + } + } + hotKeyActivated = false; + } + if(!ks.onrelease) + { + continue; + } + } + else + { + hotKeyActivated = true; + activeHotKey = *it; + } notify(keyboard, ks.vkcode, ks.modifiers, (ev.type == KeyRelease)); } }