]> Dogcows Code - chaz/openbox/commitdiff
Add _OB_VERSION and _OB_APP_ROLE/CLASS/NAME/TYPE
authorDana Jansens <danakj@orodu.net>
Mon, 11 Jan 2010 18:42:50 +0000 (13:42 -0500)
committerDana Jansens <danakj@orodu.net>
Mon, 11 Jan 2010 18:42:50 +0000 (13:42 -0500)
Add _OB_VERSION property on the root window.
Change _OB_ROLE/CLASS/NAME to _OB_APP_*.
Add _OB_APP_TYPE which has a string for the type chosen for the window on
  mapping by Openbox.
Adjust the rc.xml to match these changes.

configure.ac
data/rc.xml
openbox/client.c
openbox/prop.c
openbox/prop.h
openbox/screen.c
version.h.in

index bba1b5c605674fbf10ad37b50e82ee7b14ad69c2..eb11c03f8b97900f9f2d14637174eb0a3ca3c32f 100644 (file)
@@ -18,7 +18,7 @@ OB_MINOR_VERSION=4
 OB_MICRO_VERSION=16
 OB_INTERFACE_AGE=0
 OB_BINARY_AGE=0
-OB_VERSION=$OB_MAJOR_VERSION.$OB_MINOR_VERSION
+OB_VERSION=$PACKAGE_VERSION
 
 AC_SUBST(OB_MAJOR_VERSION)
 AC_SUBST(OB_MINOR_VERSION)
index c89625dd764815ec632af87112a9135d23ea8dc1..a576ca604ffa9dd21717b620b71d42df650103fd 100644 (file)
   # this is an example with comments through out. use these to make your
   # own rules, but without the comments of course.
 
-  <application name="the window's _OB_NAME property (see obxprop)"
-              class="the window's _OB_CLASS property (see obxprop)"
-               role="the window's _OB_ROLE property (see obxprop)"
-               type="the window's _NET_WM_WINDOW_TYPE (see obxprob)..
+  <application name="the window's _OB_APP_NAME property (see obxprop)"
+              class="the window's _OB_APP_CLASS property (see obxprop)"
+               role="the window's _OB_APP_ROLE property (see obxprop)"
+               type="the window's _OB_APP_TYPE property (see obxprob)..
                       (if unspecified, then it is 'dialog' for child windows)">
-  # the name or the class can be set, or both. this is used to match
-  # windows when they appear. role can optionally be set as well, to
-  # further restrict your matches.
+  # you may set only one of name/class/role/type, or you may use more than one
+  # together to restrict your matches.
 
   # the name, class, and role use simple wildcard matching such as those
   # used by a shell. you can use * to match any characters and ? to match
   # order that they appear in this list
 
 
-    # each element can be left out or set to 'default' to specify to not 
+    # each rule element can be left out or set to 'default' to specify to not 
     # change that attribute of the window
 
     <decor>yes</decor>
index ae87ff0b2af697d7b338f294b20135ad17d24f1b..6799654eb81c30813d9d9b60363286d159a27139 100644 (file)
@@ -76,7 +76,7 @@ static RrImage *client_default_icon     = NULL;
 static void client_get_all(ObClient *self, gboolean real);
 static void client_get_startup_id(ObClient *self);
 static void client_get_session_ids(ObClient *self);
-static void client_save_session_ids(ObClient *self);
+static void client_save_app_rule_values(ObClient *self);
 static void client_get_area(ObClient *self);
 static void client_get_desktop(ObClient *self);
 static void client_get_state(ObClient *self);
@@ -1163,7 +1163,9 @@ static void client_get_all(ObClient *self, gboolean real)
     /* get the session related properties, these can change decorations
        from per-app settings */
     client_get_session_ids(self);
-    client_save_session_ids(self);
+
+    /* save the values of the variables used for app rule matching */
+    client_save_app_rule_values(self);
 
     /* now we got everything that can affect the decorations */
     if (!real)
@@ -2372,13 +2374,36 @@ static void client_get_session_ids(ObClient *self)
     }
 }
 
-/*! Save the session IDs as seen by Openbox when the window mapped, so that
-  users can still access them later if the app changes them */
-static void client_save_session_ids(ObClient *self)
+/*! Save the properties used for app matching rules, as seen by Openbox when
+  the window mapped, so that users can still access them later if the app
+  changes them */
+static void client_save_app_rule_values(ObClient *self)
 {
-    PROP_SETS(self->window, ob_role, self->role);
-    PROP_SETS(self->window, ob_name, self->name);
-    PROP_SETS(self->window, ob_class, self->class);
+    const gchar *type;
+
+    PROP_SETS(self->window, ob_app_role, self->role);
+    PROP_SETS(self->window, ob_app_name, self->name);
+    PROP_SETS(self->window, ob_app_class, self->class);
+
+    switch (self->type) {
+    case OB_CLIENT_TYPE_NORMAL:
+        type = "normal"; break;
+    case OB_CLIENT_TYPE_DIALOG:
+        type = "dialog"; break;
+    case OB_CLIENT_TYPE_UTILITY:
+        type = "utility"; break;
+    case OB_CLIENT_TYPE_MENU:
+        type = "menu"; break;
+    case OB_CLIENT_TYPE_TOOLBAR:
+        type = "toolbar"; break;
+    case OB_CLIENT_TYPE_SPLASH:
+        type = "splash"; break;
+    case OB_CLIENT_TYPE_DESKTOP:
+        type = "desktop"; break;
+    case OB_CLIENT_TYPE_DOCK:
+        type = "dock"; break;
+    }
+    PROP_SETS(self->window, ob_app_type, type);
 }
 
 static void client_change_wm_state(ObClient *self)
index b21b3f533fbf3809f9872d25ae8a2aed26bdbce7..5184edae83d2cf30ef1e08b24d8602adda87632d 100644 (file)
@@ -179,9 +179,11 @@ void prop_startup(void)
     CREATE(ob_wm_action_undecorate, "_OB_WM_ACTION_UNDECORATE");
     CREATE(ob_wm_state_undecorated, "_OB_WM_STATE_UNDECORATED");
     CREATE(ob_control, "_OB_CONTROL");
-    CREATE(ob_role, "_OB_ROLE");
-    CREATE(ob_name, "_OB_NAME");
-    CREATE(ob_class, "_OB_CLASS");
+    CREATE(ob_version, "_OB_VERSION");
+    CREATE(ob_app_role, "_OB_APP_ROLE");
+    CREATE(ob_app_name, "_OB_APP_NAME");
+    CREATE(ob_app_class, "_OB_APP_CLASS");
+    CREATE(ob_app_type, "_OB_APP_TYPE");
 }
 
 #include <X11/Xutil.h>
index 419aa512b91ee4e3c05017393b2ad3b349721e33..716456737792d7fe4a11bc1752f66db01beffc43 100644 (file)
@@ -202,9 +202,11 @@ typedef struct Atoms {
     Atom ob_theme;
     Atom ob_config_file;
     Atom ob_control;
-    Atom ob_role;
-    Atom ob_name;
-    Atom ob_class;
+    Atom ob_version;
+    Atom ob_app_role;
+    Atom ob_app_name;
+    Atom ob_app_class;
+    Atom ob_app_type;
 } Atoms;
 extern Atoms prop_atoms;
 
index 075d3074e5b4056ce9ff8f45004590d41bcb2088..5ae07907b3ea1a17c10cfe24a3c54121a8f69121 100644 (file)
@@ -303,15 +303,20 @@ gboolean screen_annex(void)
     supported[i++] = prop_atoms.ob_theme;
     supported[i++] = prop_atoms.ob_config_file;
     supported[i++] = prop_atoms.ob_control;
-    supported[i++] = prop_atoms.ob_role;
-    supported[i++] = prop_atoms.ob_name;
-    supported[i++] = prop_atoms.ob_class;
+    supported[i++] = prop_atoms.ob_version;
+    supported[i++] = prop_atoms.ob_app_role;
+    supported[i++] = prop_atoms.ob_app_name;
+    supported[i++] = prop_atoms.ob_app_class;
+    supported[i++] = prop_atoms.ob_app_type;
     g_assert(i == num_support);
 
     PROP_SETA32(RootWindow(ob_display, ob_screen),
                 net_supported, atom, supported, num_support);
     g_free(supported);
 
+    PROP_SETS(RootWindow(ob_display, ob_screen), ob_version,
+              OB_VERSION);
+
     screen_tell_ksplash();
 
     return TRUE;
index da3f02efc61eccf9b48fe9704bc54402d0ee2319..70cfcec61c33b1c514e93b1d80106c2103c4ab0b 100644 (file)
@@ -4,7 +4,7 @@
 #define OB_MAJOR_VERSION @OB_MAJOR_VERSION@
 #define OB_MINOR_VERSION @OB_MINOR_VERSION@
 #define OB_MICRO_VERSION @OB_MICRO_VERSION@
-#define OB_VERSION OB_MAJOR_VERSION.OB_MINOR_VERSION.OB_MICRO_VERSION
+#define OB_VERSION "@OB_VERSION@"
 
 #define OB_CHECK_VERSION(major,minor,micro) \
     (OB_MAJOR_VERSION > (major) || \
This page took 0.027422 seconds and 4 git commands to generate.