[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#928396: xfwm4: 'wmctrl -r ":ACTIVE:" -b add,hidden' does not minimize the active window



Package: xfwm4
Version: 4.12.5-1.1
Severity: normal

Dear Maintainer,

After creating some panel launcher buttons to maximize (toggle), minimize and
close the active window (reason: handle maximized windows when the titlebar is
not shown), maximizing and closing windows succeed using the launcher buttons,
while hiding windows does not. This was tested on xfwm4_4.12.15-1 and
xfwm4_4.13.1-3.

Commands used by the launchers:

 - close window:
      wmctrl -c ":ACTIVE:"

 - toggle maximize window:
      wmctrl -r ":ACTIVE:" -b toggle,maximized_vert,maximized_horz

 - hide window:
      wmctrl -r ":ACTIVE:" -b add,hidden

Patching the "clientUpdateNetState" function in "netwm.c" to handle
"NET_WM_STATE_HIDDEN" state changes resolves the issue (tested on
xfwm_4.12.5-1; the reported version 4.12.5-1.1 is the patched version).

A proposed patch is included.



-- System Information:
Debian Release: buster/sid
  APT prefers testing
  APT policy: (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 4.19.0-4-amd64 (SMP w/2 CPU cores)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF8, LC_CTYPE=nl_BE.utf8 (charmap=UTF-8), LANGUAGE=en_US.UTF8 (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages xfwm4 depends on:
ii  libc6                     2.28-8
ii  libcairo2                 1.16.0-4
ii  libdbus-glib-1-2          0.110-4
ii  libgdk-pixbuf2.0-0        2.38.1+dfsg-1
ii  libglib2.0-0              2.58.3-1
ii  libgtk2.0-0               2.24.32-3
ii  libpango-1.0-0            1.42.4-6
ii  libstartup-notification0  0.12-6
ii  libwnck22                 2.30.7-6
ii  libx11-6                  2:1.6.7-1
ii  libxcomposite1            1:0.4.4-2
ii  libxdamage1               1:1.1.4-3+b3
ii  libxext6                  2:1.3.3-1+b2
ii  libxfce4ui-1-0            4.12.1-3
ii  libxfce4util7             4.12.1-3
ii  libxfconf-0-2             4.12.1-1
ii  libxfixes3                1:5.0.3-1
ii  libxinerama1              2:1.1.4-2
ii  libxrandr2                2:1.5.1-1
ii  libxrender1               1:0.9.10-1

Versions of packages xfwm4 recommends:
ii  librsvg2-common  2.44.10-1

Versions of packages xfwm4 suggests:
ii  xfce4         4.12.5
pn  xfwm4-themes  <none>

-- no debconf information
Description: Allow hiding windows using the wmctrl utility
 Handle changes of the NET_WM_STATE_HIDDEN atom in the
 clientUpdateNetState function
Author: pnd23@telenet.be
Origin: other
Forwarded: no
Last-Update: 2019-05-03
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
Index: xfwm4-4.12.5/src/netwm.c
===================================================================
--- xfwm4-4.12.5.orig/src/netwm.c	2018-07-27 22:34:41.000000000 +0200
+++ xfwm4-4.12.5/src/netwm.c	2019-05-02 17:28:57.775679000 +0200
@@ -337,6 +337,36 @@
     second = ev->data.l[2];
     mode = 0;
 
+    if ((first  == display_info->atoms[NET_WM_STATE_HIDDEN]) ||
+        (second == display_info->atoms[NET_WM_STATE_HIDDEN]))
+    {
+        if ((action == NET_WM_STATE_ADD) && !FLAG_TEST (c->flags, CLIENT_FLAG_ICONIFIED))
+        {
+            if (CLIENT_CAN_HIDE_WINDOW (c))
+            {
+                clientWithdraw (c, c->win_workspace, TRUE);
+            }
+        }
+        else if ((action == NET_WM_STATE_REMOVE) && FLAG_TEST (c->flags, CLIENT_FLAG_ICONIFIED))
+        {
+            clientShow (c, TRUE);
+        }
+        else if (action == NET_WM_STATE_TOGGLE)
+        {
+            if (FLAG_TEST (c->flags, CLIENT_FLAG_ICONIFIED))
+            {
+                clientShow (c, TRUE);
+            }
+            else
+            {
+                if (CLIENT_CAN_HIDE_WINDOW (c))
+                {
+                    clientWithdraw (c, c->win_workspace, TRUE);
+                }
+            }
+        }
+    }
+
     if ((first  == display_info->atoms[NET_WM_STATE_SHADED]) ||
         (second == display_info->atoms[NET_WM_STATE_SHADED]))
     {

Reply to: