Browse Source

Fix fallback for the window type

EWMH specifies that

   If _NET_WM_WINDOW_TYPE is not set, then managed windows with WM_TRANSIENT_FOR
   set MUST be taken as [_NET_WM_WINDOW_TYPE_DIALOG].

We implement this by forcing a window's type to be "dialog" when it has a
WM_TRANSIENT_FOR property. For windows that have a _NET_WM_WINDOW_TYPE property,
this type change is then later undone. However, when a window changes its
WM_TRANSIENT_FOR property during runtime, then we would set its type to "dialog"
unconditionally.

This commit fixes this by explicitly tracking if we found a _NET_WM_WINDOW_TYPE
property on the window and only applying the fallback if we did not find such a
property.

Fixes-one-of-the-sub-issues-from: https://github.com/awesomeWM/awesome/issues/889
Signed-off-by: Uli Schlachter <psychon@znc.in>
Uli Schlachter 3 years ago
parent
commit
cbdf403637
3 changed files with 7 additions and 2 deletions
  1. 3
    1
      ewmh.c
  2. 2
    0
      objects/client.h
  3. 2
    1
      property.c

+ 3
- 1
ewmh.c View File

@@ -574,6 +574,7 @@ ewmh_client_check_hints(client_t *c)
574 574
     reply = xcb_get_property_reply(globalconf.connection, c2, NULL);
575 575
     if(reply && (data = xcb_get_property_value(reply)))
576 576
     {
577
+        c->has_NET_WM_WINDOW_TYPE = true;
577 578
         state = (xcb_atom_t *) data;
578 579
         for(int i = 0; i < xcb_get_property_value_length(reply) / ssizeof(xcb_atom_t); i++)
579 580
             if(state[i] == _NET_WM_WINDOW_TYPE_DESKTOP)
@@ -590,7 +591,8 @@ ewmh_client_check_hints(client_t *c)
590 591
                 c->type = MAX(c->type, WINDOW_TYPE_TOOLBAR);
591 592
             else if(state[i] == _NET_WM_WINDOW_TYPE_UTILITY)
592 593
                 c->type = MAX(c->type, WINDOW_TYPE_UTILITY);
593
-    }
594
+    } else
595
+        c->has_NET_WM_WINDOW_TYPE = false;
594 596
 
595 597
     p_delete(&reply);
596 598
 }

+ 2
- 0
objects/client.h View File

@@ -97,6 +97,8 @@ struct client_t
97 97
      * from Lua. */
98 98
     bool focusable;
99 99
     bool focusable_set;
100
+    /** True if the client window has a _NET_WM_WINDOW_TYPE proeprty */
101
+    bool has_NET_WM_WINDOW_TYPE;
100 102
     /** Window of the group leader */
101 103
     xcb_window_t group_window;
102 104
     /** Window holding command needed to start it (session management related) */

+ 2
- 1
property.c View File

@@ -114,7 +114,8 @@ property_update_wm_transient_for(client_t *c, xcb_get_property_cookie_t cookie)
114 114
     c->transient_for_window = trans;
115 115
 
116 116
     luaA_object_push(L, c);
117
-    client_set_type(L, -1, WINDOW_TYPE_DIALOG);
117
+    if (!c->has_NET_WM_WINDOW_TYPE)
118
+        client_set_type(L, -1, trans == XCB_NONE ? WINDOW_TYPE_NORMAL : WINDOW_TYPE_DIALOG);
118 119
     client_set_above(L, -1, false);
119 120
     lua_pop(L, 1);
120 121
 

Loading…
Cancel
Save