From 91af4d5bc9e04b766735aaa3ac098233ba103959 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Mon, 11 Jan 2010 13:42:50 -0500 Subject: [PATCH] Add _OB_VERSION and _OB_APP_ROLE/CLASS/NAME/TYPE 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 | 2 +- data/rc.xml | 15 +++++++-------- openbox/client.c | 41 +++++++++++++++++++++++++++++++++-------- openbox/prop.c | 8 +++++--- openbox/prop.h | 8 +++++--- openbox/screen.c | 11 ++++++++--- version.h.in | 2 +- 7 files changed, 60 insertions(+), 27 deletions(-) diff --git a/configure.ac b/configure.ac index bba1b5c6..eb11c03f 100644 --- a/configure.ac +++ b/configure.ac @@ -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) diff --git a/data/rc.xml b/data/rc.xml index c89625dd..a576ca60 100644 --- a/data/rc.xml +++ b/data/rc.xml @@ -653,14 +653,13 @@ # this is an example with comments through out. use these to make your # own rules, but without the comments of course. - - # 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 @@ -673,7 +672,7 @@ # 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 yes diff --git a/openbox/client.c b/openbox/client.c index ae87ff0b..6799654e 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -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) diff --git a/openbox/prop.c b/openbox/prop.c index b21b3f53..5184edae 100644 --- a/openbox/prop.c +++ b/openbox/prop.c @@ -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 diff --git a/openbox/prop.h b/openbox/prop.h index 419aa512..71645673 100644 --- a/openbox/prop.h +++ b/openbox/prop.h @@ -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; diff --git a/openbox/screen.c b/openbox/screen.c index 075d3074..5ae07907 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -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; diff --git a/version.h.in b/version.h.in index da3f02ef..70cfcec6 100644 --- a/version.h.in +++ b/version.h.in @@ -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) || \ -- 2.45.2