Drop VERTICAL_SCROLL_BAR_WIDTH_TRIM. For X, it is zero since 1999,
authorDmitry Antipov <dmantipov@yandex.ru>
Sun, 15 Sep 2013 08:28:30 +0000 (12:28 +0400)
committerDmitry Antipov <dmantipov@yandex.ru>
Sun, 15 Sep 2013 08:28:30 +0000 (12:28 +0400)
and it is always zero for others, so I assume that this is an ancient
leftover which nobody will want to change any more.
* xterm.h, w32term.h, nsterm.h (VERTICAL_SCROLL_BAR_WIDTH_TRIM): Remove.
(VERTICAL_SCROLL_BAR_INSIDE_WIDTH):
* frame.c (x_set_scroll_bar_width):
* w32fns.c (w32_createscrollbar):
* w32term.c (w32_set_vertical_scroll_bar):
* xfns.c (x_set_scroll_bar_default_width):
* xterm.c (XTflash, x_scroll_bar_create, XTset_vertical_scroll_bar)
(x_scroll_bar_expose): Related users changed.

src/ChangeLog
src/frame.c
src/nsterm.h
src/w32fns.c
src/w32term.c
src/w32term.h
src/xfns.c
src/xterm.c
src/xterm.h

index 1e50b43..5f28dc3 100644 (file)
@@ -1,3 +1,17 @@
+2013-09-15  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Drop VERTICAL_SCROLL_BAR_WIDTH_TRIM.  For X, it is zero since 1999,
+       and it is always zero for others, so I assume that this is an ancient
+       leftover which nobody will want to change any more.
+       * xterm.h, w32term.h, nsterm.h (VERTICAL_SCROLL_BAR_WIDTH_TRIM): Remove.
+       (VERTICAL_SCROLL_BAR_INSIDE_WIDTH):
+       * frame.c (x_set_scroll_bar_width):
+       * w32fns.c (w32_createscrollbar):
+       * w32term.c (w32_set_vertical_scroll_bar):
+       * xfns.c (x_set_scroll_bar_default_width):
+       * xterm.c (XTflash, x_scroll_bar_create, XTset_vertical_scroll_bar)
+       (x_scroll_bar_expose): Related users changed.
+
 2013-09-15  Dmitry Antipov  <dmantipov@yandex.ru>
 
        * xterm.h (FRAME_X_SCREEN_NUMBER): Add comment.
index fde2a13..8eabef5 100644 (file)
@@ -3369,9 +3369,6 @@ x_set_scroll_bar_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
   else if (RANGED_INTEGERP (1, arg, INT_MAX)
           && XFASTINT (arg) != FRAME_CONFIG_SCROLL_BAR_WIDTH (f))
     {
-      if (XFASTINT (arg) <= 2 * VERTICAL_SCROLL_BAR_WIDTH_TRIM)
-       XSETINT (arg, 2 * VERTICAL_SCROLL_BAR_WIDTH_TRIM + 1);
-
       FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = XFASTINT (arg);
       FRAME_CONFIG_SCROLL_BAR_COLS (f) = (XFASTINT (arg) + wid-1) / wid;
       if (FRAME_X_WINDOW (f))
index 5f89267..d8482ce 100644 (file)
@@ -900,8 +900,4 @@ extern char gnustep_base_version[];  /* version tracking */
                                 ? (min) : (((x)>(max)) ? (max) : (x)))
 #define SCREENMAXBOUND(x) (IN_BOUND (-SCREENMAX, x, SCREENMAX))
 
-/* needed somewhere... */
-#define VERTICAL_SCROLL_BAR_WIDTH_TRIM (0)
-
-
 #endif /* HAVE_NS */
index 0e8b8ab..4cbbe1d 100644 (file)
@@ -1890,16 +1890,11 @@ w32_init_class (HINSTANCE hinst)
 static HWND
 w32_createscrollbar (struct frame *f, struct scroll_bar * bar)
 {
-  return (CreateWindow ("SCROLLBAR", "", SBS_VERT | WS_CHILD | WS_VISIBLE,
-                       /* Position and size of scroll bar.  */
-                       XINT (bar->left) + VERTICAL_SCROLL_BAR_WIDTH_TRIM,
-                        XINT (bar->top),
-                       XINT (bar->width) - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2,
-                        XINT (bar->height),
-                       FRAME_W32_WINDOW (f),
-                       NULL,
-                       hinst,
-                       NULL));
+  return CreateWindow ("SCROLLBAR", "", SBS_VERT | WS_CHILD | WS_VISIBLE,
+                      /* Position and size of scroll bar.  */
+                      XINT (bar->left), XINT (bar->top),
+                      XINT (bar->width), XINT (bar->height),
+                      FRAME_W32_WINDOW (f), NULL, hinst, NULL);
 }
 
 static void
index cb7327b..af73e66 100644 (file)
@@ -3866,8 +3866,7 @@ w32_set_vertical_scroll_bar (struct window *w,
           /* Make sure scroll bar is "visible" before moving, to ensure the
              area of the parent window now exposed will be refreshed.  */
           my_show_window (f, hwnd, SW_HIDE);
-          MoveWindow (hwnd, sb_left + VERTICAL_SCROLL_BAR_WIDTH_TRIM,
-                     top, sb_width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2,
+          MoveWindow (hwnd, sb_left, top, sb_width,
                      max (height, 1), TRUE);
 
          si.cbSize = sizeof (si);
index 6a49753..1cbadad 100644 (file)
@@ -478,8 +478,7 @@ struct scroll_bar {
 #define VERTICAL_SCROLL_BAR_INSIDE_WIDTH(f,width) \
   ((width) \
    - VERTICAL_SCROLL_BAR_LEFT_BORDER \
-   - VERTICAL_SCROLL_BAR_RIGHT_BORDER \
-   - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2)
+   - VERTICAL_SCROLL_BAR_RIGHT_BORDER)
 
 /* Return the length of the rectangle within which the top of the
    handle must stay.  This isn't equivalent to the inside height,
@@ -516,11 +515,6 @@ struct scroll_bar {
 /* Minimum lengths for scroll bar handles, in pixels.  */
 #define VERTICAL_SCROLL_BAR_MIN_HANDLE (vertical_scroll_bar_min_handle)
 
-/* Trimming off a few pixels from each side prevents
-   text from glomming up against the scroll bar */
-#define VERTICAL_SCROLL_BAR_WIDTH_TRIM (0)
-
-\f
 struct frame;  /* from frame.h */
 
 extern void w32_fill_rect (struct frame *, HDC, COLORREF, RECT *);
index d455b2f..38aa5b3 100644 (file)
@@ -1468,9 +1468,8 @@ x_set_scroll_bar_default_width (struct frame *f)
   int minw = 16;
 #endif
   /* A minimum width of 14 doesn't look good for toolkit scroll bars.  */
-  int width = minw + 2 * VERTICAL_SCROLL_BAR_WIDTH_TRIM;
-  FRAME_CONFIG_SCROLL_BAR_COLS (f) = (width + wid - 1) / wid;
-  FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = width;
+  FRAME_CONFIG_SCROLL_BAR_COLS (f) = (minw + wid - 1) / wid;
+  FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = minw;
 #else
   /* Make the actual width at least 14 pixels and a multiple of a
      character width.  */
index 0576634..4086d91 100644 (file)
@@ -3019,26 +3019,7 @@ XTflash (struct frame *f)
       /* These will be the left and right margins of the rectangles.  */
       int flash_left = FRAME_INTERNAL_BORDER_WIDTH (f);
       int flash_right = FRAME_PIXEL_WIDTH (f) - FRAME_INTERNAL_BORDER_WIDTH (f);
-
-      int width;
-
-      /* Don't flash the area between a scroll bar and the frame
-        edge it is next to.  */
-      switch (FRAME_VERTICAL_SCROLL_BAR_TYPE (f))
-       {
-       case vertical_scroll_bar_left:
-         flash_left += VERTICAL_SCROLL_BAR_WIDTH_TRIM;
-         break;
-
-       case vertical_scroll_bar_right:
-         flash_right -= VERTICAL_SCROLL_BAR_WIDTH_TRIM;
-         break;
-
-       default:
-         break;
-       }
-
-      width = flash_right - flash_left;
+      int width = flash_right - flash_left;
 
       /* If window is tall, flash top and bottom line.  */
       if (height > 3 * FRAME_LINE_HEIGHT (f))
@@ -5053,12 +5034,9 @@ x_scroll_bar_create (struct window *w, int top, int left, int width, int height)
 
     window = XCreateWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
                            /* Position and size of scroll bar.  */
-                           left + VERTICAL_SCROLL_BAR_WIDTH_TRIM,
-                           top,
-                           width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2,
-                           height,
+                           left, top, width, height,
                            /* Border width, depth, class, and visual.  */
-                            0,
+                           0,
                            CopyFromParent,
                            CopyFromParent,
                            CopyFromParent,
@@ -5093,19 +5071,11 @@ x_scroll_bar_create (struct window *w, int top, int left, int width, int height)
 #ifdef USE_TOOLKIT_SCROLL_BARS
   {
 #ifdef USE_GTK
-    xg_update_scrollbar_pos (f,
-                             bar->x_window,
-                             top,
-                             left + VERTICAL_SCROLL_BAR_WIDTH_TRIM,
-                             width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2,
-                             max (height, 1));
+    xg_update_scrollbar_pos (f, bar->x_window, top,
+                            left,width, max (height, 1));
 #else /* not USE_GTK */
     Widget scroll_bar = SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar);
-    XtConfigureWidget (scroll_bar,
-                      left + VERTICAL_SCROLL_BAR_WIDTH_TRIM,
-                      top,
-                      width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2,
-                      max (height, 1), 0);
+    XtConfigureWidget (scroll_bar, left, top, width, max (height, 1), 0);
     XtMapWidget (scroll_bar);
 #endif /* not USE_GTK */
     }
@@ -5353,33 +5323,15 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio
                              left, top, width, height);
            }
 #ifdef USE_GTK
-          xg_update_scrollbar_pos (f,
-                                   bar->x_window,
-                                   top,
-                                   sb_left + VERTICAL_SCROLL_BAR_WIDTH_TRIM,
-                                   sb_width - VERTICAL_SCROLL_BAR_WIDTH_TRIM *2,
-                                   max (height, 1));
+          xg_update_scrollbar_pos (f, bar->x_window, top,
+                                  sb_left, sb_width, max (height, 1));
 #else /* not USE_GTK */
           XtConfigureWidget (SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar),
-                             sb_left + VERTICAL_SCROLL_BAR_WIDTH_TRIM,
-                             top,
-                             sb_width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2,
-                             max (height, 1), 0);
+                             sb_left, top, sb_width, max (height, 1), 0);
 #endif /* not USE_GTK */
        }
 #else /* not USE_TOOLKIT_SCROLL_BARS */
 
-      /* Clear areas not covered by the scroll bar because of
-        VERTICAL_SCROLL_BAR_WIDTH_TRIM.  */
-      if (VERTICAL_SCROLL_BAR_WIDTH_TRIM)
-       {
-         x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
-                       left, top, VERTICAL_SCROLL_BAR_WIDTH_TRIM, height);
-         x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
-                       left + width - VERTICAL_SCROLL_BAR_WIDTH_TRIM,
-                       top, VERTICAL_SCROLL_BAR_WIDTH_TRIM, height);
-       }
-
       /* Clear areas not covered by the scroll bar because it's not as
         wide as the area reserved for it.  This makes sure a
         previous mode line display is cleared after C-x 2 C-x 1, for
@@ -5403,9 +5355,9 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio
        {
          XWindowChanges wc;
 
-         wc.x = sb_left + VERTICAL_SCROLL_BAR_WIDTH_TRIM;
+         wc.x = sb_left;
          wc.y = top;
-         wc.width = sb_width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2;
+         wc.width = sb_width;
          wc.height = height;
          XConfigureWindow (FRAME_X_DISPLAY (f), bar->x_window,
                            mask, &wc);
@@ -5568,7 +5520,6 @@ x_scroll_bar_expose (struct scroll_bar *bar, XEvent *event)
   Window w = bar->x_window;
   struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
   GC gc = f->output_data.x->normal_gc;
-  int width_trim = VERTICAL_SCROLL_BAR_WIDTH_TRIM;
 
   block_input ();
 
@@ -5581,11 +5532,8 @@ x_scroll_bar_expose (struct scroll_bar *bar, XEvent *event)
 
   /* Draw a one-pixel border just inside the edges of the scroll bar.  */
   XDrawRectangle (FRAME_X_DISPLAY (f), w, gc,
-
                  /* x, y, width, height */
-                 0, 0,
-                 bar->width - 1 - width_trim - width_trim,
-                 bar->height - 1);
+                 0, 0, bar->width - 1, bar->height - 1);
 
    /* Restore the foreground color of the GC if we changed it above.  */
    if (f->output_data.x->scroll_bar_foreground_pixel != -1)
index b7efee4..2703c74 100644 (file)
@@ -820,8 +820,7 @@ struct scroll_bar
 #define VERTICAL_SCROLL_BAR_INSIDE_WIDTH(f, width) \
   ((width) \
    - VERTICAL_SCROLL_BAR_LEFT_BORDER \
-   - VERTICAL_SCROLL_BAR_RIGHT_BORDER \
-   - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2)
+   - VERTICAL_SCROLL_BAR_RIGHT_BORDER)
 
 /* Return the length of the rectangle within which the top of the
    handle must stay.  This isn't equivalent to the inside height,
@@ -858,11 +857,6 @@ struct scroll_bar
 /* Minimum lengths for scroll bar handles, in pixels.  */
 #define VERTICAL_SCROLL_BAR_MIN_HANDLE (5)
 
-/* Trimming off a few pixels from each side prevents
-   text from glomming up against the scroll bar */
-#define VERTICAL_SCROLL_BAR_WIDTH_TRIM (0)
-
-\f
 /* If a struct input_event has a kind which is SELECTION_REQUEST_EVENT
    or SELECTION_CLEAR_EVENT, then its contents are really described
    by this structure.  */