summaryrefslogtreecommitdiff
path: root/src/xterm.c
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-11-23 20:36:39 +0800
committerPo Lu <luangruo@yahoo.com>2022-11-23 20:40:35 +0800
commit43060910874f46579fa190d9b5534508e4ea058e (patch)
treea4a3971154c1ce0fd0b5c6aeaa68e20eb0e2299f /src/xterm.c
parent1524fe427d00c1cf255b9d68cc8565de45ea78df (diff)
downloademacs-43060910874f46579fa190d9b5534508e4ea058e.tar.gz
Improve last change to xterm.c
* src/xfns.c (Fx_display_last_user_time): Reject overly large timestamps. * src/xterm.c (x_display_set_last_user_time, handle_one_xevent): New functions.
Diffstat (limited to 'src/xterm.c')
-rw-r--r--src/xterm.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 732fbf462c9..cfd8c385d1d 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -7749,11 +7749,6 @@ x_display_set_last_user_time (struct x_display_info *dpyinfo, Time time,
old_time = dpyinfo->last_user_time;
#endif
- /* Time can be sign extended if retrieved from a client message.
- Make sure it is always 32 bits, or systems with 64-bit longs
- will crash after 24 days of X server uptime. (bug#59480) */
- time &= X_ULONG_MAX;
-
#ifdef ENABLE_CHECKING
eassert (time <= X_ULONG_MAX);
#endif
@@ -18626,7 +18621,12 @@ handle_one_xevent (struct x_display_info *dpyinfo,
/* Set the provided time as the user time, which is
required for SetInputFocus to work correctly after
taking the input focus. */
- x_display_set_last_user_time (dpyinfo, event->xclient.data.l[1],
+
+ /* Time can be sign extended if retrieved from a client message.
+ Make sure it is always 32 bits, or systems with 64-bit longs
+ will crash after 24 days of X server uptime. (bug#59480) */
+ x_display_set_last_user_time (dpyinfo, (event->xclient.data.l[1]
+ & 0xffffffff),
true, true);
goto done;
}