emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 50ff15bb8a: Avoid wasting bandwidth to set user time


From: Po Lu
Subject: master 50ff15bb8a: Avoid wasting bandwidth to set user time
Date: Thu, 21 Jul 2022 02:55:45 -0400 (EDT)

branch: master
commit 50ff15bb8aee1bffbd4a69f8bb7c17c7d11b0bcc
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    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.
---
 src/xterm.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index e6b098f883..1e9161c7ab 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -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);
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]