Browse Source

Set _NET_WM_DESKTOP for sticky windows specially (#2653)

Today I learnt that _NET_WM_STATE_STICKY means something else than I
previously thought.

ICCCM and EWMH support virtual desktops that are larger than the actual
screen. The idea is that one can scroll through this virtual desktop,
which means that e.g. all windows move to the left, so one can see the
windows that are further to the right.

_NET_WM_STATE_STICKY indicates that a window is sticky. This means that
it does not scroll with the virtual desktop, but instead sticks to its
current position.

In AwesomeWM, we use a different definition. A sticky window is always
visible, even when it is not tagged with any of the currently selected
tags. This behaviour is indicated in EWMH with a special value of
_NET_WM_DESKTOP. This commit updates the code to actually set this
special value.

This fixes attaching tabs in Google Chrome when the "target window" is
sticky (in the AwesomeWM sense).

Fixes: https://github.com/awesomeWM/awesome/issues/2652
Signed-off-by: Uli Schlachter <psychon@znc.in>
Uli Schlachter 8 months ago
parent
commit
b909068430
2 changed files with 11 additions and 1 deletions
  1. 10
    1
      ewmh.c
  2. 1
    0
      objects/client.c

+ 10
- 1
ewmh.c View File

@@ -35,6 +35,8 @@
35 35
 #define _NET_WM_STATE_ADD 1
36 36
 #define _NET_WM_STATE_TOGGLE 2
37 37
 
38
+#define ALL_DESKTOPS 0xffffffff
39
+
38 40
 /** Update client EWMH hints.
39 41
  * \param L The Lua VM state.
40 42
  */
@@ -430,7 +432,7 @@ ewmh_process_desktop(client_t *c, uint32_t desktop)
430 432
 {
431 433
     lua_State *L = globalconf_get_lua_State();
432 434
     int idx = desktop;
433
-    if(desktop == 0xffffffff)
435
+    if(desktop == ALL_DESKTOPS)
434 436
     {
435 437
         luaA_object_push(L, c);
436 438
         lua_pushboolean(L, true);
@@ -517,6 +519,13 @@ ewmh_client_update_desktop(client_t *c)
517 519
 {
518 520
     int i;
519 521
 
522
+    if(c->sticky)
523
+    {
524
+        xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
525
+                            c->window, _NET_WM_DESKTOP, XCB_ATOM_CARDINAL, 32, 1,
526
+                            (uint32_t[]) { ALL_DESKTOPS });
527
+        return;
528
+    }
520 529
     for(i = 0; i < globalconf.tags.len; i++)
521 530
         if(is_client_tagged(c, globalconf.tags.tab[i]))
522 531
         {

+ 1
- 0
objects/client.c View File

@@ -2025,6 +2025,7 @@ client_set_sticky(lua_State *L, int cidx, bool s)
2025 2025
     {
2026 2026
         c->sticky = s;
2027 2027
         banning_need_update();
2028
+        ewmh_client_update_desktop(c);
2028 2029
         if(strut_has_value(&c->strut))
2029 2030
             screen_update_workarea(c->screen);
2030 2031
         luaA_object_emit_signal(L, cidx, "property::sticky", 0);

Loading…
Cancel
Save