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.
This commit is contained in:
Dana Jansens 2010-01-11 13:42:50 -05:00
parent b8e994e837
commit 91af4d5bc9
7 changed files with 60 additions and 27 deletions

View 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)

View file

@ -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.
<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
@ -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
<decor>yes</decor>

View 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)

View 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>

View 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;

View 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;

View 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) || \