X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fbindings.cc;h=fcbff769f5e4945506d5460784f5a144c74ccdca;hb=d22a6c6c04cf20bd23efa68ad1202f278f25e113;hp=783b6479c2b2d03cdea56828dc80f423346c2405;hpb=c2c21e9588c00944dfed4cfc7e48d14570444534;p=chaz%2Fopenbox diff --git a/src/bindings.cc b/src/bindings.cc index 783b6479..fcbff769 100644 --- a/src/bindings.cc +++ b/src/bindings.cc @@ -385,9 +385,6 @@ bool Bindings::grabKeyboard(int screen, PyObject *callback) if (XGrabKeyboard(**otk::display, root, false, GrabModeAsync, GrabModeAsync, CurrentTime)) return false; - // the pointer grab causes pointer events during the keyboard grab to go away - XGrabPointer(**otk::display, root, false, 0, GrabModeAsync, - GrabModeAsync, None, None, CurrentTime); _keybgrab_callback = callback; return true; } @@ -403,6 +400,24 @@ void Bindings::ungrabKeyboard() } +bool Bindings::grabPointer(int screen) +{ + if (!openbox->screen(screen)) + return false; // the screen is not managed + + Window root = otk::display->screenInfo(screen)->rootWindow(); + XGrabPointer(**otk::display, root, false, 0, GrabModeAsync, + GrabModeAsync, None, None, CurrentTime); + return true; +} + + +void Bindings::ungrabPointer() +{ + XUngrabPointer(**otk::display, CurrentTime); +} + + void Bindings::fireKey(int screen, unsigned int modifiers, unsigned int key, Time time, KeyAction::KA action) { @@ -427,7 +442,7 @@ void Bindings::fireKey(int screen, unsigned int modifiers, unsigned int key, _timer = new otk::Timer(5000, // 5 second timeout (otk::Timer::TimeoutHandler)resetChains, this); - // grab the server here to make sure no key pressed go missed + // grab the server here to make sure no key presses get missed otk::display->grab(); grabKeys(false); _curpos = p;