Avoid wasting bandwidth to set user time

* src/xterm.c (x_display_set_last_user_time): Don't change the
user time property if nothing actually changed.
This commit is contained in:
Po Lu 2022-07-21 14:55:05 +08:00
parent 6940cebe03
commit 50ff15bb8a

View file

@ -7157,7 +7157,11 @@ x_display_set_last_user_time (struct x_display_info *dpyinfo, Time time,
bool send_event)
{
#ifndef USE_GTK
struct frame *focus_frame = dpyinfo->x_focus_frame;
struct frame *focus_frame;
Time old_time;
focus_frame = dpyinfo->x_focus_frame;
old_time = dpyinfo->last_user_time;
#endif
#ifdef ENABLE_CHECKING
@ -7168,8 +7172,11 @@ x_display_set_last_user_time (struct x_display_info *dpyinfo, Time time,
dpyinfo->last_user_time = time;
#ifndef USE_GTK
if (focus_frame)
/* Don't waste bandwidth if the time hasn't actually changed. */
if (focus_frame && old_time != dpyinfo->last_user_time)
{
time = dpyinfo->last_user_time;
while (FRAME_PARENT_FRAME (focus_frame))
focus_frame = FRAME_PARENT_FRAME (focus_frame);