comparison src/w32term.c @ 90998:539530fa389c

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 832-838) - Remove lisp/erc/erc-nicklist.el - Update some .arch-inventory files - Fix void function definition error in cus-edit.el - Update from CVS - Restore lisp/emacs-lisp/cl-loaddefs.el - Merge from emacs--rel--22 * emacs--rel--22 (patch 75-83) - Update from CVS - Remove lisp/erc/erc-nicklist.el - Update some .arch-inventory files - Indicate that emacs--devo--0--patch-834 does not need to be applied - Merge from gnus--rel--5.10 - Restore lisp/emacs-lisp/cl-loaddefs.el * gnus--rel--5.10 (patch 239-241) - Merge from emacs--devo--0 - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-239
author Miles Bader <miles@gnu.org>
date Fri, 03 Aug 2007 05:20:51 +0000
parents f55f9811f5d7 e0ebebf01b6d
children 424b655804ca
comparison
equal deleted inserted replaced
90997:12fc8f96710b 90998:539530fa389c
711 struct face *face = p->face; 711 struct face *face = p->face;
712 int rowY; 712 int rowY;
713 713
714 hdc = get_frame_dc (f); 714 hdc = get_frame_dc (f);
715 715
716 if (!p->overlay_p)
717 {
718 int bx = p->bx, by = p->by, nx = p->nx, ny = p->ny;
719
720 /* If the fringe is adjacent to the left (right) scroll bar of a
721 leftmost (rightmost, respectively) window, then extend its
722 background to the gap between the fringe and the bar. */
723 if ((WINDOW_LEFTMOST_P (w)
724 && WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w))
725 || (WINDOW_RIGHTMOST_P (w)
726 && WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)))
727 {
728 int sb_width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w);
729
730 if (sb_width > 0)
731 {
732 int left = WINDOW_SCROLL_BAR_AREA_X (w);
733 int width = (WINDOW_CONFIG_SCROLL_BAR_COLS (w)
734 * FRAME_COLUMN_WIDTH (f));
735
736 if (bx < 0)
737 {
738 /* Bitmap fills the fringe. */
739 if (left + width == p->x)
740 bx = left + sb_width;
741 else if (p->x + p->wd == left)
742 bx = left;
743 if (bx >= 0)
744 {
745 int header_line_height = WINDOW_HEADER_LINE_HEIGHT (w);
746
747 nx = width - sb_width;
748 by = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height,
749 row->y));
750 ny = row->visible_height;
751 }
752 }
753 else
754 {
755 if (left + width == bx)
756 {
757 bx = left + sb_width;
758 nx += width - sb_width;
759 }
760 else if (bx + nx == left)
761 nx += width - sb_width;
762 }
763 }
764 }
765
766 if (bx >= 0 && nx > 0)
767 w32_fill_area (f, hdc, face->background, bx, by, nx, ny);
768 }
769
716 /* Must clip because of partially visible lines. */ 770 /* Must clip because of partially visible lines. */
717 rowY = WINDOW_TO_FRAME_PIXEL_Y (w, row->y); 771 rowY = WINDOW_TO_FRAME_PIXEL_Y (w, row->y);
718 if (p->y < rowY) 772 if (p->y < rowY)
719 { 773 {
720 /* Adjust position of "bottom aligned" bitmap on partially 774 /* Adjust position of "bottom aligned" bitmap on partially
727 row->y = oldY; 781 row->y = oldY;
728 row->visible_height = oldVH; 782 row->visible_height = oldVH;
729 } 783 }
730 else 784 else
731 w32_clip_to_row (w, row, -1, hdc); 785 w32_clip_to_row (w, row, -1, hdc);
732
733 if (p->bx >= 0 && !p->overlay_p)
734 {
735 w32_fill_area (f, hdc, face->background,
736 p->bx, p->by, p->nx, p->ny);
737 }
738 786
739 if (p->which && p->which < max_fringe_bmp) 787 if (p->which && p->which < max_fringe_bmp)
740 { 788 {
741 HBITMAP pixmap = fringe_bmp[p->which]; 789 HBITMAP pixmap = fringe_bmp[p->which];
742 HDC compat_hdc; 790 HDC compat_hdc;
4070 XSETINT (bar->width, width); 4118 XSETINT (bar->width, width);
4071 XSETINT (bar->height, height); 4119 XSETINT (bar->height, height);
4072 XSETINT (bar->start, 0); 4120 XSETINT (bar->start, 0);
4073 XSETINT (bar->end, 0); 4121 XSETINT (bar->end, 0);
4074 bar->dragging = Qnil; 4122 bar->dragging = Qnil;
4123 bar->fringe_extended_p = Qnil;
4075 4124
4076 /* Requires geometry to be set before call to create the real window */ 4125 /* Requires geometry to be set before call to create the real window */
4077 4126
4078 hwnd = my_create_scrollbar (f, bar); 4127 hwnd = my_create_scrollbar (f, bar);
4079 4128
4133 { 4182 {
4134 struct frame *f = XFRAME (w->frame); 4183 struct frame *f = XFRAME (w->frame);
4135 struct scroll_bar *bar; 4184 struct scroll_bar *bar;
4136 int top, height, left, sb_left, width, sb_width; 4185 int top, height, left, sb_left, width, sb_width;
4137 int window_y, window_height; 4186 int window_y, window_height;
4187 int fringe_extended_p;
4138 4188
4139 /* Get window dimensions. */ 4189 /* Get window dimensions. */
4140 window_box (w, -1, 0, &window_y, 0, &window_height); 4190 window_box (w, -1, 0, &window_y, 0, &window_height);
4141 top = window_y; 4191 top = window_y;
4142 width = WINDOW_CONFIG_SCROLL_BAR_COLS (w) * FRAME_COLUMN_WIDTH (f); 4192 width = WINDOW_CONFIG_SCROLL_BAR_COLS (w) * FRAME_COLUMN_WIDTH (f);
4152 else 4202 else
4153 sb_width = width; 4203 sb_width = width;
4154 4204
4155 /* Compute the left edge of the scroll bar. */ 4205 /* Compute the left edge of the scroll bar. */
4156 if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)) 4206 if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))
4157 sb_left = left + width - sb_width - (width - sb_width) / 2; 4207 sb_left = left + (WINDOW_RIGHTMOST_P (w) ? width - sb_width : 0);
4158 else 4208 else
4159 sb_left = left + (width - sb_width) / 2; 4209 sb_left = left + (WINDOW_LEFTMOST_P (w) ? 0 : width - sb_width);
4210
4211 if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w))
4212 fringe_extended_p = (WINDOW_LEFTMOST_P (w)
4213 && WINDOW_LEFT_FRINGE_WIDTH (w)
4214 && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
4215 || WINDOW_LEFT_MARGIN_COLS (w) == 0));
4216 else
4217 fringe_extended_p = (WINDOW_RIGHTMOST_P (w)
4218 && WINDOW_RIGHT_FRINGE_WIDTH (w)
4219 && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
4220 || WINDOW_RIGHT_MARGIN_COLS (w) == 0));
4160 4221
4161 /* Does the scroll bar exist yet? */ 4222 /* Does the scroll bar exist yet? */
4162 if (NILP (w->vertical_scroll_bar)) 4223 if (NILP (w->vertical_scroll_bar))
4163 { 4224 {
4164 HDC hdc; 4225 HDC hdc;
4165 BLOCK_INPUT; 4226 BLOCK_INPUT;
4166 if (width > 0 && height > 0) 4227 if (width > 0 && height > 0)
4167 { 4228 {
4168 hdc = get_frame_dc (f); 4229 hdc = get_frame_dc (f);
4169 w32_clear_area (f, hdc, left, top, width, height); 4230 if (fringe_extended_p)
4231 w32_clear_area (f, hdc, sb_left, top, sb_width, height);
4232 else
4233 w32_clear_area (f, hdc, left, top, width, height);
4170 release_frame_dc (f, hdc); 4234 release_frame_dc (f, hdc);
4171 } 4235 }
4172 UNBLOCK_INPUT; 4236 UNBLOCK_INPUT;
4173 4237
4174 bar = x_scroll_bar_create (w, top, sb_left, sb_width, height); 4238 bar = x_scroll_bar_create (w, top, sb_left, sb_width, height);
4183 4247
4184 /* If already correctly positioned, do nothing. */ 4248 /* If already correctly positioned, do nothing. */
4185 if ( XINT (bar->left) == sb_left 4249 if ( XINT (bar->left) == sb_left
4186 && XINT (bar->top) == top 4250 && XINT (bar->top) == top
4187 && XINT (bar->width) == sb_width 4251 && XINT (bar->width) == sb_width
4188 && XINT (bar->height) == height ) 4252 && XINT (bar->height) == height
4253 && !NILP (bar->fringe_extended_p) == fringe_extended_p )
4189 { 4254 {
4190 /* Redraw after clear_frame. */ 4255 /* Redraw after clear_frame. */
4191 if (!my_show_window (f, hwnd, SW_NORMAL)) 4256 if (!my_show_window (f, hwnd, SW_NORMAL))
4192 InvalidateRect (hwnd, NULL, FALSE); 4257 InvalidateRect (hwnd, NULL, FALSE);
4193 } 4258 }
4200 if (width && height) 4265 if (width && height)
4201 { 4266 {
4202 hdc = get_frame_dc (f); 4267 hdc = get_frame_dc (f);
4203 /* Since Windows scroll bars are smaller than the space reserved 4268 /* Since Windows scroll bars are smaller than the space reserved
4204 for them on the frame, we have to clear "under" them. */ 4269 for them on the frame, we have to clear "under" them. */
4205 w32_clear_area (f, hdc, 4270 if (fringe_extended_p)
4206 left, 4271 w32_clear_area (f, hdc, sb_left, top, sb_width, height);
4207 top, 4272 else
4208 width, 4273 w32_clear_area (f, hdc, left, top, width, height);
4209 height);
4210 release_frame_dc (f, hdc); 4274 release_frame_dc (f, hdc);
4211 } 4275 }
4212 /* Make sure scroll bar is "visible" before moving, to ensure the 4276 /* Make sure scroll bar is "visible" before moving, to ensure the
4213 area of the parent window now exposed will be refreshed. */ 4277 area of the parent window now exposed will be refreshed. */
4214 my_show_window (f, hwnd, SW_HIDE); 4278 my_show_window (f, hwnd, SW_HIDE);
4234 XSETINT (bar->height, height); 4298 XSETINT (bar->height, height);
4235 4299
4236 UNBLOCK_INPUT; 4300 UNBLOCK_INPUT;
4237 } 4301 }
4238 } 4302 }
4303 bar->fringe_extended_p = fringe_extended_p ? Qt : Qnil;
4304
4239 w32_set_scroll_bar_thumb (bar, portion, position, whole); 4305 w32_set_scroll_bar_thumb (bar, portion, position, whole);
4240 4306
4241 XSETVECTOR (w->vertical_scroll_bar, bar); 4307 XSETVECTOR (w->vertical_scroll_bar, bar);
4242 } 4308 }
4243 4309