unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Tino Calancha <tino.calancha@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: eggert@cs.ucla.edu, monnier@iro.umontreal.ca,
	42655@debbugs.gnu.org, uyennhi.qm@gmail.com,
	bhavin7392@gmail.com
Subject: bug#42655: 27.1; iconify-frame on a Lucid build may stuck the frame
Date: Mon, 10 Aug 2020 19:52:39 +0200	[thread overview]
Message-ID: <87o8ni9ymw.fsf@gmail.com> (raw)
In-Reply-To: <83a6z36glb.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 09 Aug 2020 17:26:08 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

CC Daniel whom might have some ideas.

A bit of context.
Some WMs (e.g. Mutter in Gnome Shell or Muffin) follow a new trend: they
don't unmap windows when they are iconified.
https://gitlab.gnome.org/GNOME/mutter/-/issues/185

Since they are never unmapped, the windows are not mapped back when they
are deconified.  This might cause an unresponsive frame in Lucid Emacs
builds, because we redisplay when we get the MapNotify signal
(that we don't receive in those WMs).

Apparentely, GTK3 Emacs builds are not affected by this issue.

> I see in xterm.c that we already have some special treatment of the
> Gnome Shell, see below.  Could you please put a breakpoint there, and
> tell why we don't set the frame's visible flag and don't reset its
> iconified flag when the PropertyNotify event is received?  Your event
> log seems to indicate we get quite a few of PropertyNotify events when
> the frame is de-iconified.
That break point is only reached while creating the frame or clicking
the menu bars.  Once the frame is created, I am not able to reach that
part by minimize/unminimize.

I have printed out `event->type` right before the switch(event->type)
I enter the break point at PropertyNotify when `event->type` equals 28.
The xev utility is printing out PropertyNotify for a bunch of different
values of `event->type`, not just for 28.


Naively, I can workaround this issue by checking for an iconified frame at
FocusIn:  this fixes this issue in both `emacs -Q` and my
custom Emacs session.

I am not sure if this is a convenient way.  We might also want to make
it more specific for checking some condition.


--8<-----------------------------cut here---------------start------------->8---
commit d9b06705a045336e1ef307cdfd523a1d5cbb9e7a
Author: Tino Calancha <ccalancha@suse.com>
Date:   Mon Aug 10 19:32:17 2020 +0200

    Fix bug 42655
    
    Some WMs (e.g. mutter in Gnome Shell) don't unmap iconized windows,
    thus we won't get a MapNotify when deconifying them.
    Check if we are deconifying a window elsewhere.
    
    - src/xterm.c (handle_one_xevent):
    Check for window deconify when receiving a FocusIn signal.

diff --git a/src/xterm.c b/src/xterm.c
index 6340700cb8..de1da2d4d4 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -8760,6 +8760,19 @@ handle_one_xevent (struct x_display_info *dpyinfo,
       goto OTHER;
 
     case FocusIn:
+      /* Some WMs (e.g. Mutter in Gnome Shell), don't unmap minimized/iconified windows;
+         thus, for those WMs we won't get a MapNotify when unminimizing/deconifying.
+         Check here if we are deconizing a window (Bug42655). */
+      f = any;
+      if (f && FRAME_ICONIFIED_P (f))
+	{
+          SET_FRAME_VISIBLE (f, 1);
+          SET_FRAME_ICONIFIED (f, false);
+          f->output_data.x->has_been_visible = true;
+          inev.ie.kind = DEICONIFY_EVENT;
+          XSETFRAME (inev.ie.frame_or_window, f);
+        }
+
       x_detect_focus_change (dpyinfo, any, event, &inev.ie);
       goto OTHER;
 
--8<-----------------------------cut here---------------end--------------->8---
In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.21, cairo version 1.16.0)
 of 2020-08-09 built on localhost.example.com
Repository revision: dcce2b57bb91d490787dffd437b61196f1029b41
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12008000
System Description: openSUSE Tumbleweed





  reply	other threads:[~2020-08-10 17:52 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-01 18:46 bug#42655: 27.1; iconify-frame on a Lucid build may stuck the frame Tino Calancha
2020-08-01 18:53 ` Eli Zaretskii
2020-08-02 13:07 ` Tino Calancha
2020-08-02 14:34   ` Eli Zaretskii
2020-08-03 19:46     ` Tino Calancha
2020-08-03 21:29       ` Stefan Monnier
2020-08-04  2:21       ` Eli Zaretskii
2020-08-04  3:59         ` Eli Zaretskii
2020-08-04 14:20           ` Eli Zaretskii
2020-08-04 15:14             ` Bhavin Gandhi
2020-08-04 16:40               ` Eli Zaretskii
2020-08-04 18:53                 ` Bhavin Gandhi
2020-08-04 19:07                   ` Eli Zaretskii
2020-08-05 17:23                     ` Bhavin Gandhi
2020-08-05 18:43                       ` Eli Zaretskii
2020-08-05 18:57                         ` Tino Calancha
2020-08-06  2:29                           ` Eli Zaretskii
2020-08-06  5:41                             ` Bhavin Gandhi
2020-08-06  7:43                               ` Eli Zaretskii
2020-08-06  8:13                                 ` Tino Calancha
2020-08-06 13:47                                   ` Eli Zaretskii
2020-08-06 13:57                                     ` Eli Zaretskii
2020-08-06 14:18                                       ` Tino Calancha
2020-08-06 14:37                                     ` Tino Calancha
2020-08-07  5:53                                       ` Eli Zaretskii
2020-08-07 11:47                                         ` Tino Calancha
2020-08-07 12:05                                           ` Eli Zaretskii
2020-08-07 12:20                                             ` Bhavin Gandhi
2020-08-07 14:01                                             ` Tino Calancha
2020-08-07 15:06                                               ` Eli Zaretskii
2020-08-08 11:52                                                 ` Tino Calancha
2020-08-09 14:26                                                   ` Eli Zaretskii
2020-08-10 17:52                                                     ` Tino Calancha [this message]
2020-08-12 16:50                                                       ` Eli Zaretskii
2020-08-15 14:23                                                         ` Tino Calancha
2020-08-05 18:24               ` Tino Calancha
2020-08-05 18:31                 ` Bhavin Gandhi
2020-08-05 18:34                   ` Tino Calancha

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87o8ni9ymw.fsf@gmail.com \
    --to=tino.calancha@gmail.com \
    --cc=42655@debbugs.gnu.org \
    --cc=bhavin7392@gmail.com \
    --cc=eggert@cs.ucla.edu \
    --cc=eliz@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=uyennhi.qm@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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).