comparison src/xterm.c @ 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 b98604865ea0
children 06b928ed4503 65663fcd2caa 539530fa389c
comparison
equal deleted inserted replaced
82171:ced9c6afe013 82172:4c1979b84193
718 row->visible_height = oldVH; 718 row->visible_height = oldVH;
719 } 719 }
720 else 720 else
721 x_clip_to_row (w, row, -1, gc); 721 x_clip_to_row (w, row, -1, gc);
722 722
723 if (p->bx >= 0 && !p->overlay_p) 723 if (!p->overlay_p)
724 { 724 {
725 int bx = p->bx, by = p->by, nx = p->nx, ny = p->ny;
726
725 /* In case the same realized face is used for fringes and 727 /* In case the same realized face is used for fringes and
726 for something displayed in the text (e.g. face `region' on 728 for something displayed in the text (e.g. face `region' on
727 mono-displays, the fill style may have been changed to 729 mono-displays, the fill style may have been changed to
728 FillSolid in x_draw_glyph_string_background. */ 730 FillSolid in x_draw_glyph_string_background. */
729 if (face->stipple) 731 if (face->stipple)
730 XSetFillStyle (display, face->gc, FillOpaqueStippled); 732 XSetFillStyle (display, face->gc, FillOpaqueStippled);
731 else 733 else
732 XSetForeground (display, face->gc, face->background); 734 XSetForeground (display, face->gc, face->background);
733 735
734 XFillRectangle (display, window, face->gc, 736 #ifdef USE_TOOLKIT_SCROLL_BARS
735 p->bx, p->by, p->nx, p->ny); 737 /* If the fringe is adjacent to the left (right) scroll bar of a
738 leftmost (rightmost, respectively) window, then extend its
739 background to the gap between the fringe and the bar. */
740 if ((WINDOW_LEFTMOST_P (w)
741 && WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w))
742 || (WINDOW_RIGHTMOST_P (w)
743 && WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)))
744 {
745 int sb_width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w);
746
747 if (sb_width > 0)
748 {
749 int left = WINDOW_SCROLL_BAR_AREA_X (w);
750 int width = (WINDOW_CONFIG_SCROLL_BAR_COLS (w)
751 * FRAME_COLUMN_WIDTH (f));
752
753 if (bx < 0)
754 {
755 /* Bitmap fills the fringe. */
756 if (left + width == p->x)
757 bx = left + sb_width;
758 else if (p->x + p->wd == left)
759 bx = left;
760 if (bx >= 0)
761 {
762 int header_line_height = WINDOW_HEADER_LINE_HEIGHT (w);
763
764 nx = width - sb_width;
765 by = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height,
766 row->y));
767 ny = row->visible_height;
768 }
769 }
770 else
771 {
772 if (left + width == bx)
773 {
774 bx = left + sb_width;
775 nx += width - sb_width;
776 }
777 else if (bx + nx == left)
778 nx += width - sb_width;
779 }
780 }
781 }
782 #endif
783 if (bx >= 0 && nx > 0)
784 XFillRectangle (display, window, face->gc, bx, by, nx, ny);
736 785
737 if (!face->stipple) 786 if (!face->stipple)
738 XSetForeground (display, face->gc, face->foreground); 787 XSetForeground (display, face->gc, face->foreground);
739 } 788 }
740 789
4785 XSETINT (bar->width, width); 4834 XSETINT (bar->width, width);
4786 XSETINT (bar->height, height); 4835 XSETINT (bar->height, height);
4787 XSETINT (bar->start, 0); 4836 XSETINT (bar->start, 0);
4788 XSETINT (bar->end, 0); 4837 XSETINT (bar->end, 0);
4789 bar->dragging = Qnil; 4838 bar->dragging = Qnil;
4839 #ifdef USE_TOOLKIT_SCROLL_BARS
4840 bar->fringe_extended_p = Qnil;
4841 #endif
4790 4842
4791 /* Add bar to its frame's list of scroll bars. */ 4843 /* Add bar to its frame's list of scroll bars. */
4792 bar->next = FRAME_SCROLL_BARS (f); 4844 bar->next = FRAME_SCROLL_BARS (f);
4793 bar->prev = Qnil; 4845 bar->prev = Qnil;
4794 XSETVECTOR (FRAME_SCROLL_BARS (f), bar); 4846 XSETVECTOR (FRAME_SCROLL_BARS (f), bar);
4977 { 5029 {
4978 struct frame *f = XFRAME (w->frame); 5030 struct frame *f = XFRAME (w->frame);
4979 struct scroll_bar *bar; 5031 struct scroll_bar *bar;
4980 int top, height, left, sb_left, width, sb_width; 5032 int top, height, left, sb_left, width, sb_width;
4981 int window_y, window_height; 5033 int window_y, window_height;
5034 #ifdef USE_TOOLKIT_SCROLL_BARS
5035 int fringe_extended_p;
5036 #endif
4982 5037
4983 /* Get window dimensions. */ 5038 /* Get window dimensions. */
4984 window_box (w, -1, 0, &window_y, 0, &window_height); 5039 window_box (w, -1, 0, &window_y, 0, &window_height);
4985 top = window_y; 5040 top = window_y;
4986 width = WINDOW_CONFIG_SCROLL_BAR_COLS (w) * FRAME_COLUMN_WIDTH (f); 5041 width = WINDOW_CONFIG_SCROLL_BAR_COLS (w) * FRAME_COLUMN_WIDTH (f);
4997 sb_width = width; 5052 sb_width = width;
4998 5053
4999 /* Compute the left edge of the scroll bar. */ 5054 /* Compute the left edge of the scroll bar. */
5000 #ifdef USE_TOOLKIT_SCROLL_BARS 5055 #ifdef USE_TOOLKIT_SCROLL_BARS
5001 if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)) 5056 if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))
5002 sb_left = (left + 5057 sb_left = left + (WINDOW_RIGHTMOST_P (w) ? width - sb_width : 0);
5003 (WINDOW_RIGHTMOST_P (w)
5004 ? width - sb_width - (width - sb_width) / 2
5005 : 0));
5006 else 5058 else
5007 sb_left = (left + 5059 sb_left = left + (WINDOW_LEFTMOST_P (w) ? 0 : width - sb_width);
5008 (WINDOW_LEFTMOST_P (w)
5009 ? (width - sb_width) / 2
5010 : width - sb_width));
5011 #else 5060 #else
5012 if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)) 5061 if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))
5013 sb_left = left + width - sb_width; 5062 sb_left = left + width - sb_width;
5014 else 5063 else
5015 sb_left = left; 5064 sb_left = left;
5016 #endif 5065 #endif
5017 5066
5067 #ifdef USE_TOOLKIT_SCROLL_BARS
5068 if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w))
5069 fringe_extended_p = (WINDOW_LEFTMOST_P (w)
5070 && WINDOW_LEFT_FRINGE_WIDTH (w)
5071 && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
5072 || WINDOW_LEFT_MARGIN_COLS (w) == 0));
5073 else
5074 fringe_extended_p = (WINDOW_RIGHTMOST_P (w)
5075 && WINDOW_RIGHT_FRINGE_WIDTH (w)
5076 && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
5077 || WINDOW_RIGHT_MARGIN_COLS (w) == 0));
5078 #endif
5079
5018 /* Does the scroll bar exist yet? */ 5080 /* Does the scroll bar exist yet? */
5019 if (NILP (w->vertical_scroll_bar)) 5081 if (NILP (w->vertical_scroll_bar))
5020 { 5082 {
5021 if (width > 0 && height > 0) 5083 if (width > 0 && height > 0)
5022 { 5084 {
5023 BLOCK_INPUT; 5085 BLOCK_INPUT;
5024 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 5086 #ifdef USE_TOOLKIT_SCROLL_BARS
5025 left, top, width, height, False); 5087 if (fringe_extended_p)
5088 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
5089 sb_left, top, sb_width, height, False);
5090 else
5091 #endif
5092 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
5093 left, top, width, height, False);
5026 UNBLOCK_INPUT; 5094 UNBLOCK_INPUT;
5027 } 5095 }
5028 5096
5029 bar = x_scroll_bar_create (w, top, sb_left, sb_width, height); 5097 bar = x_scroll_bar_create (w, top, sb_left, sb_width, height);
5030 } 5098 }
5047 mask |= CWHeight; 5115 mask |= CWHeight;
5048 5116
5049 #ifdef USE_TOOLKIT_SCROLL_BARS 5117 #ifdef USE_TOOLKIT_SCROLL_BARS
5050 5118
5051 /* Move/size the scroll bar widget. */ 5119 /* Move/size the scroll bar widget. */
5052 if (mask) 5120 if (mask || !NILP (bar->fringe_extended_p) != fringe_extended_p)
5053 { 5121 {
5054 /* Since toolkit scroll bars are smaller than the space reserved 5122 /* Since toolkit scroll bars are smaller than the space reserved
5055 for them on the frame, we have to clear "under" them. */ 5123 for them on the frame, we have to clear "under" them. */
5056 if (width > 0 && height > 0) 5124 if (width > 0 && height > 0)
5057 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 5125 {
5058 left, top, width, height, False); 5126 if (fringe_extended_p)
5127 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
5128 sb_left, top, sb_width, height, False);
5129 else
5130 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
5131 left, top, width, height, False);
5132 }
5059 #ifdef USE_GTK 5133 #ifdef USE_GTK
5060 xg_update_scrollbar_pos (f, 5134 xg_update_scrollbar_pos (f,
5061 SCROLL_BAR_X_WINDOW (bar), 5135 SCROLL_BAR_X_WINDOW (bar),
5062 top, 5136 top,
5063 sb_left + VERTICAL_SCROLL_BAR_WIDTH_TRIM, 5137 sb_left + VERTICAL_SCROLL_BAR_WIDTH_TRIM,
5128 5202
5129 UNBLOCK_INPUT; 5203 UNBLOCK_INPUT;
5130 } 5204 }
5131 5205
5132 #ifdef USE_TOOLKIT_SCROLL_BARS 5206 #ifdef USE_TOOLKIT_SCROLL_BARS
5207 bar->fringe_extended_p = fringe_extended_p ? Qt : Qnil;
5208
5133 x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole); 5209 x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole);
5134 #else /* not USE_TOOLKIT_SCROLL_BARS */ 5210 #else /* not USE_TOOLKIT_SCROLL_BARS */
5135 /* Set the scroll bar's current state, unless we're currently being 5211 /* Set the scroll bar's current state, unless we're currently being
5136 dragged. */ 5212 dragged. */
5137 if (NILP (bar->dragging)) 5213 if (NILP (bar->dragging))