all repos — openbox @ 7db3ffecc980821ada3e805e2471716896e2410a

openbox fork - make it a bit more like ryudo

you can bind buttons already about, and itll replace them
Dana Jansens danakj@orodu.net
commit

7db3ffecc980821ada3e805e2471716896e2410a

parent

165601550c205d6159a41146c38c5a30884f75e7

5 files changed, 12 insertions(+), 57 deletions(-)

jump to
M scripts/config.pyscripts/config.py

@@ -17,18 +17,10 @@ ### Options that can be modified by the user to change the default hooks' ###

### 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"
M src/bindings.ccsrc/bindings.cc

@@ -386,11 +386,8 @@ // look for a duplicate binding

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 @@ bind = new ButtonBinding();

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 @@ ButtonBindingList::iterator it, end = _buttons[data->context].end();

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); } }
M src/bindings.hhsrc/bindings.hh

@@ -52,9 +52,9 @@ } KeyBindingTree;

typedef struct ButtonBinding { Binding binding; - typedef std::list<PyObject*> CallbackList; - CallbackList callback[NUM_MOUSE_ACTION]; + PyObject *callback[NUM_MOUSE_ACTION]; ButtonBinding() : binding(0, 0) { + for(int i=0; i<NUM_MOUSE_ACTION; ++i) callback[i] = 0; } };
M src/frame.ccsrc/frame.cc

@@ -58,44 +58,15 @@

_plate.show(); // the other stuff is shown based on decor settings grabClient(); - - grabButtons(true); } OBFrame::~OBFrame() { - grabButtons(false); releaseClient(false); } -void OBFrame::grabButtons(bool grab) -{ -/* _plate.grabButtons(grab); - - // grab any requested buttons on the entire frame - std::vector<std::string> grabs; - if (python_get_stringlist("client_buttons", &grabs)) { - std::vector<std::string>::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);
M src/frame.hhsrc/frame.hh

@@ -80,9 +80,6 @@

//! 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 /*!