summaryrefslogtreecommitdiff
path: root/src/xterm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xterm.c')
-rw-r--r--src/xterm.c110
1 files changed, 93 insertions, 17 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 2873a2a76c9..6183ffade0d 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -6,7 +6,7 @@ This file is part of GNU Emacs.
GNU Emacs is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
+the Free Software Foundation; either version 3, or (at your option)
any later version.
GNU Emacs is distributed in the hope that it will be useful,
@@ -731,8 +731,10 @@ x_draw_fringe_bitmap (w, row, p)
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
@@ -742,8 +744,55 @@ x_draw_fringe_bitmap (w, row, p)
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);
@@ -4800,6 +4849,9 @@ x_scroll_bar_create (w, top, left, width, height)
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);
@@ -4992,6 +5044,9 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
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);
@@ -5012,15 +5067,9 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
/* 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;
@@ -5028,14 +5077,33 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
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;
}
@@ -5062,13 +5130,19 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
#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),
@@ -5143,6 +5217,8 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
}
#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