Subject: bug#49997: 27.2; idle-time reset when switching desktop-page

From: martin rudalics <[email-masked]>
Date: Wed, 18 Aug 2021 10:02:33 +0200

>> The code you show is in keyboard.c, where we interpret the events
 >> we've received.  To see whether we can distinguish between these
 >> events and "real" move-frame events, we need to look in xterm.c, where
 >> the events come in from the window-system.  Maybe they are different
 >> in their raw form?
 >
 > Ah, I see.  Right, this is in handle_one_xevent, where we apparently
 > synthesise the MOVE_FRAME_EVENT:
 >
 > 	      if (!FRAME_TOOLTIP_P (f)
 > 		  && (old_left != f->left_pos || old_top != f->top_pos))
 > 		{
 > 		  inev.ie.kind = MOVE_FRAME_EVENT;
 > 		  XSETFRAME (inev.ie.frame_or_window, f);
 > 		}
 > 	    }
 >
 > So it's purely based on whether the window manager told is that the
 > position changed -- which I guess it sort of does?  When I move to a
 > different virtual desktop, it shows me all the iconified frames, and
 > that's probably where this comes from?
 >
 > This is in:
 >
 >      case ConfigureNotify:
 >
 > that case in itself is almost 200 lines long...
 >
 > I've added Martin to the CCs; perhaps he has some insights here.

I can offer the attached trivial patch.  Peter, can you try it?

martin
diff --git a/src/keyboard.c b/src/keyboard.c
index 34c64b9186..e643d3267b 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -2929,6 +2929,7 @@ read_char (int commandflag, Lisp_Object map,

       if (CONSP (c)
           && (EQ (XCAR (c), Qselect_window)
+	      || EQ (XCAR (c), Qmove_frame)
               || EQ (XCAR (c), Qfocus_out)
 #ifdef HAVE_DBUS
 	      || EQ (XCAR (c), Qdbus_event)