all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: m.nomiya@gmail.com, 49959@debbugs.gnu.org
Subject: bug#49959: 28.0.50; Emacs got quasi freeze
Date: Tue, 24 Aug 2021 11:41:52 +0200	[thread overview]
Message-ID: <35b2918d-5755-01e0-ecc9-ec543ee83299@gmx.at> (raw)
In-Reply-To: <87mtp78pzk.wl-nomiya@galaxy.dti.ne.jp>

[-- Attachment #1: Type: text/plain, Size: 302 bytes --]

 > That is, when
 >
 > Tue Aug 24 12:37:39 JST 2021
 > _NET_WM_STATE(ATOM) = _NET_WM_STATE_HIDDEN
 >
 > appears, it doesn't start rendering (= enlightenment doesn't remove
 > this property).

So it _is_ a PropertyNotify event we should react to.  I'll attach yet
another patch to that purpose.

martin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: enlightenment.diff --]
[-- Type: text/x-patch; name="enlightenment.diff", Size: 5174 bytes --]

diff --git a/src/termhooks.h b/src/termhooks.h
index 1d3cdc8fe8..479b8a1c29 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -168,7 +168,8 @@ #define EMACS_TERMHOOKS_H
 				   Lisp-level event value.
 				   (Only the toolkit version uses these.)  */
   ICONIFY_EVENT,		/* An X client iconified this window.  */
-  DEICONIFY_EVENT,		/* An X client deiconified this window.  */
+  DEICONIFY_EVENT,		/* An X client deiconified this window
+				   or made it visible.  */
   MENU_BAR_ACTIVATE_EVENT,      /* A button press in the menu bar
 				   (toolkit version only).  */
   DRAG_N_DROP_EVENT,		/* A drag-n-drop event is generated when
diff --git a/src/xterm.c b/src/xterm.c
index 6c6a62adb2..82d2ae3a52 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -8166,22 +8166,19 @@ handle_one_xevent (struct x_display_info *dpyinfo,
       f = x_top_window_to_frame (dpyinfo, event->xproperty.window);
       if (f && event->xproperty.atom == dpyinfo->Xatom_net_wm_state)
 	{
+	  bool was_iconified = FRAME_ICONIFIED_P (f);
           bool not_hidden = x_handle_net_wm_state (f, &event->xproperty);

-	  if (not_hidden && FRAME_ICONIFIED_P (f))
+	  if (not_hidden)
 	    {
 	      if (CONSP (frame_size_history))
 		frame_size_history_plain
-		  (f, build_string ("PropertyNotify, not hidden & iconified"));
+		  (f, build_string ("PropertyNotify, not hidden"));

-	      /* 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, treat it as deiconified.  */
+	      SET_FRAME_GARBAGED (f);
 	      SET_FRAME_VISIBLE (f, 1);
-	      SET_FRAME_ICONIFIED (f, false);
-
 	      f->output_data.x->has_been_visible = true;
-	      inev.ie.kind = DEICONIFY_EVENT;
+
 #if defined USE_GTK && defined HAVE_GTK3
 	      /* If GTK3 wants to impose some old size here (Bug#24526),
 		 tell it that the current size is what we want.  */
@@ -8192,18 +8189,27 @@ handle_one_xevent (struct x_display_info *dpyinfo,
 		  f->was_invisible = false;
 		}
 #endif
-	      XSETFRAME (inev.ie.frame_or_window, f);
+	      if (was_iconified)
+		{
+		  SET_FRAME_ICONIFIED (f, false);
+		  inev.ie.kind = DEICONIFY_EVENT;
+		  XSETFRAME (inev.ie.frame_or_window, f);
+		}
 	    }
-	  else if (!not_hidden && !FRAME_ICONIFIED_P (f))
+	  else
 	    {
 	      if (CONSP (frame_size_history))
 		frame_size_history_plain
-		  (f, build_string ("PropertyNotify, hidden & not iconified"));
+		  (f, build_string ("PropertyNotify, hidden"));

 	      SET_FRAME_VISIBLE (f, 0);
-	      SET_FRAME_ICONIFIED (f, true);
-	      inev.ie.kind = ICONIFY_EVENT;
-	      XSETFRAME (inev.ie.frame_or_window, f);
+
+	      if (!was_iconified)
+		{
+		  SET_FRAME_ICONIFIED (f, true);
+		  inev.ie.kind = ICONIFY_EVENT;
+		  XSETFRAME (inev.ie.frame_or_window, f);
+		}
 	    }
 	}

@@ -8402,7 +8408,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
       f = x_top_window_to_frame (dpyinfo, event->xmap.window);
       if (f)
         {
-	  bool iconified = FRAME_ICONIFIED_P (f);
+	  bool was_iconified = FRAME_ICONIFIED_P (f);
 	  int value;
 	  bool sticky;
           bool not_hidden = x_get_current_wm_state (f, event->xmap.window, &value, &sticky);
@@ -8410,7 +8416,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
 	  if (CONSP (frame_size_history))
 	    frame_size_history_extra
 	      (f,
-	       iconified
+	       was_iconified
 	       ? (not_hidden
 		  ? build_string ("MapNotify, not hidden & iconified")
 		  : build_string ("MapNotify, hidden & iconified"))
@@ -8434,7 +8440,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
 #endif /* Not USE_GTK */
 	    }

-	  if (!iconified)
+	  if (!was_iconified)
 	    {
 	      /* The `z-group' is reset every time a frame becomes
 		 invisible.  Handle this here.  */
@@ -8459,13 +8465,13 @@ handle_one_xevent (struct x_display_info *dpyinfo,
 		}
 #endif
 	      f->output_data.x->has_been_visible = true;
-	    }

-          if (not_hidden && iconified)
-            {
-              inev.ie.kind = DEICONIFY_EVENT;
-              XSETFRAME (inev.ie.frame_or_window, f);
-            }
+	      if (was_iconified)
+		{
+		  inev.ie.kind = DEICONIFY_EVENT;
+		  XSETFRAME (inev.ie.frame_or_window, f);
+		}
+	    }
         }
       goto OTHER;

@@ -9354,7 +9360,21 @@ handle_one_xevent (struct x_display_info *dpyinfo,
       f = x_top_window_to_frame (dpyinfo, event->xvisibility.window);
       if (f && (event->xvisibility.state == VisibilityUnobscured
 		|| event->xvisibility.state == VisibilityPartiallyObscured))
-	SET_FRAME_VISIBLE (f, 1);
+	{
+#if defined USE_GTK && defined HAVE_GTK3
+	  /* If GTK3 wants to impose some old size here (Bug#24526),
+	     tell it that the current size is what we want.  */
+	  if (f->was_invisible)
+	    {
+	      xg_frame_set_char_size
+		(f, FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f));
+	      f->was_invisible = false;
+	    }
+#endif
+	  f->output_data.x->has_been_visible = true;
+	  SET_FRAME_GARBAGED (f);
+	  SET_FRAME_VISIBLE (f, 1);
+	}

       goto OTHER;


  reply	other threads:[~2021-08-24  9:41 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-09  9:12 bug#49959: 28.0.50; Emacs got quasi freeze 野宮 賢 / NOMIYA Masaru
2021-08-18  8:03 ` martin rudalics
2021-08-21  5:09   ` Masaru Nomiya
     [not found]     ` <20210821072303.ead4637113305e2e518936b8@rasterman.com>
2021-08-21  6:54       ` Masaru Nomiya
2021-08-22  8:23         ` martin rudalics
2021-08-22  9:49           ` martin rudalics
2021-08-22 16:54             ` martin rudalics
2021-08-22 23:11               ` Masaru Nomiya
2021-08-23  8:35                 ` martin rudalics
2021-08-24  1:19                   ` Masaru Nomiya
2021-08-24  3:45                     ` Masaru Nomiya
2021-08-24  9:41                       ` martin rudalics [this message]
2021-08-24 12:35                         ` Masaru Nomiya
2021-08-24 14:14                           ` martin rudalics
2021-08-25 11:01                             ` Masaru Nomiya
2021-08-25 14:16                               ` martin rudalics
2021-08-26  0:24                                 ` Masaru Nomiya
2021-08-26  7:52                                   ` martin rudalics
2021-08-29  2:05                                     ` Masaru Nomiya
2021-08-29  7:21                                       ` martin rudalics
     [not found]                                         ` <875yvo8ywt.wl-nomiya@galaxy.dti.ne.jp>
     [not found]                                           ` <89382a57-874e-81ed-d71f-8301db63ba48@gmx.at>
     [not found]                                             ` <87h7f5oq0p.wl-m.nomiya@gmail.com>
2021-08-31 16:51                                               ` bug#49959: Diff file (Was: Re: bug#49959: 28.0.50; Emacs got quasi freeze) martin rudalics
2021-09-01  0:21                                                 ` Masaru Nomiya
2021-09-01  9:17                                                   ` martin rudalics
2021-09-01 10:05                                                     ` Masaru Nomiya
2022-08-22 11:59                                                       ` bug#49959: 28.0.50; Emacs got quasi freeze Lars Ingebrigtsen
2022-09-19 19:19                                                         ` Lars Ingebrigtsen
2022-09-19 21:45                                                           ` 野宮 賢 / NOMIYA Masaru

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=35b2918d-5755-01e0-ecc9-ec543ee83299@gmx.at \
    --to=rudalics@gmx.at \
    --cc=49959@debbugs.gnu.org \
    --cc=m.nomiya@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.