From: Po Lu Date: Tue, 11 Oct 2022 11:55:14 +0000 (+0800) Subject: Also avoid setting _NET_WM_USER_TIME on crossing X-Git-Tag: emacs-29.0.90~1616^2~657 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=61b6da5acef2d550022c664e628346539ba1852f;p=emacs.git Also avoid setting _NET_WM_USER_TIME on crossing * src/xterm.c (handle_one_xevent): Stop setting user time prop on crossing events. --- diff --git a/src/xterm.c b/src/xterm.c index 21207a31461..9c34fce7c5b 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -7592,17 +7592,19 @@ static void x_check_font (struct frame *, struct font *); ridiculously large value, and this way a more reasonable timestamp can be obtained upon the next event. + Alternatively, the server time could've overflowed. + SET_PROPERTY specifies whether or not to change the user time property for the active frame. The important thing is to not set the last user time upon leave events; on Metacity and GNOME Shell, mapping a new frame on top of the old frame potentially causes - LeaveNotify or XI_Leave to be sent to the old frame if it contains - the pointer, as the new frame will initially stack above the old - frame. If _NET_WM_USER_TIME is changed at that point, then GNOME - may get notified about the user time change on the old frame before - it tries to focus the new frame, which will make it consider the - new frame (whose user time property will not have been updated at - that point, due to not being focused) as having been mapped + crossing events to be sent to the old frame if it contains the + pointer, as the new frame will initially stack above the old frame. + If _NET_WM_USER_TIME is changed at that point, then GNOME may get + notified about the user time change on the old frame before it + tries to focus the new frame, which will make it consider the new + frame (whose user time property will not have been updated at that + point, due to not being focused) as having been mapped out-of-order, and lower the new frame, which is typically not what users want. */ @@ -19567,7 +19569,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, case EnterNotify: x_display_set_last_user_time (dpyinfo, event->xcrossing.time, - event->xcrossing.send_event, true); + event->xcrossing.send_event, false); #ifdef HAVE_XINPUT2 /* For whatever reason, the X server continues to deliver @@ -21114,7 +21116,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, ev.send_event = enter->send_event; x_display_set_last_user_time (dpyinfo, enter->time, - enter->send_event, true); + enter->send_event, false); #ifdef USE_MOTIF use_copy = true;