changeset 69113:eb6e7cc98bbf

(x_set_toolkit_scroll_bar_thumb): Don't set control values if control is not visible or values are not changed.
author YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
date Thu, 23 Feb 2006 10:43:10 +0000
parents 5431a1e834cc
children ba8b885b8dd3
files src/macterm.c
diffstat 1 files changed, 15 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/macterm.c	Thu Feb 23 10:13:23 2006 +0000
+++ b/src/macterm.c	Thu Feb 23 10:43:10 2006 +0000
@@ -4529,7 +4529,7 @@
      int portion, position, whole;
 {
   ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar);
-  int value, viewsize, maximum, visible_p;
+  int value, viewsize, maximum;
 
   if (whole == 0 || XINT (bar->track_height) == 0)
     value = 0, viewsize = 1, maximum = 0;
@@ -4542,16 +4542,20 @@
 
   BLOCK_INPUT;
 
-  /* Temporarily hide the scroll bar to avoid multiple redraws.  */
-  visible_p = IsControlVisible (ch);
-  SetControlVisibility (ch, false, false);
-
-  SetControl32BitMinimum (ch, 0);
-  SetControl32BitMaximum (ch, maximum);
-  SetControl32BitValue (ch, value);
-  SetControlViewSize (ch, viewsize);
-
-  SetControlVisibility (ch, visible_p, true);
+  if (IsControlVisible (ch)
+      && (GetControlViewSize (ch) != viewsize
+	  || GetControl32BitValue (ch) != value
+	  || GetControl32BitMaximum (ch) != maximum))
+    {
+      /* Temporarily hide the scroll bar to avoid multiple redraws.  */
+      SetControlVisibility (ch, false, false);
+
+      SetControl32BitMaximum (ch, maximum);
+      SetControl32BitValue (ch, value);
+      SetControlViewSize (ch, viewsize);
+
+      SetControlVisibility (ch, true, true);
+    }
 
   UNBLOCK_INPUT;
 }