]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid wasting bandwidth to set user time
authorPo Lu <luangruo@yahoo.com>
Thu, 21 Jul 2022 06:55:05 +0000 (14:55 +0800)
committerPo Lu <luangruo@yahoo.com>
Thu, 21 Jul 2022 06:55:19 +0000 (14:55 +0800)
* src/xterm.c (x_display_set_last_user_time): Don't change the
user time property if nothing actually changed.

src/xterm.c

index e6b098f8830d1beb4943217fc0556374c75f4b10..1e9161c7ab02c64bf010443759a1615e23218f01 100644 (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);