diff options
| author | YAMAMOTO Mitsuharu | 2013-12-02 10:05:57 +0900 |
|---|---|---|
| committer | YAMAMOTO Mitsuharu | 2013-12-02 10:05:57 +0900 |
| commit | e0e0af3bd5e06526bf69ec1f0f9958371eef59d7 (patch) | |
| tree | b67fc9348751075af4600bd1398ea5c9b63aa59b /src | |
| parent | f224e5002292f7b9b9347147d4b5af913fed516a (diff) | |
| download | emacs-e0e0af3bd5e06526bf69ec1f0f9958371eef59d7.tar.gz emacs-e0e0af3bd5e06526bf69ec1f0f9958371eef59d7.zip | |
Remove fringe background extension code on X11.
* xterm.h (struct scroll_bar): Remove member `fringe_extended_p'.
* xterm.c (x_draw_fringe_bitmap, x_scroll_run): Remove code for
fringe background extension.
(x_scroll_bar_create): Remove variables `sb_left' and `sb_width',
because they are now always the same as `left' and `width',
respectively. Remove code for the case that `width' and
`sb_width' are different.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 11 | ||||
| -rw-r--r-- | src/xterm.c | 175 | ||||
| -rw-r--r-- | src/xterm.h | 4 |
3 files changed, 31 insertions, 159 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index fc9e8431146..6eb258ce4d5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | 2013-12-02 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 2 | |||
| 3 | * xterm.h (struct scroll_bar): Remove member `fringe_extended_p'. | ||
| 4 | |||
| 5 | * xterm.c (x_draw_fringe_bitmap, x_scroll_run): Remove code for | ||
| 6 | fringe background extension. | ||
| 7 | (x_scroll_bar_create): Remove variables `sb_left' and `sb_width', | ||
| 8 | because they are now always the same as `left' and `width', | ||
| 9 | respectively. Remove code for the case that `width' and | ||
| 10 | `sb_width' are different. | ||
| 11 | |||
| 1 | 2013-12-01 Paul Eggert <eggert@cs.ucla.edu> | 12 | 2013-12-01 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 13 | ||
| 3 | Fix minor problems found by static checking. | 14 | Fix minor problems found by static checking. |
diff --git a/src/xterm.c b/src/xterm.c index 9673535be79..35f7facc80e 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -653,10 +653,8 @@ x_draw_fringe_bitmap (struct window *w, struct glyph_row *row, struct draw_fring | |||
| 653 | /* Must clip because of partially visible lines. */ | 653 | /* Must clip because of partially visible lines. */ |
| 654 | x_clip_to_row (w, row, ANY_AREA, gc); | 654 | x_clip_to_row (w, row, ANY_AREA, gc); |
| 655 | 655 | ||
| 656 | if (!p->overlay_p) | 656 | if (p->bx >= 0 && !p->overlay_p) |
| 657 | { | 657 | { |
| 658 | int bx = p->bx, by = p->by, nx = p->nx, ny = p->ny; | ||
| 659 | |||
| 660 | /* In case the same realized face is used for fringes and | 658 | /* In case the same realized face is used for fringes and |
| 661 | for something displayed in the text (e.g. face `region' on | 659 | for something displayed in the text (e.g. face `region' on |
| 662 | mono-displays, the fill style may have been changed to | 660 | mono-displays, the fill style may have been changed to |
| @@ -666,54 +664,8 @@ x_draw_fringe_bitmap (struct window *w, struct glyph_row *row, struct draw_fring | |||
| 666 | else | 664 | else |
| 667 | XSetForeground (display, face->gc, face->background); | 665 | XSetForeground (display, face->gc, face->background); |
| 668 | 666 | ||
| 669 | #ifdef USE_TOOLKIT_SCROLL_BARS | 667 | XFillRectangle (display, window, face->gc, |
| 670 | /* If the fringe is adjacent to the left (right) scroll bar of a | 668 | p->bx, p->by, p->nx, p->ny); |
| 671 | leftmost (rightmost, respectively) window, then extend its | ||
| 672 | background to the gap between the fringe and the bar. */ | ||
| 673 | if ((WINDOW_LEFTMOST_P (w) | ||
| 674 | && WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w)) | ||
| 675 | || (WINDOW_RIGHTMOST_P (w) | ||
| 676 | && WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))) | ||
| 677 | { | ||
| 678 | int sb_width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w); | ||
| 679 | |||
| 680 | if (sb_width > 0) | ||
| 681 | { | ||
| 682 | int bar_area_x = WINDOW_SCROLL_BAR_AREA_X (w); | ||
| 683 | int bar_area_width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w); | ||
| 684 | |||
| 685 | if (bx < 0) | ||
| 686 | { | ||
| 687 | /* Bitmap fills the fringe. */ | ||
| 688 | if (bar_area_x + bar_area_width == p->x) | ||
| 689 | bx = bar_area_x + sb_width; | ||
| 690 | else if (p->x + p->wd == bar_area_x) | ||
| 691 | bx = bar_area_x; | ||
| 692 | if (bx >= 0) | ||
| 693 | { | ||
| 694 | int header_line_height = WINDOW_HEADER_LINE_HEIGHT (w); | ||
| 695 | |||
| 696 | nx = bar_area_width - sb_width; | ||
| 697 | by = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, | ||
| 698 | row->y)); | ||
| 699 | ny = row->visible_height; | ||
| 700 | } | ||
| 701 | } | ||
| 702 | else | ||
| 703 | { | ||
| 704 | if (bar_area_x + bar_area_width == bx) | ||
| 705 | { | ||
| 706 | bx = bar_area_x + sb_width; | ||
| 707 | nx += bar_area_width - sb_width; | ||
| 708 | } | ||
| 709 | else if (bx + nx == bar_area_x) | ||
| 710 | nx += bar_area_width - sb_width; | ||
| 711 | } | ||
| 712 | } | ||
| 713 | } | ||
| 714 | #endif | ||
| 715 | if (bx >= 0 && nx > 0) | ||
| 716 | XFillRectangle (display, window, face->gc, bx, by, nx, ny); | ||
| 717 | 669 | ||
| 718 | if (!face->stipple) | 670 | if (!face->stipple) |
| 719 | XSetForeground (display, face->gc, face->foreground); | 671 | XSetForeground (display, face->gc, face->foreground); |
| @@ -3128,33 +3080,6 @@ x_scroll_run (struct window *w, struct run *run) | |||
| 3128 | fringe of W. */ | 3080 | fringe of W. */ |
| 3129 | window_box (w, ANY_AREA, &x, &y, &width, &height); | 3081 | window_box (w, ANY_AREA, &x, &y, &width, &height); |
| 3130 | 3082 | ||
| 3131 | #ifdef USE_TOOLKIT_SCROLL_BARS | ||
| 3132 | /* If the fringe is adjacent to the left (right) scroll bar of a | ||
| 3133 | leftmost (rightmost, respectively) window, then extend its | ||
| 3134 | background to the gap between the fringe and the bar. */ | ||
| 3135 | if ((WINDOW_LEFTMOST_P (w) | ||
| 3136 | && WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w)) | ||
| 3137 | || (WINDOW_RIGHTMOST_P (w) | ||
| 3138 | && WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))) | ||
| 3139 | { | ||
| 3140 | int sb_width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w); | ||
| 3141 | |||
| 3142 | if (sb_width > 0) | ||
| 3143 | { | ||
| 3144 | int bar_area_x = WINDOW_SCROLL_BAR_AREA_X (w); | ||
| 3145 | int bar_area_width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w); | ||
| 3146 | |||
| 3147 | if (bar_area_x + bar_area_width == x) | ||
| 3148 | { | ||
| 3149 | x = bar_area_x + sb_width; | ||
| 3150 | width += bar_area_width - sb_width; | ||
| 3151 | } | ||
| 3152 | else if (x + width == bar_area_x) | ||
| 3153 | width += bar_area_width - sb_width; | ||
| 3154 | } | ||
| 3155 | } | ||
| 3156 | #endif | ||
| 3157 | |||
| 3158 | from_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->current_y); | 3083 | from_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->current_y); |
| 3159 | to_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->desired_y); | 3084 | to_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->desired_y); |
| 3160 | bottom_y = y + height; | 3085 | bottom_y = y + height; |
| @@ -4991,7 +4916,6 @@ x_scroll_bar_create (struct window *w, int top, int left, int width, int height) | |||
| 4991 | bar->start = 0; | 4916 | bar->start = 0; |
| 4992 | bar->end = 0; | 4917 | bar->end = 0; |
| 4993 | bar->dragging = -1; | 4918 | bar->dragging = -1; |
| 4994 | bar->fringe_extended_p = 0; | ||
| 4995 | #if defined (USE_TOOLKIT_SCROLL_BARS) && defined (USE_LUCID) | 4919 | #if defined (USE_TOOLKIT_SCROLL_BARS) && defined (USE_LUCID) |
| 4996 | bar->last_seen_part = scroll_bar_nowhere; | 4920 | bar->last_seen_part = scroll_bar_nowhere; |
| 4997 | #endif | 4921 | #endif |
| @@ -5167,44 +5091,17 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio | |||
| 5167 | struct frame *f = XFRAME (w->frame); | 5091 | struct frame *f = XFRAME (w->frame); |
| 5168 | Lisp_Object barobj; | 5092 | Lisp_Object barobj; |
| 5169 | struct scroll_bar *bar; | 5093 | struct scroll_bar *bar; |
| 5170 | int top, height, left, sb_left, width, sb_width; | 5094 | int top, height, left, width; |
| 5171 | int window_y, window_height; | 5095 | int window_y, window_height; |
| 5172 | #ifdef USE_TOOLKIT_SCROLL_BARS | ||
| 5173 | bool fringe_extended_p; | ||
| 5174 | #endif | ||
| 5175 | 5096 | ||
| 5176 | /* Get window dimensions. */ | 5097 | /* Get window dimensions. */ |
| 5177 | window_box (w, ANY_AREA, 0, &window_y, 0, &window_height); | 5098 | window_box (w, ANY_AREA, 0, &window_y, 0, &window_height); |
| 5178 | top = window_y; | 5099 | top = window_y; |
| 5179 | width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w); | ||
| 5180 | height = window_height; | 5100 | height = window_height; |
| 5181 | 5101 | ||
| 5182 | /* Compute the left edge of the scroll bar area. */ | 5102 | /* Compute the left edge and the width of the scroll bar area. */ |
| 5183 | left = WINDOW_SCROLL_BAR_AREA_X (w); | 5103 | left = WINDOW_SCROLL_BAR_AREA_X (w); |
| 5184 | 5104 | width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w); | |
| 5185 | /* Compute the width of the scroll bar which might be less than | ||
| 5186 | the width of the area reserved for the scroll bar. */ | ||
| 5187 | if (WINDOW_CONFIG_SCROLL_BAR_WIDTH (w) > 0) | ||
| 5188 | sb_width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w); | ||
| 5189 | else | ||
| 5190 | sb_width = width; | ||
| 5191 | |||
| 5192 | /* Compute the left edge of the scroll bar. */ | ||
| 5193 | #ifdef USE_TOOLKIT_SCROLL_BARS | ||
| 5194 | if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)) | ||
| 5195 | sb_left = left + (WINDOW_RIGHTMOST_P (w) ? width - sb_width : 0); | ||
| 5196 | else | ||
| 5197 | sb_left = left + (WINDOW_LEFTMOST_P (w) ? 0 : width - sb_width); | ||
| 5198 | #else | ||
| 5199 | if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)) | ||
| 5200 | sb_left = left + width - sb_width; | ||
| 5201 | else | ||
| 5202 | sb_left = left; | ||
| 5203 | #endif | ||
| 5204 | |||
| 5205 | #ifdef USE_TOOLKIT_SCROLL_BARS | ||
| 5206 | fringe_extended_p = WINDOW_FRINGE_EXTENDED_P (w); | ||
| 5207 | #endif | ||
| 5208 | 5105 | ||
| 5209 | /* Does the scroll bar exist yet? */ | 5106 | /* Does the scroll bar exist yet? */ |
| 5210 | if (NILP (w->vertical_scroll_bar)) | 5107 | if (NILP (w->vertical_scroll_bar)) |
| @@ -5212,18 +5109,12 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio | |||
| 5212 | if (width > 0 && height > 0) | 5109 | if (width > 0 && height > 0) |
| 5213 | { | 5110 | { |
| 5214 | block_input (); | 5111 | block_input (); |
| 5215 | #ifdef USE_TOOLKIT_SCROLL_BARS | 5112 | x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
| 5216 | if (fringe_extended_p) | 5113 | left, top, width, height); |
| 5217 | x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | ||
| 5218 | sb_left, top, sb_width, height); | ||
| 5219 | else | ||
| 5220 | #endif | ||
| 5221 | x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | ||
| 5222 | left, top, width, height); | ||
| 5223 | unblock_input (); | 5114 | unblock_input (); |
| 5224 | } | 5115 | } |
| 5225 | 5116 | ||
| 5226 | bar = x_scroll_bar_create (w, top, sb_left, sb_width, max (height, 1)); | 5117 | bar = x_scroll_bar_create (w, top, left, width, max (height, 1)); |
| 5227 | } | 5118 | } |
| 5228 | else | 5119 | else |
| 5229 | { | 5120 | { |
| @@ -5234,11 +5125,11 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio | |||
| 5234 | 5125 | ||
| 5235 | block_input (); | 5126 | block_input (); |
| 5236 | 5127 | ||
| 5237 | if (sb_left != bar->left) | 5128 | if (left != bar->left) |
| 5238 | mask |= CWX; | 5129 | mask |= CWX; |
| 5239 | if (top != bar->top) | 5130 | if (top != bar->top) |
| 5240 | mask |= CWY; | 5131 | mask |= CWY; |
| 5241 | if (sb_width != bar->width) | 5132 | if (width != bar->width) |
| 5242 | mask |= CWWidth; | 5133 | mask |= CWWidth; |
| 5243 | if (height != bar->height) | 5134 | if (height != bar->height) |
| 5244 | mask |= CWHeight; | 5135 | mask |= CWHeight; |
| @@ -5246,55 +5137,31 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio | |||
| 5246 | #ifdef USE_TOOLKIT_SCROLL_BARS | 5137 | #ifdef USE_TOOLKIT_SCROLL_BARS |
| 5247 | 5138 | ||
| 5248 | /* Move/size the scroll bar widget. */ | 5139 | /* Move/size the scroll bar widget. */ |
| 5249 | if (mask || bar->fringe_extended_p != fringe_extended_p) | 5140 | if (mask) |
| 5250 | { | 5141 | { |
| 5251 | /* Since toolkit scroll bars are smaller than the space reserved | 5142 | /* Since toolkit scroll bars are smaller than the space reserved |
| 5252 | for them on the frame, we have to clear "under" them. */ | 5143 | for them on the frame, we have to clear "under" them. */ |
| 5253 | if (width > 0 && height > 0) | 5144 | if (width > 0 && height > 0) |
| 5254 | { | 5145 | x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
| 5255 | if (fringe_extended_p) | 5146 | left, top, width, height); |
| 5256 | x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | ||
| 5257 | sb_left, top, sb_width, height); | ||
| 5258 | else | ||
| 5259 | x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | ||
| 5260 | left, top, width, height); | ||
| 5261 | } | ||
| 5262 | #ifdef USE_GTK | 5147 | #ifdef USE_GTK |
| 5263 | xg_update_scrollbar_pos (f, bar->x_window, top, | 5148 | xg_update_scrollbar_pos (f, bar->x_window, top, |
| 5264 | sb_left, sb_width, max (height, 1)); | 5149 | left, width, max (height, 1)); |
| 5265 | #else /* not USE_GTK */ | 5150 | #else /* not USE_GTK */ |
| 5266 | XtConfigureWidget (SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar), | 5151 | XtConfigureWidget (SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar), |
| 5267 | sb_left, top, sb_width, max (height, 1), 0); | 5152 | left, top, width, max (height, 1), 0); |
| 5268 | #endif /* not USE_GTK */ | 5153 | #endif /* not USE_GTK */ |
| 5269 | } | 5154 | } |
| 5270 | #else /* not USE_TOOLKIT_SCROLL_BARS */ | 5155 | #else /* not USE_TOOLKIT_SCROLL_BARS */ |
| 5271 | 5156 | ||
| 5272 | /* Clear areas not covered by the scroll bar because it's not as | ||
| 5273 | wide as the area reserved for it. This makes sure a | ||
| 5274 | previous mode line display is cleared after C-x 2 C-x 1, for | ||
| 5275 | example. */ | ||
| 5276 | { | ||
| 5277 | int area_width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w); | ||
| 5278 | int rest = area_width - sb_width; | ||
| 5279 | if (rest > 0 && height > 0) | ||
| 5280 | { | ||
| 5281 | if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w)) | ||
| 5282 | x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | ||
| 5283 | left + area_width - rest, top, rest, height); | ||
| 5284 | else | ||
| 5285 | x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | ||
| 5286 | left, top, rest, height); | ||
| 5287 | } | ||
| 5288 | } | ||
| 5289 | |||
| 5290 | /* Move/size the scroll bar window. */ | 5157 | /* Move/size the scroll bar window. */ |
| 5291 | if (mask) | 5158 | if (mask) |
| 5292 | { | 5159 | { |
| 5293 | XWindowChanges wc; | 5160 | XWindowChanges wc; |
| 5294 | 5161 | ||
| 5295 | wc.x = sb_left; | 5162 | wc.x = left; |
| 5296 | wc.y = top; | 5163 | wc.y = top; |
| 5297 | wc.width = sb_width; | 5164 | wc.width = width; |
| 5298 | wc.height = height; | 5165 | wc.height = height; |
| 5299 | XConfigureWindow (FRAME_X_DISPLAY (f), bar->x_window, | 5166 | XConfigureWindow (FRAME_X_DISPLAY (f), bar->x_window, |
| 5300 | mask, &wc); | 5167 | mask, &wc); |
| @@ -5303,17 +5170,15 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio | |||
| 5303 | #endif /* not USE_TOOLKIT_SCROLL_BARS */ | 5170 | #endif /* not USE_TOOLKIT_SCROLL_BARS */ |
| 5304 | 5171 | ||
| 5305 | /* Remember new settings. */ | 5172 | /* Remember new settings. */ |
| 5306 | bar->left = sb_left; | 5173 | bar->left = left; |
| 5307 | bar->top = top; | 5174 | bar->top = top; |
| 5308 | bar->width = sb_width; | 5175 | bar->width = width; |
| 5309 | bar->height = height; | 5176 | bar->height = height; |
| 5310 | 5177 | ||
| 5311 | unblock_input (); | 5178 | unblock_input (); |
| 5312 | } | 5179 | } |
| 5313 | 5180 | ||
| 5314 | #ifdef USE_TOOLKIT_SCROLL_BARS | 5181 | #ifdef USE_TOOLKIT_SCROLL_BARS |
| 5315 | bar->fringe_extended_p = fringe_extended_p; | ||
| 5316 | |||
| 5317 | x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole); | 5182 | x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole); |
| 5318 | #else /* not USE_TOOLKIT_SCROLL_BARS */ | 5183 | #else /* not USE_TOOLKIT_SCROLL_BARS */ |
| 5319 | /* Set the scroll bar's current state, unless we're currently being | 5184 | /* Set the scroll bar's current state, unless we're currently being |
diff --git a/src/xterm.h b/src/xterm.h index 88a0ae787aa..f67b79c3068 100644 --- a/src/xterm.h +++ b/src/xterm.h | |||
| @@ -812,10 +812,6 @@ struct scroll_bar | |||
| 812 | /* Last scroll bar part seen in xaw_jump_callback and xaw_scroll_callback. */ | 812 | /* Last scroll bar part seen in xaw_jump_callback and xaw_scroll_callback. */ |
| 813 | enum scroll_bar_part last_seen_part; | 813 | enum scroll_bar_part last_seen_part; |
| 814 | #endif | 814 | #endif |
| 815 | |||
| 816 | /* 1 if the background of the fringe that is adjacent to a scroll | ||
| 817 | bar is extended to the gap between the fringe and the bar. */ | ||
| 818 | unsigned fringe_extended_p : 1; | ||
| 819 | }; | 815 | }; |
| 820 | 816 | ||
| 821 | /* Turning a lisp vector value into a pointer to a struct scroll_bar. */ | 817 | /* Turning a lisp vector value into a pointer to a struct scroll_bar. */ |