Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask);
ButtonData *data = new_button_data(e.window, e.time, state, e.button,
w->mcontext(), MousePress);
- Openbox::instance->bindings()->fire(data);
+ Openbox::instance->bindings()->fireButton(data);
Py_DECREF((PyObject*)data);
if (_button) return; // won't count toward CLICK events
Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask);
ButtonData *data = new_button_data(e.window, e.time, state, e.button,
w->mcontext(), MouseClick);
- Openbox::instance->bindings()->fire(data);
+ Openbox::instance->bindings()->fireButton(data);
if (e.time - _release.time < DOUBLECLICKDELAY &&
// run the DOUBLECLICK python hook
data->action = MouseDoubleClick;
- Openbox::instance->bindings()->fire(data);
+ Openbox::instance->bindings()->fireButton(data);
// reset so you cant triple click for 2 doubleclicks
_release.win = 0;
unsigned int state = e.state & (ControlMask | ShiftMask | Mod1Mask |
Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask);
- Openbox::instance->bindings()->fire(state, e.keycode, e.time);
+ Openbox::instance->bindings()->fireKey(state, e.keycode, e.time);
}
w->mcontext(), MouseMotion,
x_root, y_root, _posqueue[0]->pos,
_posqueue[0]->clientarea);
- Openbox::instance->bindings()->fire((ButtonData*)data);
+ Openbox::instance->bindings()->fireButton((ButtonData*)data);
Py_DECREF((PyObject*)data);
}
OBBindings::~OBBindings()
{
grabKeys(false);
- removeAll();
+ removeAllKeys();
+ removeAllButtons();
}
}
-bool OBBindings::add(const StringVect &keylist, PyObject *callback)
+bool OBBindings::addKey(const StringVect &keylist, PyObject *callback)
{
KeyBindingTree *tree;
bool conflict;
}
-bool OBBindings::remove(const StringVect &keylist)
+bool OBBindings::removeKey(const StringVect &keylist)
{
assert(false); // XXX: function not implemented yet
}
-void OBBindings::removeAll()
+void OBBindings::removeAllKeys()
{
+ grabKeys(false);
if (_keytree.first_child) {
remove_branch(_keytree.first_child);
_keytree.first_child = 0;
}
+ grabKeys(true);
}
}
-void OBBindings::fire(unsigned int modifiers, unsigned int key, Time time)
+void OBBindings::fireKey(unsigned int modifiers, unsigned int key, Time time)
{
if (key == _resetkey.key && modifiers == _resetkey.modifiers) {
reset(this);
return true;
}
+void OBBindings::removeAllButtons()
+{
+ // XXX: UNGRAB shits
+ for (int i = i; i < NUM_MOUSE_CONTEXT; ++i) {
+ ButtonBindingList::iterator it, end = _buttons[i].end();
+ for (it = _buttons[i].begin(); it != end; ++it)
+ for (int a = 0; a < NUM_MOUSE_ACTION; ++a) {
+ Py_XDECREF((*it)->callback[a]);
+ (*it)->callback[a] = 0;
+ }
+ }
+}
+
void OBBindings::grabButtons(bool grab, OBClient *client)
{
for (int i = 0; i < NUM_MOUSE_CONTEXT; ++i) {
}
}
-void OBBindings::fire(ButtonData *data)
+void OBBindings::fireButton(ButtonData *data)
{
printf("but.mods %d.%d\n", data->button, data->state);
a chain or not), or if any of the strings in the keylist are invalid.
@return true if the binding could be added; false if it could not.
*/
- bool add(const StringVect &keylist, PyObject *callback);
+ bool addKey(const StringVect &keylist, PyObject *callback);
//! Removes a key binding
/*!
@return The callbackid of the binding, or '< 0' if there was no binding to
be removed.
*/
- bool remove(const StringVect &keylist);
+ bool removeKey(const StringVect &keylist);
//! Removes all key bindings
- void removeAll();
+ void removeAllKeys();
- void fire(unsigned int modifiers,unsigned int key, Time time);
+ void fireKey(unsigned int modifiers,unsigned int key, Time time);
void setResetKey(const std::string &key);
void grabButtons(bool grab, OBClient *client);
- void fire(ButtonData *data);
+ //! Removes all button bindings
+ void removeAllButtons();
+
+ void fireButton(ButtonData *data);
};
}
vectkeylist.push_back(PyString_AsString(str));
}
- if (!ob::Openbox::instance->bindings()->add(vectkeylist, func)) {
+ if (!ob::Openbox::instance->bindings()->addKey(vectkeylist, func)) {
PyErr_SetString(PyExc_RuntimeError,"Unable to add binding.");
return NULL;
}
vectkeylist.push_back(PyString_AsString(str));
}
- ob::Openbox::instance->bindings()->remove(vectkeylist);
+ ob::Openbox::instance->bindings()->removeKey(vectkeylist);
Py_INCREF(Py_None); return Py_None;
}
void kunbind_all()
{
- ob::Openbox::instance->bindings()->removeAll();
+ ob::Openbox::instance->bindings()->removeAllKeys();
}
void set_reset_key(const std::string &key)