all repos — openbox @ d13f021b8bb2a6b8e49f69a370409e79a7f02213

openbox fork - make it a bit more like ryudo

add support for wm_window_role
Dana Jansens danakj@orodu.net
commit

d13f021b8bb2a6b8e49f69a370409e79a7f02213

parent

69c257faa94334b8d19fc97292622499c43929db

M otk/otk_wrap.ccotk/otk_wrap.cc

@@ -13577,6 +13577,7 @@ { SWIG_PY_INT, (char *)"OBProperty_wm_change_state", (long) otk::OBProperty::wm_change_state, 0, 0, 0},

{ SWIG_PY_INT, (char *)"OBProperty_wm_name", (long) otk::OBProperty::wm_name, 0, 0, 0}, { SWIG_PY_INT, (char *)"OBProperty_wm_icon_name", (long) otk::OBProperty::wm_icon_name, 0, 0, 0}, { SWIG_PY_INT, (char *)"OBProperty_wm_class", (long) otk::OBProperty::wm_class, 0, 0, 0}, +{ SWIG_PY_INT, (char *)"OBProperty_wm_window_role", (long) otk::OBProperty::wm_window_role, 0, 0, 0}, { SWIG_PY_INT, (char *)"OBProperty_motif_wm_hints", (long) otk::OBProperty::motif_wm_hints, 0, 0, 0}, { SWIG_PY_INT, (char *)"OBProperty_blackbox_attributes", (long) otk::OBProperty::blackbox_attributes, 0, 0, 0}, { SWIG_PY_INT, (char *)"OBProperty_blackbox_change_attributes", (long) otk::OBProperty::blackbox_change_attributes, 0, 0, 0},
M otk/property.ccotk/property.cc

@@ -40,6 +40,7 @@ _atoms[wm_take_focus] = create("WM_TAKE_FOCUS");

_atoms[wm_name] = create("WM_NAME"); _atoms[wm_icon_name] = create("WM_ICON_NAME"); _atoms[wm_class] = create("WM_CLASS"); + _atoms[wm_window_role] = create("WM_WINDOW_ROLE"); _atoms[motif_wm_hints] = create("_MOTIF_WM_HINTS"); _atoms[blackbox_hints] = create("_BLACKBOX_HINTS"); _atoms[blackbox_attributes] = create("_BLACKBOX_ATTRIBUTES");
M otk/property.hhotk/property.hh

@@ -45,6 +45,7 @@ wm_change_state,

wm_name, wm_icon_name, wm_class, + wm_window_role, motif_wm_hints, blackbox_attributes, blackbox_change_attributes,
M src/actions.ccsrc/actions.cc

@@ -213,28 +213,19 @@

void OBActions::mapRequestHandler(const XMapRequestEvent &e) { OtkEventHandler::mapRequestHandler(e); - - EventData *data = new_event_data(e.window, EventNewWindow, 0); - Openbox::instance->bindings()->fireEvent(data); - Py_DECREF((PyObject*)data); + // do this in OBScreen::manageWindow } void OBActions::unmapHandler(const XUnmapEvent &e) { OtkEventHandler::unmapHandler(e); - - EventData *data = new_event_data(e.window, EventCloseWindow, 0); - Openbox::instance->bindings()->fireEvent(data); - Py_DECREF((PyObject*)data); + // do this in OBScreen::unmanageWindow } void OBActions::destroyHandler(const XDestroyWindowEvent &e) { OtkEventHandler::destroyHandler(e); - - EventData *data = new_event_data(e.window, EventCloseWindow, 0); - Openbox::instance->bindings()->fireEvent(data); - Py_DECREF((PyObject*)data); + // do this in OBScreen::unmanageWindow } }
M src/client.ccsrc/client.cc

@@ -478,17 +478,23 @@ {

const otk::OBProperty *property = Openbox::instance->property(); // set the defaults - _app_name = _app_class = ""; + _app_name = _app_class = _role = ""; otk::OBProperty::StringVect v; unsigned long num = 2; - if (! property->get(_window, otk::OBProperty::wm_class, - otk::OBProperty::ascii, &num, &v)) - return; + if (property->get(_window, otk::OBProperty::wm_class, + otk::OBProperty::ascii, &num, &v)) { + if (num > 0) _app_name = v[0]; + if (num > 1) _app_class = v[1]; + } - if (num > 0) _app_name = v[0]; - if (num > 1) _app_class = v[1]; + v.clear(); + num = 1; + if (property->get(_window, otk::OBProperty::wm_window_role, + otk::OBProperty::ascii, &num, &v)) { + if (num > 0) _role = v[0]; + } }
M src/client.hhsrc/client.hh

@@ -171,6 +171,8 @@ //! The application that created the window

std::string _app_name; //! The class of the window, can used for grouping std::string _app_class; + //! The specified role of the window, used for identification + std::string _role; //! The type of window (what its function is) WindowType _type;

@@ -376,9 +378,11 @@ //! Returns the application's name to whom the window belongs

inline const std::string &appName() const { return _app_name; } //! Returns the class of the window inline const std::string &appClass() const { return _app_class; } + //! Returns the program-specified role of the window + inline const std::string &role() const { return _role; } //! Returns if the window can be focused /*! - @return true if the window can receive focusl otherwise, false + @return true if the window can receive focus; otherwise, false */ inline bool canFocus() const { return _can_focus; } //! Returns if the window has indicated that it needs urgent attention
M src/openbox_wrap.ccsrc/openbox_wrap.cc

@@ -1976,6 +1976,28 @@ return NULL;

} +static PyObject *_wrap_OBClient_role(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::OBClient *arg1 = (ob::OBClient *) 0 ; + std::string *result; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"O:OBClient_role",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__OBClient,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + { + std::string const &_result_ref = ((ob::OBClient const *)arg1)->role(); + result = (std::string *) &_result_ref; + } + + { + resultobj = PyString_FromString(result->c_str()); + } + return resultobj; + fail: + return NULL; +} + + static PyObject *_wrap_OBClient_canFocus(PyObject *self, PyObject *args) { PyObject *resultobj; ob::OBClient *arg1 = (ob::OBClient *) 0 ;

@@ -2764,6 +2786,7 @@ { (char *)"OBClient_title", _wrap_OBClient_title, METH_VARARGS },

{ (char *)"OBClient_iconTitle", _wrap_OBClient_iconTitle, METH_VARARGS }, { (char *)"OBClient_appName", _wrap_OBClient_appName, METH_VARARGS }, { (char *)"OBClient_appClass", _wrap_OBClient_appClass, METH_VARARGS }, + { (char *)"OBClient_role", _wrap_OBClient_role, METH_VARARGS }, { (char *)"OBClient_canFocus", _wrap_OBClient_canFocus, METH_VARARGS }, { (char *)"OBClient_urgent", _wrap_OBClient_urgent, METH_VARARGS }, { (char *)"OBClient_focusNotify", _wrap_OBClient_focusNotify, METH_VARARGS },
M src/screen.ccsrc/screen.cc

@@ -521,12 +521,22 @@ Openbox::instance->bindings()->grabButtons(true, client);

// XXX: make this optional or more intelligent client->focus(); + + // call the python NEWWINDOW binding + EventData *data = new_event_data(window, EventNewWindow, 0); + Openbox::instance->bindings()->fireEvent(data); + Py_DECREF((PyObject*)data); } void OBScreen::unmanageWindow(OBClient *client) { OBFrame *frame = client->frame; + + // call the python CLOSEWINDOW binding + EventData *data = new_event_data(client->window(), EventCloseWindow, 0); + Openbox::instance->bindings()->fireEvent(data); + Py_DECREF((PyObject*)data); Openbox::instance->bindings()->grabButtons(false, client);