* xterm.c (handle_one_xevent): Only set async_visible and friends
authorJan Djärv <jan.h.d@swipnet.se>
Tue, 29 Nov 2011 18:08:53 +0000 (19:08 +0100)
committerJan Djärv <jan.h.d@swipnet.se>
Tue, 29 Nov 2011 18:08:53 +0000 (19:08 +0100)
if net_wm_state_hidden_seen is non-zero
(get_current_wm_state):  Set net_wm_state_hidden_seen to 1 if
_NET_WM_STATE_HIDDEN is in NET_WM_STATE.

* xterm.h (struct x_output): net_wm_state_hidden_seen is new.

Fixes: debbugs:10002

src/ChangeLog
src/xterm.c
src/xterm.h

index 915e065..3b1fd5e 100644 (file)
@@ -1,3 +1,12 @@
+2011-11-29  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xterm.h (struct x_output): net_wm_state_hidden_seen is new.
+
+       * xterm.c (handle_one_xevent): Only set async_visible and friends
+       if net_wm_state_hidden_seen is non-zero (Bug#10002)
+       (get_current_wm_state):  Set net_wm_state_hidden_seen to 1 if
+       _NET_WM_STATE_HIDDEN is in NET_WM_STATE.
+
 2011-11-28  Paul Eggert  <eggert@cs.ucla.edu>
 
        Remove GCPRO-related macros that exist only to avoid shadowing locals.
index 063794b..e41af2b 100644 (file)
@@ -6114,7 +6114,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
       last_user_time = event.xproperty.time;
       f = x_top_window_to_frame (dpyinfo, event.xproperty.window);
       if (f && event.xproperty.atom == dpyinfo->Xatom_net_wm_state)
-        if (x_handle_net_wm_state (f, &event.xproperty) && f->iconified)
+        if (x_handle_net_wm_state (f, &event.xproperty) && f->iconified
+            && f->output_data.x->net_wm_state_hidden_seen)
           {
             /* Gnome shell does not iconify us when C-z is pressed.  It hides
                the frame.  So if our state says we aren't hidden anymore,
@@ -6124,6 +6125,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
             f->async_visible = 1;
             f->async_iconified = 0;
             f->output_data.x->has_been_visible = 1;
+            f->output_data.x->net_wm_state_hidden_seen = 0;
             inev.ie.kind = DEICONIFY_EVENT;
             XSETFRAME (inev.ie.frame_or_window, f);
           }
@@ -8480,7 +8482,10 @@ get_current_wm_state (struct frame *f,
     {
       Atom a = ((Atom*)tmp_data)[i];
       if (a == dpyinfo->Xatom_net_wm_state_hidden)
-        is_hidden = 1;
+        {
+          is_hidden = 1;
+          f->output_data.x->net_wm_state_hidden_seen = 1;
+        }
       else if (a == dpyinfo->Xatom_net_wm_state_maximized_horz)
         {
           if (*size_state == FULLSCREEN_HEIGHT)
index 1d2ce9a..4385b1a 100644 (file)
@@ -632,6 +632,9 @@ struct x_output
      x_check_expected_move.  */
   int left_before_move;
   int top_before_move;
+
+  /* Non-zero if _NET_WM_STATE_HIDDEN is set for this frame.  */
+  int net_wm_state_hidden_seen;
 };
 
 #define No_Cursor (None)