diff options
| author | YAMAMOTO Mitsuharu | 2007-07-27 08:40:30 +0000 |
|---|---|---|
| committer | YAMAMOTO Mitsuharu | 2007-07-27 08:40:30 +0000 |
| commit | 06929222cd586cc40e4d3230ee07d11e0f891bb6 (patch) | |
| tree | 1fdb0701902d6d495232e04fbdfd4c81a9ec4528 /src | |
| parent | 88ef48ffda3365e55cc7a424083052122540977a (diff) | |
| download | emacs-06929222cd586cc40e4d3230ee07d11e0f891bb6.tar.gz emacs-06929222cd586cc40e4d3230ee07d11e0f891bb6.zip | |
(w32_draw_fringe_bitmap): Extend fringe background to
scroll bar gap.
(x_scroll_bar_create): Set bar->fringe_extended_p.
(w32_set_vertical_scroll_bar): Put leftmost/rightmost scroll bars
on frame edge. Check fringe background extension. Don't clear
extended fringe background area.
Diffstat (limited to 'src')
| -rw-r--r-- | src/w32term.c | 96 |
1 files changed, 81 insertions, 15 deletions
diff --git a/src/w32term.c b/src/w32term.c index 129f52dcfe0..3cf9b839559 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -682,6 +682,60 @@ w32_draw_fringe_bitmap (w, row, p) | |||
| 682 | 682 | ||
| 683 | hdc = get_frame_dc (f); | 683 | hdc = get_frame_dc (f); |
| 684 | 684 | ||
| 685 | if (!p->overlay_p) | ||
| 686 | { | ||
| 687 | int bx = p->bx, by = p->by, nx = p->nx, ny = p->ny; | ||
| 688 | |||
| 689 | /* If the fringe is adjacent to the left (right) scroll bar of a | ||
| 690 | leftmost (rightmost, respectively) window, then extend its | ||
| 691 | background to the gap between the fringe and the bar. */ | ||
| 692 | if ((WINDOW_LEFTMOST_P (w) | ||
| 693 | && WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w)) | ||
| 694 | || (WINDOW_RIGHTMOST_P (w) | ||
| 695 | && WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))) | ||
| 696 | { | ||
| 697 | int sb_width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w); | ||
| 698 | |||
| 699 | if (sb_width > 0) | ||
| 700 | { | ||
| 701 | int left = WINDOW_SCROLL_BAR_AREA_X (w); | ||
| 702 | int width = (WINDOW_CONFIG_SCROLL_BAR_COLS (w) | ||
| 703 | * FRAME_COLUMN_WIDTH (f)); | ||
| 704 | |||
| 705 | if (bx < 0) | ||
| 706 | { | ||
| 707 | /* Bitmap fills the fringe. */ | ||
| 708 | if (left + width == p->x) | ||
| 709 | bx = left + sb_width; | ||
| 710 | else if (p->x + p->wd == left) | ||
| 711 | bx = left; | ||
| 712 | if (bx >= 0) | ||
| 713 | { | ||
| 714 | int header_line_height = WINDOW_HEADER_LINE_HEIGHT (w); | ||
| 715 | |||
| 716 | nx = width - sb_width; | ||
| 717 | by = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, | ||
| 718 | row->y)); | ||
| 719 | ny = row->visible_height; | ||
| 720 | } | ||
| 721 | } | ||
| 722 | else | ||
| 723 | { | ||
| 724 | if (left + width == bx) | ||
| 725 | { | ||
| 726 | bx = left + sb_width; | ||
| 727 | nx += width - sb_width; | ||
| 728 | } | ||
| 729 | else if (bx + nx == left) | ||
| 730 | nx += width - sb_width; | ||
| 731 | } | ||
| 732 | } | ||
| 733 | } | ||
| 734 | |||
| 735 | if (bx >= 0 && nx > 0) | ||
| 736 | w32_fill_area (f, hdc, face->background, bx, by, nx, ny); | ||
| 737 | } | ||
| 738 | |||
| 685 | /* Must clip because of partially visible lines. */ | 739 | /* Must clip because of partially visible lines. */ |
| 686 | rowY = WINDOW_TO_FRAME_PIXEL_Y (w, row->y); | 740 | rowY = WINDOW_TO_FRAME_PIXEL_Y (w, row->y); |
| 687 | if (p->y < rowY) | 741 | if (p->y < rowY) |
| @@ -699,12 +753,6 @@ w32_draw_fringe_bitmap (w, row, p) | |||
| 699 | else | 753 | else |
| 700 | w32_clip_to_row (w, row, -1, hdc); | 754 | w32_clip_to_row (w, row, -1, hdc); |
| 701 | 755 | ||
| 702 | if (p->bx >= 0 && !p->overlay_p) | ||
| 703 | { | ||
| 704 | w32_fill_area (f, hdc, face->background, | ||
| 705 | p->bx, p->by, p->nx, p->ny); | ||
| 706 | } | ||
| 707 | |||
| 708 | if (p->which && p->which < max_fringe_bmp) | 756 | if (p->which && p->which < max_fringe_bmp) |
| 709 | { | 757 | { |
| 710 | HBITMAP pixmap = fringe_bmp[p->which]; | 758 | HBITMAP pixmap = fringe_bmp[p->which]; |
| @@ -3637,6 +3685,7 @@ x_scroll_bar_create (w, top, left, width, height) | |||
| 3637 | XSETINT (bar->start, 0); | 3685 | XSETINT (bar->start, 0); |
| 3638 | XSETINT (bar->end, 0); | 3686 | XSETINT (bar->end, 0); |
| 3639 | bar->dragging = Qnil; | 3687 | bar->dragging = Qnil; |
| 3688 | bar->fringe_extended_p = Qnil; | ||
| 3640 | 3689 | ||
| 3641 | /* Requires geometry to be set before call to create the real window */ | 3690 | /* Requires geometry to be set before call to create the real window */ |
| 3642 | 3691 | ||
| @@ -3700,6 +3749,7 @@ w32_set_vertical_scroll_bar (w, portion, whole, position) | |||
| 3700 | struct scroll_bar *bar; | 3749 | struct scroll_bar *bar; |
| 3701 | int top, height, left, sb_left, width, sb_width; | 3750 | int top, height, left, sb_left, width, sb_width; |
| 3702 | int window_y, window_height; | 3751 | int window_y, window_height; |
| 3752 | int fringe_extended_p; | ||
| 3703 | 3753 | ||
| 3704 | /* Get window dimensions. */ | 3754 | /* Get window dimensions. */ |
| 3705 | window_box (w, -1, 0, &window_y, 0, &window_height); | 3755 | window_box (w, -1, 0, &window_y, 0, &window_height); |
| @@ -3719,9 +3769,20 @@ w32_set_vertical_scroll_bar (w, portion, whole, position) | |||
| 3719 | 3769 | ||
| 3720 | /* Compute the left edge of the scroll bar. */ | 3770 | /* Compute the left edge of the scroll bar. */ |
| 3721 | if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)) | 3771 | if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)) |
| 3722 | sb_left = left + width - sb_width - (width - sb_width) / 2; | 3772 | sb_left = left + (WINDOW_RIGHTMOST_P (w) ? width - sb_width : 0); |
| 3773 | else | ||
| 3774 | sb_left = left + (WINDOW_LEFTMOST_P (w) ? 0 : width - sb_width); | ||
| 3775 | |||
| 3776 | if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w)) | ||
| 3777 | fringe_extended_p = (WINDOW_LEFTMOST_P (w) | ||
| 3778 | && WINDOW_LEFT_FRINGE_WIDTH (w) | ||
| 3779 | && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) | ||
| 3780 | || WINDOW_LEFT_MARGIN_COLS (w) == 0)); | ||
| 3723 | else | 3781 | else |
| 3724 | sb_left = left + (width - sb_width) / 2; | 3782 | fringe_extended_p = (WINDOW_RIGHTMOST_P (w) |
| 3783 | && WINDOW_RIGHT_FRINGE_WIDTH (w) | ||
| 3784 | && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) | ||
| 3785 | || WINDOW_RIGHT_MARGIN_COLS (w) == 0)); | ||
| 3725 | 3786 | ||
| 3726 | /* Does the scroll bar exist yet? */ | 3787 | /* Does the scroll bar exist yet? */ |
| 3727 | if (NILP (w->vertical_scroll_bar)) | 3788 | if (NILP (w->vertical_scroll_bar)) |
| @@ -3731,7 +3792,10 @@ w32_set_vertical_scroll_bar (w, portion, whole, position) | |||
| 3731 | if (width > 0 && height > 0) | 3792 | if (width > 0 && height > 0) |
| 3732 | { | 3793 | { |
| 3733 | hdc = get_frame_dc (f); | 3794 | hdc = get_frame_dc (f); |
| 3734 | w32_clear_area (f, hdc, left, top, width, height); | 3795 | if (fringe_extended_p) |
| 3796 | w32_clear_area (f, hdc, sb_left, top, sb_width, height); | ||
| 3797 | else | ||
| 3798 | w32_clear_area (f, hdc, left, top, width, height); | ||
| 3735 | release_frame_dc (f, hdc); | 3799 | release_frame_dc (f, hdc); |
| 3736 | } | 3800 | } |
| 3737 | UNBLOCK_INPUT; | 3801 | UNBLOCK_INPUT; |
| @@ -3750,7 +3814,8 @@ w32_set_vertical_scroll_bar (w, portion, whole, position) | |||
| 3750 | if ( XINT (bar->left) == sb_left | 3814 | if ( XINT (bar->left) == sb_left |
| 3751 | && XINT (bar->top) == top | 3815 | && XINT (bar->top) == top |
| 3752 | && XINT (bar->width) == sb_width | 3816 | && XINT (bar->width) == sb_width |
| 3753 | && XINT (bar->height) == height ) | 3817 | && XINT (bar->height) == height |
| 3818 | && !NILP (bar->fringe_extended_p) == fringe_extended_p ) | ||
| 3754 | { | 3819 | { |
| 3755 | /* Redraw after clear_frame. */ | 3820 | /* Redraw after clear_frame. */ |
| 3756 | if (!my_show_window (f, hwnd, SW_NORMAL)) | 3821 | if (!my_show_window (f, hwnd, SW_NORMAL)) |
| @@ -3767,11 +3832,10 @@ w32_set_vertical_scroll_bar (w, portion, whole, position) | |||
| 3767 | hdc = get_frame_dc (f); | 3832 | hdc = get_frame_dc (f); |
| 3768 | /* Since Windows scroll bars are smaller than the space reserved | 3833 | /* Since Windows scroll bars are smaller than the space reserved |
| 3769 | for them on the frame, we have to clear "under" them. */ | 3834 | for them on the frame, we have to clear "under" them. */ |
| 3770 | w32_clear_area (f, hdc, | 3835 | if (fringe_extended_p) |
| 3771 | left, | 3836 | w32_clear_area (f, hdc, sb_left, top, sb_width, height); |
| 3772 | top, | 3837 | else |
| 3773 | width, | 3838 | w32_clear_area (f, hdc, left, top, width, height); |
| 3774 | height); | ||
| 3775 | release_frame_dc (f, hdc); | 3839 | release_frame_dc (f, hdc); |
| 3776 | } | 3840 | } |
| 3777 | /* Make sure scroll bar is "visible" before moving, to ensure the | 3841 | /* Make sure scroll bar is "visible" before moving, to ensure the |
| @@ -3801,6 +3865,8 @@ w32_set_vertical_scroll_bar (w, portion, whole, position) | |||
| 3801 | UNBLOCK_INPUT; | 3865 | UNBLOCK_INPUT; |
| 3802 | } | 3866 | } |
| 3803 | } | 3867 | } |
| 3868 | bar->fringe_extended_p = fringe_extended_p ? Qt : Qnil; | ||
| 3869 | |||
| 3804 | w32_set_scroll_bar_thumb (bar, portion, position, whole); | 3870 | w32_set_scroll_bar_thumb (bar, portion, position, whole); |
| 3805 | 3871 | ||
| 3806 | XSETVECTOR (w->vertical_scroll_bar, bar); | 3872 | XSETVECTOR (w->vertical_scroll_bar, bar); |