if (_timer)
delete _timer;
- grabKeys(false);
removeAllKeys();
-// removeAllButtons(); XXX
+ //removeAllButtons(); // this is done by each client as they are unmanaged
removeAllEvents();
}
if (t) {
// already bound to something
- // XXX: look if callback is already bound to this key?
t->callbacks.push_back(callback);
destroytree(tree);
} else {
return true;
}
-
+/*
bool Bindings::removeKey(const StringVect &keylist, PyObject *callback)
{
assert(false); // XXX: function not implemented yet
}
return false;
}
-
+*/
void Bindings::setResetKey(const std::string &key)
{
if (XGrabKeyboard(**otk::display, root, false, GrabModeAsync,
GrabModeAsync, CurrentTime))
return false;
- XGrabPointer(**otk::display, root, false, 0, GrabModeAsync,
- GrabModeAsync, None, None, CurrentTime);
_keybgrab_callback = callback;
return true;
}
}
+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)
{
_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;
MouseAction::MA action, PyObject *callback)
{
assert(context >= 0 && context < MouseContext::NUM_MOUSE_CONTEXT);
+ assert(action >= 0 && action < MouseAction::NUM_MOUSE_ACTION);
Binding b(0,0);
if (!translate(but, b, false))