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

From: Lars Ingebrigtsen <[email-masked]>
Date: Sun, 15 Aug 2021 16:18:30 +0200

Eli Zaretskii <[email-masked]> writes:

> To see what can be done, I think we'd need to know whether indeed
> Emacs receives an event, and what kind of event is that.

It seems like Emacs is woken up from read_event_from_main_queue...  so
by instrumenting that a bit, and then changing virtual desktops...

Aha!

16:12:06 starting (move-frame (#<frame ba.el - GNU Emacs at elva 0x55dd37bbcea0>))  backtrace-to-string()
  internal-timer-start-idle((move-frame (#<frame GNU Emacs at elva 0x55dd37bbcea0>)))
  read-event(nil nil 0.001)

So we're getting a move-frame event so this is being triggered, I guess?

      if (!end_time)
	timer_stop_idle ();

I guess the question then is...  can we distinguish between real
move-frame events and these virtual desktop things?  I'm guessing not:

    case MOVE_FRAME_EVENT:
      /* Make an event (move-frame (FRAME)).  */
      return list2 (Qmove_frame, list1 (event->frame_or_window));

So the window manager is sending us a MOVE_FRAME_EVENT here.

Then the question becomes: Should one of these events stop Emacs idleness?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no