summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon TURNEY <jon.turney@dronecode.org.uk>2012-11-08 23:59:35 +0000
committerJon TURNEY <jon.turney@dronecode.org.uk>2012-11-21 14:03:12 +0000
commit028e18a825c60cf628e42899b7a054dd5d2c4aef (patch)
treea3310f37045d7e1a91b00202cadd3bbf44133dda
parente9e46e5241a56bc68a75841b9cc6f37a419b1b90 (diff)
setup_window_type() fixes
After testing with metacity-window-demo Use correct length of atom array from xcb_ewmh_get_wm_window_type_reply() Recognize _NET_WM_WINDOW_TYPE_DOCK and _NET_WM_WINDOW_TYPE_DESKTOP Recognize _NET_WM_WINDOW_TYPE_SPLASHSCREEN as a synonym for _NET_WM_WINDOW_TYPE_SPLASH
-rw-r--r--src/libxcwm/atoms.c16
-rw-r--r--src/libxcwm/xcwm_internal.h1
2 files changed, 14 insertions, 3 deletions
diff --git a/src/libxcwm/atoms.c b/src/libxcwm/atoms.c
index 6033ce3..02217c9 100644
--- a/src/libxcwm/atoms.c
+++ b/src/libxcwm/atoms.c
@@ -174,6 +174,9 @@ _xcwm_atoms_init(xcwm_context_t *context)
21, /* Length of supported[] */
supported);
+ /* Used erroneously instead of _NET_WM_WINDOW_TYPE_SPLASH by some applications */
+ context->atoms->net_wm_window_type_splashscreen = _xcwm_atom_get(context, "_NET_WM_WINDOW_TYPE_SPLASHSCREEN");
+
/* Get the ICCCM atoms we need that are not included in the
* xcb_ewmh_connection_t. */
_xcwm_atom_register(context, "_NET_WM_NAME", set_window_name, XCWM_EVENT_WINDOW_NAME);
@@ -367,8 +370,14 @@ setup_window_type(xcwm_window_t *window, xcwm_property_t *property)
* match. */
cookie = xcb_ewmh_get_wm_window_type(&ewmh_conn, window->window_id);
if (xcb_ewmh_get_wm_window_type_reply(&ewmh_conn, cookie, &type, NULL)) {
- for (i = 0; i <= type.atoms_len; i++) {
- if (type.atoms[i] == ewmh_conn._NET_WM_WINDOW_TYPE_TOOLBAR) {
+ for (i = 0; i < type.atoms_len; i++) {
+ if (type.atoms[i] == ewmh_conn._NET_WM_WINDOW_TYPE_DESKTOP) {
+ window->type = XCWM_WINDOW_TYPE_DESKTOP;
+ break;
+ } else if (type.atoms[i] == ewmh_conn._NET_WM_WINDOW_TYPE_DOCK) {
+ window->type = XCWM_WINDOW_TYPE_DOCK;
+ break;
+ } else if (type.atoms[i] == ewmh_conn._NET_WM_WINDOW_TYPE_TOOLBAR) {
window->type = XCWM_WINDOW_TYPE_TOOLBAR;
break;
} else if (type.atoms[i] == ewmh_conn._NET_WM_WINDOW_TYPE_MENU) {
@@ -378,7 +387,8 @@ setup_window_type(xcwm_window_t *window, xcwm_property_t *property)
== ewmh_conn._NET_WM_WINDOW_TYPE_UTILITY) {
window->type = XCWM_WINDOW_TYPE_UTILITY;
break;
- } else if (type.atoms[i] == ewmh_conn._NET_WM_WINDOW_TYPE_SPLASH) {
+ } else if ((type.atoms[i] == ewmh_conn._NET_WM_WINDOW_TYPE_SPLASH) ||
+ (type.atoms[i] == window->context->atoms->net_wm_window_type_splashscreen)) {
window->type = XCWM_WINDOW_TYPE_SPLASH;
break;
} else if (type.atoms[i] == ewmh_conn._NET_WM_WINDOW_TYPE_DIALOG) {
diff --git a/src/libxcwm/xcwm_internal.h b/src/libxcwm/xcwm_internal.h
index 366090d..3e30f45 100644
--- a/src/libxcwm/xcwm_internal.h
+++ b/src/libxcwm/xcwm_internal.h
@@ -53,6 +53,7 @@ struct xcwm_wm_atoms_t {
xcb_atom_t wm_delete_window_atom;
xcb_atom_t wm_transient_for_atom;
xcb_atom_t wm_state_atom;
+ xcb_atom_t net_wm_window_type_splashscreen;
xcb_ewmh_connection_t ewmh_conn;
};