From 33f017daa9f6c48e0d9c5bcb6135b47a0b32bf76 Mon Sep 17 00:00:00 2001 From: Florian Merkel Date: Mon, 7 Dec 2015 12:34:24 +0100 Subject: [PATCH] Support matching _NET_WM_WINDOW_TYPE_NOTIFICATION This commit fixes #1969 by adding support for matching a window's type against _NET_WM_WINDOW_TYPE_NOTIFICATION. The userguide and tests were updated to reflect this change. --- docs/userguide | 2 +- include/atoms.xmacro | 1 + src/match.c | 2 ++ src/xcb.c | 3 ++- testcases/t/165-for_window.t | 3 ++- testcases/t/232-cmd-move-criteria.t | 3 ++- 6 files changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/userguide b/docs/userguide index e596aeae..69f7da92 100644 --- a/docs/userguide +++ b/docs/userguide @@ -1657,7 +1657,7 @@ window_role:: window_type:: Compare the window type (_NET_WM_WINDOW_TYPE). Possible values are +normal+, +dialog+, +utility+, +toolbar+, +splash+, +menu+, +dropdown_menu+, - +popup_menu+ and +tooltip+. + +popup_menu+, +tooltip+ and +notification+. id:: Compares the X11 window ID, which you can get via +xwininfo+ for example. title:: diff --git a/include/atoms.xmacro b/include/atoms.xmacro index 8798528a..139b6efb 100644 --- a/include/atoms.xmacro +++ b/include/atoms.xmacro @@ -20,6 +20,7 @@ xmacro(_NET_WM_WINDOW_TYPE_MENU) xmacro(_NET_WM_WINDOW_TYPE_DROPDOWN_MENU) xmacro(_NET_WM_WINDOW_TYPE_POPUP_MENU) xmacro(_NET_WM_WINDOW_TYPE_TOOLTIP) +xmacro(_NET_WM_WINDOW_TYPE_NOTIFICATION) xmacro(_NET_WM_DESKTOP) xmacro(_NET_WM_STRUT_PARTIAL) xmacro(_NET_CLIENT_LIST) diff --git a/src/match.c b/src/match.c index caeb909f..bbb239ac 100644 --- a/src/match.c +++ b/src/match.c @@ -330,6 +330,8 @@ void match_parse_property(Match *match, const char *ctype, const char *cvalue) { match->window_type = A__NET_WM_WINDOW_TYPE_POPUP_MENU; } else if (strcasecmp(cvalue, "tooltip") == 0) { match->window_type = A__NET_WM_WINDOW_TYPE_TOOLTIP; + } else if (strcasecmp(cvalue, "notification") == 0) { + match->window_type = A__NET_WM_WINDOW_TYPE_NOTIFICATION; } else { ELOG("unknown window_type value \"%s\"\n", cvalue); match->error = sstrdup("unknown window_type value"); diff --git a/src/xcb.c b/src/xcb.c index 07f9281a..9d181cfa 100644 --- a/src/xcb.c +++ b/src/xcb.c @@ -175,7 +175,8 @@ xcb_atom_t xcb_get_preferred_window_type(xcb_get_property_reply_t *reply) { atoms[i] == A__NET_WM_WINDOW_TYPE_MENU || atoms[i] == A__NET_WM_WINDOW_TYPE_DROPDOWN_MENU || atoms[i] == A__NET_WM_WINDOW_TYPE_POPUP_MENU || - atoms[i] == A__NET_WM_WINDOW_TYPE_TOOLTIP) { + atoms[i] == A__NET_WM_WINDOW_TYPE_TOOLTIP || + atoms[i] == A__NET_WM_WINDOW_TYPE_NOTIFICATION) { return atoms[i]; } } diff --git a/testcases/t/165-for_window.t b/testcases/t/165-for_window.t index 476bcc9f..025fe21c 100644 --- a/testcases/t/165-for_window.t +++ b/testcases/t/165-for_window.t @@ -380,7 +380,8 @@ my %window_types = ( 'menu' => '_NET_WM_WINDOW_TYPE_MENU', 'dropdown_menu' => '_NET_WM_WINDOW_TYPE_DROPDOWN_MENU', 'popup_menu' => '_NET_WM_WINDOW_TYPE_POPUP_MENU', - 'tooltip' => '_NET_WM_WINDOW_TYPE_TOOLTIP' + 'tooltip' => '_NET_WM_WINDOW_TYPE_TOOLTIP', + 'notification' => '_NET_WM_WINDOW_TYPE_NOTIFICATION' ); while (my ($window_type, $atom) = each %window_types) { diff --git a/testcases/t/232-cmd-move-criteria.t b/testcases/t/232-cmd-move-criteria.t index c023bca4..787f72b3 100644 --- a/testcases/t/232-cmd-move-criteria.t +++ b/testcases/t/232-cmd-move-criteria.t @@ -54,7 +54,8 @@ my %window_types = ( 'menu' => '_NET_WM_WINDOW_TYPE_MENU', 'dropdown_menu' => '_NET_WM_WINDOW_TYPE_DROPDOWN_MENU', 'popup_menu' => '_NET_WM_WINDOW_TYPE_POPUP_MENU', - 'tooltip' => '_NET_WM_WINDOW_TYPE_TOOLTIP' + 'tooltip' => '_NET_WM_WINDOW_TYPE_TOOLTIP', + 'notification' => '_NET_WM_WINDOW_TYPE_NOTIFICATION' ); while (my ($window_type, $atom) = each %window_types) { -- 2.39.2