From 0eed03550425dd3e3689a7fa4d0f1a95b2e48254 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Sun, 15 Sep 2013 12:28:30 +0400 Subject: [PATCH] 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. --- src/ChangeLog | 14 ++++++++++ src/frame.c | 3 -- src/nsterm.h | 4 --- src/w32fns.c | 15 ++++------ src/w32term.c | 3 +- src/w32term.h | 8 +----- src/xfns.c | 5 ++-- src/xterm.c | 76 ++++++++------------------------------------------- src/xterm.h | 8 +----- 9 files changed, 36 insertions(+), 100 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 1e50b4391b..5f28dc3d7d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,17 @@ +2013-09-15 Dmitry Antipov + + 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 * xterm.h (FRAME_X_SCREEN_NUMBER): Add comment. diff --git a/src/frame.c b/src/frame.c index fde2a13154..8eabef55d1 100644 --- a/src/frame.c +++ b/src/frame.c @@ -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)) diff --git a/src/nsterm.h b/src/nsterm.h index 5f89267be5..d8482cebbb 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -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 */ diff --git a/src/w32fns.c b/src/w32fns.c index 0e8b8ab5a5..4cbbe1d5a8 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -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 diff --git a/src/w32term.c b/src/w32term.c index cb7327b21b..af73e66d88 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -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); diff --git a/src/w32term.h b/src/w32term.h index 6a49753a70..1cbadadc84 100644 --- a/src/w32term.h +++ b/src/w32term.h @@ -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) - - struct frame; /* from frame.h */ extern void w32_fill_rect (struct frame *, HDC, COLORREF, RECT *); diff --git a/src/xfns.c b/src/xfns.c index d455b2f21e..38aa5b3bbf 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -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. */ diff --git a/src/xterm.c b/src/xterm.c index 05766341cb..4086d913c8 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -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) diff --git a/src/xterm.h b/src/xterm.h index b7efee4b6c..2703c74329 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -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) - - /* 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. */ -- 2.20.1