From: Dana Jansens Date: Fri, 3 Jan 2003 06:55:04 +0000 (+0000) Subject: you can bind buttons already about, and itll replace them X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=7db3ffecc980821ada3e805e2471716896e2410a;p=chaz%2Fopenbox you can bind buttons already about, and itll replace them --- diff --git a/scripts/config.py b/scripts/config.py index c3c43754..c1f60ba0 100644 --- a/scripts/config.py +++ b/scripts/config.py @@ -17,18 +17,10 @@ theme = "/usr/local/share/openbox/styles/nyz" ### behaviors. ### ############################################################################# -# click_focus - '1' if clicking in a client will cause it to focus in the -# default hook functions; else '0'. -click_focus = 0 -# click_raise - '1' if clicking in a client will cause it to raise to the -# top of its stacking layer; else '0'. -click_raise = 0 -# enter_focus - '1' if entering a client window will cause it to focus in the -# default hook functions; else '0'. -enter_focus = 1 -# leave_unfocus - '1' if leaving a client window will cause it to unfocus in -# the default hook functions; else '0'. -leave_unfocus = 1 +# resize_nearest - 1 to resize from the corner nearest where the mouse is, 0 +# to resize always from the bottom right corner +resize_nearest = 1 + print "Loaded config.py" diff --git a/src/bindings.cc b/src/bindings.cc index 943a9acc..3e9358d5 100644 --- a/src/bindings.cc +++ b/src/bindings.cc @@ -386,11 +386,8 @@ bool OBBindings::addButton(const std::string &but, MouseContext context, for (it = _buttons[context].begin(); it != end; ++it) if ((*it)->binding.key == b.key && (*it)->binding.modifiers == b.modifiers) { - ButtonBinding::CallbackList::iterator c_it, - c_end = (*it)->callback[action].end(); - for (c_it = (*it)->callback[action].begin(); c_it != c_end; ++c_it) - if (*c_it == callback) - return true; // already bound + if ((*it)->callback[action] == callback) + return true; // already bound break; } @@ -402,11 +399,11 @@ bool OBBindings::addButton(const std::string &but, MouseContext context, bind->binding.key = b.key; bind->binding.modifiers = b.modifiers; _buttons[context].push_back(bind); - printf("adding %d.%d to %d\n", b.key, b.modifiers, context); // XXX GRAB the new button everywhere! } else bind = *it; - bind->callback[action].push_back(callback); + Py_XDECREF(bind->callback[action]); // if it was already bound, unbind it + bind->callback[action] = callback; Py_INCREF(callback); return true; } @@ -450,10 +447,8 @@ void OBBindings::fire(ButtonData *data) for (it = _buttons[data->context].begin(); it != end; ++it) if ((*it)->binding.key == data->button && (*it)->binding.modifiers == data->state) { - ButtonBinding::CallbackList::iterator c_it, - c_end = (*it)->callback[data->action].end(); - for (c_it = (*it)->callback[data->action].begin(); c_it != c_end; ++c_it) - python_callback(*c_it, (PyObject*)data); + if ((*it)->callback[data->action]) + python_callback((*it)->callback[data->action], (PyObject*)data); } } diff --git a/src/bindings.hh b/src/bindings.hh index 5d1df29b..1ca46df7 100644 --- a/src/bindings.hh +++ b/src/bindings.hh @@ -52,9 +52,9 @@ typedef struct KeyBindingTree { typedef struct ButtonBinding { Binding binding; - typedef std::list CallbackList; - CallbackList callback[NUM_MOUSE_ACTION]; + PyObject *callback[NUM_MOUSE_ACTION]; ButtonBinding() : binding(0, 0) { + for(int i=0; i grabs; - if (python_get_stringlist("client_buttons", &grabs)) { - std::vector::iterator grab_it, grab_end = grabs.end(); - for (grab_it = grabs.begin(); grab_it != grab_end; ++grab_it) { - Binding b; - if (!Openbox::instance->bindings()->translate(*grab_it, b, false)) - continue; - printf("grabbing %d %d\n", b.key, b.modifiers); - if (grab) { - otk::OBDisplay::grabButton(b.key, b.modifiers, _window, true, - ButtonPressMask | ButtonMotionMask | - ButtonReleaseMask, GrabModeAsync, - GrabModeAsync, _window, None, false); - } else { - otk::OBDisplay::ungrabButton(b.key, b.modifiers, _window); - } - } - }*/ -} - - void OBFrame::setTitle(const std::string &text) { _label.setText(text); diff --git a/src/frame.hh b/src/frame.hh index 7313c3a1..ab1e1b03 100644 --- a/src/frame.hh +++ b/src/frame.hh @@ -80,9 +80,6 @@ private: //! Shape the frame window to the client window void adjustShape(); - //! Grabs or ungrabs buttons on the frame - void grabButtons(bool grab); - public: //! Constructs an OBFrame object, and reparents the client to itself /*!