]> Dogcows Code - chaz/openbox/commitdiff
add support for wm_window_role
authorDana Jansens <danakj@orodu.net>
Sat, 4 Jan 2003 19:09:52 +0000 (19:09 +0000)
committerDana Jansens <danakj@orodu.net>
Sat, 4 Jan 2003 19:09:52 +0000 (19:09 +0000)
otk/otk_wrap.cc
otk/property.cc
otk/property.hh
src/actions.cc
src/client.cc
src/client.hh
src/openbox_wrap.cc
src/screen.cc

index 0b7ee3ac5af5481f5a570d4bac232f56ac54c0b7..f3951d4931ab15dfd4c3af9118b4fbe0d3403d56 100644 (file)
@@ -13577,6 +13577,7 @@ static swig_const_info swig_const_table[] = {
 { 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},
index 5ebb2f0f154b05cdcbaa2a23c0fb00e9d17de8ef..f26795e4dd2d1792e576654759721f49e65586e2 100644 (file)
@@ -40,6 +40,7 @@ OBProperty::OBProperty()
   _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");
index b016cd04b70aba6be3be29272e3639bf6d02dc9e..e3588c043effc8aef8e99eb0796395e689055fbb 100644 (file)
@@ -45,6 +45,7 @@ public:
     wm_name,
     wm_icon_name,
     wm_class,
+    wm_window_role,
     motif_wm_hints,
     blackbox_attributes,
     blackbox_change_attributes,
index fba1eaf1f27f3694b177e2a92c5fc1115940d5c4..dec03e80992296f16d62384f7b43aa411f3556ff 100644 (file)
@@ -213,28 +213,19 @@ void OBActions::motionHandler(const XMotionEvent &e)
 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
 }
 
 }
index a6990a8db5d792d5bafc62b5c6977d808222d569..7b846729e86a60ddc313f32e1e235533edec8dcd 100644 (file)
@@ -478,17 +478,23 @@ void OBClient::updateClass()
   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];
+  }
 }
 
 
index 41ca3dd21cd25f1530b9657e66eeee24264a7c77..724cf5189ae23919436a42d43923834d4f4cc5b2 100644 (file)
@@ -171,6 +171,8 @@ private:
   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 @@ public:
   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
index c8e2e65dcd39c36a8c877193b9deedc389903099..6f2697067c41ca24ccf50ea694e42f0b0f8b7507 100644 (file)
@@ -1976,6 +1976,28 @@ static PyObject *_wrap_OBClient_appClass(PyObject *self, PyObject *args) {
 }
 
 
+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 @@ static PyMethodDef SwigMethods[] = {
         { (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 },
index d9067aa05f9e789e7470545f4f556d3ad5ff71fb..f44e291cee51ebbe884d3a8446854c81ff7b60ba 100644 (file)
@@ -521,6 +521,11 @@ void OBScreen::manageWindow(Window window)
 
   // 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);
 }
 
 
@@ -528,6 +533,11 @@ 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);
 
   // remove from the stacking order
This page took 0.036246 seconds and 4 git commands to generate.