changeset 1718:f80c1f73f5b9

* xdisp.c: #include "termhooks.h". (redisplay, redisplay_window): Use set_vertical_scrollbar_hook, condemn_scrollbars_hook, redeem_scrollbar_hook, and judge_scrollbars_hook to make scrollbars redisplay properly. It's a pain to remember that you can't assign to FRAME->visible. Let's change all references to the `visible' member of struct frame to use the accessor macros, and then write a setter for the `visible' field that does the right thing. * frame.h (FRAME_VISIBLE_P): Make this not an l-value. (FRAME_SET_VISIBLE): New macro. * frame.c (make_terminal_frame, Fdelete_frame): Use FRAME_SET_VISIBLE. (Fframe_visible_p, Fvisible_frame_list): Use FRAME_VISIBLE_P and FRAME_ICONIFIED_P. * dispnew.c (Fredraw_display): Use the FRAME_VISIBLE_P and FRAME_GARBAGED_P accessors. * xdisp.c (redisplay): Use the FRAME_VISIBLE_P accessor. * xfns.c (x_set_foreground_color, x_set_background_color, x_set_cursor_color, x_set_border_pixel, x_set_icon_type): Use the FRAME_VISIBLE_P accessor. (Fx_create_frame): Use FRAME_SET_VISIBILITY. * xterm.c (clear_cursor, x_display_bar_cursor, x_display_box_cursor): Use FRAME_SET_VISIBILITY.
author Jim Blandy <jimb@redhat.com>
date Thu, 24 Dec 1992 06:18:24 +0000
parents aa7d6d57504b
children 48f539ac6921
files src/xdisp.c
diffstat 1 files changed, 37 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/xdisp.c	Thu Dec 24 06:17:18 1992 +0000
+++ b/src/xdisp.c	Thu Dec 24 06:18:24 1992 +0000
@@ -32,6 +32,7 @@
 #include "commands.h"
 #include "macros.h"
 #include "disptab.h"
+#include "termhooks.h"
 
 extern int interrupt_input;
 extern int command_loop_level;
@@ -497,8 +498,20 @@
       buffer_shared = 0;
 
       FOR_EACH_FRAME (tail, f)
-	if (FRAME_VISIBLE_P (f))
-	  redisplay_windows (FRAME_ROOT_WINDOW (f));
+	{
+	  /* Mark all the scrollbars to be removed; we'll redeem the ones
+	     we want when we redisplay their windows.  */
+	  if (FRAME_HAS_VERTICAL_SCROLLBARS (f))
+	    (*condemn_scrollbars_hook) (f);
+
+	  if (FRAME_VISIBLE_P (f))
+	    redisplay_windows (FRAME_ROOT_WINDOW (f));
+
+	  /* Any scrollbars which redisplay_windows should have nuked
+	     should now go away.  */
+	  if (FRAME_HAS_VERTICAL_SCROLLBARS (f))
+	    (*judge_scrollbars_hook) (f);
+	}
     }
   else if (FRAME_VISIBLE_P (selected_frame))
     {
@@ -530,7 +543,7 @@
 	    continue;
 
 	  f = XFRAME (XCONS (tail)->car);
-	  if (f->visible)
+	  if (FRAME_VISIBLE_P (f))
 	    {
 	      pause |= update_frame (f, 0, 0);
 	      if (!pause)
@@ -697,13 +710,12 @@
      int just_this_one;
 {
   register struct window *w = XWINDOW (window);
-  FRAME_PTR f = XFRAME (w->frame);
+  FRAME_PTR f = XFRAME (WINDOW_FRAME (w));
   int height;
   register int lpoint = point;
   struct buffer *old = current_buffer;
   register int width = XFASTINT (w->width) - 1
-    - (XFASTINT (w->width) + XFASTINT (w->left)
-       != FRAME_WIDTH (XFRAME (WINDOW_FRAME (w))));
+    - (XFASTINT (w->width) + XFASTINT (w->left) != FRAME_WIDTH (f));
   register int startp;
   register int hscroll = XINT (w->hscroll);
   struct position pos;
@@ -958,6 +970,25 @@
   SET_PT (opoint);
   current_buffer = old;
   SET_PT (lpoint);
+
+  if (FRAME_HAS_VERTICAL_SCROLLBARS (f))
+    {
+      struct scrollbar *bar = WINDOW_VERTICAL_SCROLLBAR (w);
+
+      /* This isn't guaranteed to be right.  For the moment, we'll pretend
+	 it is.  */
+      int endp = Z - XINT (w->window_end_pos);
+
+      /* Indicate what this scrollbar ought to be displaying now.  */
+      bar = ((*set_vertical_scrollbar_hook)
+	     (bar, w, endp - startp, Z - BEG, startp));
+
+      /* Note that we actually used the scrollbar attached to this window,
+	 so it shouldn't be deleted at the end of redisplay.  */
+      (*redeem_scrollbar_hook) (bar);
+
+      XSET (w->vertical_scrollbar, Lisp_Int, bar);
+    }
 }
 
 /* Do full redisplay on one window, starting at position `pos'. */