emacs-diffs
[Top][All Lists]
Advanced

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

master af46d8a7ec: Fix reporting of iconic state on old window managers


From: Po Lu
Subject: master af46d8a7ec: Fix reporting of iconic state on old window managers
Date: Thu, 27 Oct 2022 07:16:00 -0400 (EDT)

branch: master
commit af46d8a7ecb5c8c0016cc8dc88fa59ef244a0ced
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Fix reporting of iconic state on old window managers
    
    * src/xterm.c (x_handle_wm_state): Handle IconicState if the
    window manager does not support _NET_WM_STATE_HIDDEN.
---
 src/xterm.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index 9f6112745e..c8ac30c72c 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -17868,6 +17868,7 @@ x_coords_from_dnd_message (struct x_display_info 
*dpyinfo,
 static void
 x_handle_wm_state (struct frame *f, struct input_event *ie)
 {
+  struct x_display_info *dpyinfo;
   Atom type;
   int format;
   unsigned long nitems, bytes_after;
@@ -17875,10 +17876,11 @@ x_handle_wm_state (struct frame *f, struct 
input_event *ie)
   unsigned long *state;
 
   data = NULL;
+  dpyinfo = FRAME_DISPLAY_INFO (f);
 
   if (XGetWindowProperty (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
-                         FRAME_DISPLAY_INFO (f)->Xatom_wm_state, 0, 2,
-                         False, AnyPropertyType, &type, &format, &nitems,
+                         dpyinfo->Xatom_wm_state, 0, 2, False,
+                         AnyPropertyType, &type, &format, &nitems,
                          &bytes_after, &data) != Success)
     return;
 
@@ -17903,6 +17905,20 @@ x_handle_wm_state (struct frame *f, struct input_event 
*ie)
       ie->kind = DEICONIFY_EVENT;
       XSETFRAME (ie->frame_or_window, f);
     }
+  else if (state[0] == IconicState
+          /* _NET_WM_STATE_HIDDEN should be used if the window
+             manager supports that.  */
+          && !x_wm_supports (f, dpyinfo->Xatom_net_wm_state_hidden))
+    {
+      /* The frame is actually iconified right now.  Mark it as
+        such.  */
+
+      SET_FRAME_VISIBLE (f, 0);
+      SET_FRAME_ICONIFIED (f, true);
+
+      ie->kind = ICONIFY_EVENT;
+      XSETFRAME (ie->frame_or_window, f);
+    }
 
   /* state[0] can also be WithdrawnState, meaning that the window has
      been withdrawn and is no longer iconified.  However, Emacs sets



reply via email to

[Prev in Thread] Current Thread [Next in Thread]