Mercurial > emacs
changeset 82172:4c1979b84193
(x_draw_fringe_bitmap) [USE_TOOLKIT_SCROLL_BARS]:
Extend fringe background to scroll bar gap.
(x_scroll_bar_create) [USE_TOOLKIT_SCROLL_BARS]:
Set bar->fringe_extended_p.
(XTset_vertical_scroll_bar) [USE_TOOLKIT_SCROLL_BARS]:
Put leftmost/rightmost scroll bars on frame edge. Check fringe
background extension. Don't clear extended fringe background area.
author | YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> |
---|---|
date | Fri, 27 Jul 2007 08:40:47 +0000 |
parents | ced9c6afe013 |
children | bfb968b72892 |
files | src/xterm.c |
diffstat | 1 files changed, 93 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/src/xterm.c Fri Jul 27 08:40:38 2007 +0000 +++ b/src/xterm.c Fri Jul 27 08:40:47 2007 +0000 @@ -720,8 +720,10 @@ else x_clip_to_row (w, row, -1, gc); - if (p->bx >= 0 && !p->overlay_p) - { + if (!p->overlay_p) + { + int bx = p->bx, by = p->by, nx = p->nx, ny = p->ny; + /* In case the same realized face is used for fringes and for something displayed in the text (e.g. face `region' on mono-displays, the fill style may have been changed to @@ -731,8 +733,55 @@ else XSetForeground (display, face->gc, face->background); - XFillRectangle (display, window, face->gc, - p->bx, p->by, p->nx, p->ny); +#ifdef USE_TOOLKIT_SCROLL_BARS + /* If the fringe is adjacent to the left (right) scroll bar of a + leftmost (rightmost, respectively) window, then extend its + background to the gap between the fringe and the bar. */ + if ((WINDOW_LEFTMOST_P (w) + && WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w)) + || (WINDOW_RIGHTMOST_P (w) + && WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))) + { + int sb_width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w); + + if (sb_width > 0) + { + int left = WINDOW_SCROLL_BAR_AREA_X (w); + int width = (WINDOW_CONFIG_SCROLL_BAR_COLS (w) + * FRAME_COLUMN_WIDTH (f)); + + if (bx < 0) + { + /* Bitmap fills the fringe. */ + if (left + width == p->x) + bx = left + sb_width; + else if (p->x + p->wd == left) + bx = left; + if (bx >= 0) + { + int header_line_height = WINDOW_HEADER_LINE_HEIGHT (w); + + nx = width - sb_width; + by = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, + row->y)); + ny = row->visible_height; + } + } + else + { + if (left + width == bx) + { + bx = left + sb_width; + nx += width - sb_width; + } + else if (bx + nx == left) + nx += width - sb_width; + } + } + } +#endif + if (bx >= 0 && nx > 0) + XFillRectangle (display, window, face->gc, bx, by, nx, ny); if (!face->stipple) XSetForeground (display, face->gc, face->foreground); @@ -4787,6 +4836,9 @@ XSETINT (bar->start, 0); XSETINT (bar->end, 0); bar->dragging = Qnil; +#ifdef USE_TOOLKIT_SCROLL_BARS + bar->fringe_extended_p = Qnil; +#endif /* Add bar to its frame's list of scroll bars. */ bar->next = FRAME_SCROLL_BARS (f); @@ -4979,6 +5031,9 @@ struct scroll_bar *bar; int top, height, left, sb_left, width, sb_width; int window_y, window_height; +#ifdef USE_TOOLKIT_SCROLL_BARS + int fringe_extended_p; +#endif /* Get window dimensions. */ window_box (w, -1, 0, &window_y, 0, &window_height); @@ -4999,15 +5054,9 @@ /* Compute the left edge of the scroll bar. */ #ifdef USE_TOOLKIT_SCROLL_BARS if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)) - sb_left = (left + - (WINDOW_RIGHTMOST_P (w) - ? width - sb_width - (width - sb_width) / 2 - : 0)); + sb_left = left + (WINDOW_RIGHTMOST_P (w) ? width - sb_width : 0); else - sb_left = (left + - (WINDOW_LEFTMOST_P (w) - ? (width - sb_width) / 2 - : width - sb_width)); + sb_left = left + (WINDOW_LEFTMOST_P (w) ? 0 : width - sb_width); #else if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)) sb_left = left + width - sb_width; @@ -5015,14 +5064,33 @@ sb_left = left; #endif +#ifdef USE_TOOLKIT_SCROLL_BARS + if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w)) + fringe_extended_p = (WINDOW_LEFTMOST_P (w) + && WINDOW_LEFT_FRINGE_WIDTH (w) + && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) + || WINDOW_LEFT_MARGIN_COLS (w) == 0)); + else + fringe_extended_p = (WINDOW_RIGHTMOST_P (w) + && WINDOW_RIGHT_FRINGE_WIDTH (w) + && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) + || WINDOW_RIGHT_MARGIN_COLS (w) == 0)); +#endif + /* Does the scroll bar exist yet? */ if (NILP (w->vertical_scroll_bar)) { if (width > 0 && height > 0) { BLOCK_INPUT; - x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), - left, top, width, height, False); +#ifdef USE_TOOLKIT_SCROLL_BARS + if (fringe_extended_p) + x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), + sb_left, top, sb_width, height, False); + else +#endif + x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), + left, top, width, height, False); UNBLOCK_INPUT; } @@ -5049,13 +5117,19 @@ #ifdef USE_TOOLKIT_SCROLL_BARS /* Move/size the scroll bar widget. */ - if (mask) + if (mask || !NILP (bar->fringe_extended_p) != fringe_extended_p) { /* Since toolkit scroll bars are smaller than the space reserved for them on the frame, we have to clear "under" them. */ if (width > 0 && height > 0) - x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), - left, top, width, height, False); + { + if (fringe_extended_p) + x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), + sb_left, top, sb_width, height, False); + else + x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), + left, top, width, height, False); + } #ifdef USE_GTK xg_update_scrollbar_pos (f, SCROLL_BAR_X_WINDOW (bar), @@ -5130,6 +5204,8 @@ } #ifdef USE_TOOLKIT_SCROLL_BARS + bar->fringe_extended_p = fringe_extended_p ? Qt : Qnil; + x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole); #else /* not USE_TOOLKIT_SCROLL_BARS */ /* Set the scroll bar's current state, unless we're currently being