aboutsummaryrefslogtreecommitdiffstats
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.
6 6
7GNU Emacs is free software; you can redistribute it and/or modify 7GNU Emacs is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by 8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option) 9the Free Software Foundation; either version 3, or (at your option)
10any later version. 10any later version.
11 11
12GNU Emacs is distributed in the hope that it will be useful, 12GNU Emacs is distributed in the hope that it will be useful,
@@ -731,8 +731,10 @@ x_draw_fringe_bitmap (w, row, p)
731 else 731 else
732 x_clip_to_row (w, row, -1, gc); 732 x_clip_to_row (w, row, -1, gc);
733 733
734 if (p->bx >= 0 && !p->overlay_p) 734 if (!p->overlay_p)
735 { 735 {
736 int bx = p->bx, by = p->by, nx = p->nx, ny = p->ny;
737
736 /* In case the same realized face is used for fringes and 738 /* In case the same realized face is used for fringes and
737 for something displayed in the text (e.g. face `region' on 739 for something displayed in the text (e.g. face `region' on
738 mono-displays, the fill style may have been changed to 740 mono-displays, the fill style may have been changed to
@@ -742,8 +744,55 @@ x_draw_fringe_bitmap (w, row, p)
742 else 744 else
743 XSetForeground (display, face->gc, face->background); 745 XSetForeground (display, face->gc, face->background);
744 746
745 XFillRectangle (display, window, face->gc, 747#ifdef USE_TOOLKIT_SCROLL_BARS
746 p->bx, p->by, p->nx, p->ny); 748 /* If the fringe is adjacent to the left (right) scroll bar of a
749 leftmost (rightmost, respectively) window, then extend its
750 background to the gap between the fringe and the bar. */
751 if ((WINDOW_LEFTMOST_P (w)
752 && WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w))
753 || (WINDOW_RIGHTMOST_P (w)
754 && WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)))
755 {
756 int sb_width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w);
757
758 if (sb_width > 0)
759 {
760 int left = WINDOW_SCROLL_BAR_AREA_X (w);
761 int width = (WINDOW_CONFIG_SCROLL_BAR_COLS (w)
762 * FRAME_COLUMN_WIDTH (f));
763
764 if (bx < 0)
765 {
766 /* Bitmap fills the fringe. */
767 if (left + width == p->x)
768 bx = left + sb_width;
769 else if (p->x + p->wd == left)
770 bx = left;
771 if (bx >= 0)
772 {
773 int header_line_height = WINDOW_HEADER_LINE_HEIGHT (w);
774
775 nx = width - sb_width;
776 by = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height,
777 row->y));
778 ny = row->visible_height;
779 }
780 }
781 else
782 {
783 if (left + width == bx)
784 {
785 bx = left + sb_width;
786 nx += width - sb_width;
787 }
788 else if (bx + nx == left)
789 nx += width - sb_width;
790 }
791 }
792 }
793#endif
794 if (bx >= 0 && nx > 0)
795 XFillRectangle (display, window, face->gc, bx, by, nx, ny);
747 796
748 if (!face->stipple) 797 if (!face->stipple)
749 XSetForeground (display, face->gc, face->foreground); 798 XSetForeground (display, face->gc, face->foreground);
@@ -4800,6 +4849,9 @@ x_scroll_bar_create (w, top, left, width, height)
4800 XSETINT (bar->start, 0); 4849 XSETINT (bar->start, 0);
4801 XSETINT (bar->end, 0); 4850 XSETINT (bar->end, 0);
4802 bar->dragging = Qnil; 4851 bar->dragging = Qnil;
4852#ifdef USE_TOOLKIT_SCROLL_BARS
4853 bar->fringe_extended_p = Qnil;
4854#endif
4803 4855
4804 /* Add bar to its frame's list of scroll bars. */ 4856 /* Add bar to its frame's list of scroll bars. */
4805 bar->next = FRAME_SCROLL_BARS (f); 4857 bar->next = FRAME_SCROLL_BARS (f);
@@ -4992,6 +5044,9 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
4992 struct scroll_bar *bar; 5044 struct scroll_bar *bar;
4993 int top, height, left, sb_left, width, sb_width; 5045 int top, height, left, sb_left, width, sb_width;
4994 int window_y, window_height; 5046 int window_y, window_height;
5047#ifdef USE_TOOLKIT_SCROLL_BARS
5048 int fringe_extended_p;
5049#endif
4995 5050
4996 /* Get window dimensions. */ 5051 /* Get window dimensions. */
4997 window_box (w, -1, 0, &window_y, 0, &window_height); 5052 window_box (w, -1, 0, &window_y, 0, &window_height);
@@ -5012,15 +5067,9 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
5012 /* Compute the left edge of the scroll bar. */ 5067 /* Compute the left edge of the scroll bar. */
5013#ifdef USE_TOOLKIT_SCROLL_BARS 5068#ifdef USE_TOOLKIT_SCROLL_BARS
5014 if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)) 5069 if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))
5015 sb_left = (left + 5070 sb_left = left + (WINDOW_RIGHTMOST_P (w) ? width - sb_width : 0);
5016 (WINDOW_RIGHTMOST_P (w)
5017 ? width - sb_width - (width - sb_width) / 2
5018 : 0));
5019 else 5071 else
5020 sb_left = (left + 5072 sb_left = left + (WINDOW_LEFTMOST_P (w) ? 0 : width - sb_width);
5021 (WINDOW_LEFTMOST_P (w)
5022 ? (width - sb_width) / 2
5023 : width - sb_width));
5024#else 5073#else
5025 if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)) 5074 if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))
5026 sb_left = left + width - sb_width; 5075 sb_left = left + width - sb_width;
@@ -5028,14 +5077,33 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
5028 sb_left = left; 5077 sb_left = left;
5029#endif 5078#endif
5030 5079
5080#ifdef USE_TOOLKIT_SCROLL_BARS
5081 if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w))
5082 fringe_extended_p = (WINDOW_LEFTMOST_P (w)
5083 && WINDOW_LEFT_FRINGE_WIDTH (w)
5084 && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
5085 || WINDOW_LEFT_MARGIN_COLS (w) == 0));
5086 else
5087 fringe_extended_p = (WINDOW_RIGHTMOST_P (w)
5088 && WINDOW_RIGHT_FRINGE_WIDTH (w)
5089 && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
5090 || WINDOW_RIGHT_MARGIN_COLS (w) == 0));
5091#endif
5092
5031 /* Does the scroll bar exist yet? */ 5093 /* Does the scroll bar exist yet? */
5032 if (NILP (w->vertical_scroll_bar)) 5094 if (NILP (w->vertical_scroll_bar))
5033 { 5095 {
5034 if (width > 0 && height > 0) 5096 if (width > 0 && height > 0)
5035 { 5097 {
5036 BLOCK_INPUT; 5098 BLOCK_INPUT;
5037 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 5099#ifdef USE_TOOLKIT_SCROLL_BARS
5038 left, top, width, height, False); 5100 if (fringe_extended_p)
5101 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
5102 sb_left, top, sb_width, height, False);
5103 else
5104#endif
5105 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
5106 left, top, width, height, False);
5039 UNBLOCK_INPUT; 5107 UNBLOCK_INPUT;
5040 } 5108 }
5041 5109
@@ -5062,13 +5130,19 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
5062#ifdef USE_TOOLKIT_SCROLL_BARS 5130#ifdef USE_TOOLKIT_SCROLL_BARS
5063 5131
5064 /* Move/size the scroll bar widget. */ 5132 /* Move/size the scroll bar widget. */
5065 if (mask) 5133 if (mask || !NILP (bar->fringe_extended_p) != fringe_extended_p)
5066 { 5134 {
5067 /* Since toolkit scroll bars are smaller than the space reserved 5135 /* Since toolkit scroll bars are smaller than the space reserved
5068 for them on the frame, we have to clear "under" them. */ 5136 for them on the frame, we have to clear "under" them. */
5069 if (width > 0 && height > 0) 5137 if (width > 0 && height > 0)
5070 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 5138 {
5071 left, top, width, height, False); 5139 if (fringe_extended_p)
5140 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
5141 sb_left, top, sb_width, height, False);
5142 else
5143 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
5144 left, top, width, height, False);
5145 }
5072#ifdef USE_GTK 5146#ifdef USE_GTK
5073 xg_update_scrollbar_pos (f, 5147 xg_update_scrollbar_pos (f,
5074 SCROLL_BAR_X_WINDOW (bar), 5148 SCROLL_BAR_X_WINDOW (bar),
@@ -5143,6 +5217,8 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
5143 } 5217 }
5144 5218
5145#ifdef USE_TOOLKIT_SCROLL_BARS 5219#ifdef USE_TOOLKIT_SCROLL_BARS
5220 bar->fringe_extended_p = fringe_extended_p ? Qt : Qnil;
5221
5146 x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole); 5222 x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole);
5147#else /* not USE_TOOLKIT_SCROLL_BARS */ 5223#else /* not USE_TOOLKIT_SCROLL_BARS */
5148 /* Set the scroll bar's current state, unless we're currently being 5224 /* Set the scroll bar's current state, unless we're currently being