diff src/macterm.c @ 87903:5d58981e6690

Merge from emacs--rel--22 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1006
author Miles Bader <miles@gnu.org>
date Tue, 22 Jan 2008 23:53:46 +0000
parents 107ccd98fa12 d2835a5f1cb5
children 9ea2c2750268
line wrap: on
line diff
--- a/src/macterm.c	Tue Jan 22 15:44:14 2008 +0000
+++ b/src/macterm.c	Tue Jan 22 23:53:46 2008 +0000
@@ -5069,6 +5069,7 @@
 #ifdef MAC_OSX
   bar->fringe_extended_p = Qnil;
 #endif
+  bar->redraw_needed_p = Qnil;
 #ifdef USE_TOOLKIT_SCROLL_BARS
   bar->track_top = Qnil;
   bar->track_height = Qnil;
@@ -5285,14 +5286,24 @@
       BLOCK_INPUT;
 
       /* If already correctly positioned, do nothing.  */
-      if (!(XINT (bar->left) == sb_left
-	    && XINT (bar->top) == top
-	    && XINT (bar->width) == sb_width
-	    && XINT (bar->height) == height
+      if (XINT (bar->left) == sb_left
+	  && XINT (bar->top) == top
+	  && XINT (bar->width) == sb_width
+	  && XINT (bar->height) == height
 #ifdef MAC_OSX
-	    && !NILP (bar->fringe_extended_p) == fringe_extended_p
-#endif
-	    ))
+	  && !NILP (bar->fringe_extended_p) == fringe_extended_p
+#endif
+	  )
+	{
+	  if (!NILP (bar->redraw_needed_p))
+	    {
+#if USE_CG_DRAWING
+	      mac_prepare_for_quickdraw (f);
+#endif
+	      Draw1Control (SCROLL_BAR_CONTROL_HANDLE (bar));
+	    }
+	}
+      else
 	{
 	  /* Since toolkit scroll bars are smaller than the space reserved
 	     for them on the frame, we have to clear "under" them.  */
@@ -5334,6 +5345,8 @@
   bar->fringe_extended_p = fringe_extended_p ? Qt : Qnil;
 #endif
 
+  bar->redraw_needed_p = Qnil;
+
 #ifdef USE_TOOLKIT_SCROLL_BARS
   if (NILP (bar->track_top))
     {
@@ -5691,8 +5704,15 @@
 x_scroll_bar_clear (f)
      FRAME_PTR f;
 {
-  XTcondemn_scroll_bars (f);
-  XTjudge_scroll_bars (f);
+  Lisp_Object bar;
+
+  /* We can have scroll bars even if this is 0,
+     if we just turned off scroll bar mode.
+     But in that case we should not clear them.  */
+  if (FRAME_HAS_VERTICAL_SCROLL_BARS (f))
+    for (bar = FRAME_SCROLL_BARS (f); VECTORP (bar);
+	 bar = XSCROLL_BAR (bar)->next)
+      XSCROLL_BAR (bar)->redraw_needed_p = Qt;
 }