diff options
| -rw-r--r-- | src/ChangeLog | 11 | ||||
| -rw-r--r-- | src/w32term.c | 133 | ||||
| -rw-r--r-- | src/w32term.h | 6 |
3 files changed, 27 insertions, 123 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index dbb77ae1646..ecde9e1ddea 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | 2013-12-21 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 2 | |||
| 3 | * w32term.h (struct scroll_bar): Remove member `fringe_extended_p'. | ||
| 4 | |||
| 5 | * w32term.c (w32_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-20 Martin Rudalics <rudalics@gmx.at> | 12 | 2013-12-20 Martin Rudalics <rudalics@gmx.at> |
| 2 | 13 | ||
| 3 | Remove scroll_bar_actual_width from frames. | 14 | Remove scroll_bar_actual_width from frames. |
diff --git a/src/w32term.c b/src/w32term.c index a39ab37768c..583e0ebaf31 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -792,62 +792,13 @@ w32_draw_fringe_bitmap (struct window *w, struct glyph_row *row, | |||
| 792 | 792 | ||
| 793 | hdc = get_frame_dc (f); | 793 | hdc = get_frame_dc (f); |
| 794 | 794 | ||
| 795 | if (!p->overlay_p) | ||
| 796 | { | ||
| 797 | int bx = p->bx, by = p->by, nx = p->nx, ny = p->ny; | ||
| 798 | |||
| 799 | /* If the fringe is adjacent to the left (right) scroll bar of a | ||
| 800 | leftmost (rightmost, respectively) window, then extend its | ||
| 801 | background to the gap between the fringe and the bar. */ | ||
| 802 | if ((WINDOW_LEFTMOST_P (w) | ||
| 803 | && WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w)) | ||
| 804 | || (WINDOW_RIGHTMOST_P (w) | ||
| 805 | && WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))) | ||
| 806 | { | ||
| 807 | int sb_width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w); | ||
| 808 | |||
| 809 | if (sb_width > 0) | ||
| 810 | { | ||
| 811 | int bar_area_x = WINDOW_SCROLL_BAR_AREA_X (w); | ||
| 812 | int bar_area_width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w); | ||
| 813 | |||
| 814 | if (bx < 0) | ||
| 815 | { | ||
| 816 | /* Bitmap fills the fringe. */ | ||
| 817 | if (bar_area_x + bar_area_width == p->x) | ||
| 818 | bx = bar_area_x + sb_width; | ||
| 819 | else if (p->x + p->wd == bar_area_x) | ||
| 820 | bx = bar_area_x; | ||
| 821 | if (bx >= 0) | ||
| 822 | { | ||
| 823 | int header_line_height = WINDOW_HEADER_LINE_HEIGHT (w); | ||
| 824 | |||
| 825 | nx = bar_area_width - sb_width; | ||
| 826 | by = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, | ||
| 827 | row->y)); | ||
| 828 | ny = row->visible_height; | ||
| 829 | } | ||
| 830 | } | ||
| 831 | else | ||
| 832 | { | ||
| 833 | if (bar_area_x + bar_area_width == bx) | ||
| 834 | { | ||
| 835 | bx = bar_area_x + sb_width; | ||
| 836 | nx += bar_area_width - sb_width; | ||
| 837 | } | ||
| 838 | else if (bx + nx == bar_area_x) | ||
| 839 | nx += bar_area_width - sb_width; | ||
| 840 | } | ||
| 841 | } | ||
| 842 | } | ||
| 843 | |||
| 844 | if (bx >= 0 && nx > 0) | ||
| 845 | w32_fill_area (f, hdc, face->background, bx, by, nx, ny); | ||
| 846 | } | ||
| 847 | |||
| 848 | /* Must clip because of partially visible lines. */ | 795 | /* Must clip because of partially visible lines. */ |
| 849 | w32_clip_to_row (w, row, ANY_AREA, hdc); | 796 | w32_clip_to_row (w, row, ANY_AREA, hdc); |
| 850 | 797 | ||
| 798 | if (p->bx >= 0 && !p->overlay_p) | ||
| 799 | w32_fill_area (f, hdc, face->background, | ||
| 800 | p->bx, p->by, p->nx, p->ny); | ||
| 801 | |||
| 851 | if (p->which && p->which < max_fringe_bmp) | 802 | if (p->which && p->which < max_fringe_bmp) |
| 852 | { | 803 | { |
| 853 | HBITMAP pixmap = fringe_bmp[p->which]; | 804 | HBITMAP pixmap = fringe_bmp[p->which]; |
| @@ -2693,31 +2644,6 @@ x_scroll_run (struct window *w, struct run *run) | |||
| 2693 | fringes of W. */ | 2644 | fringes of W. */ |
| 2694 | window_box (w, ANY_AREA, &x, &y, &width, &height); | 2645 | window_box (w, ANY_AREA, &x, &y, &width, &height); |
| 2695 | 2646 | ||
| 2696 | /* If the fringe is adjacent to the left (right) scroll bar of a | ||
| 2697 | leftmost (rightmost, respectively) window, then extend its | ||
| 2698 | background to the gap between the fringe and the bar. */ | ||
| 2699 | if ((WINDOW_LEFTMOST_P (w) | ||
| 2700 | && WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w)) | ||
| 2701 | || (WINDOW_RIGHTMOST_P (w) | ||
| 2702 | && WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))) | ||
| 2703 | { | ||
| 2704 | int sb_width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w); | ||
| 2705 | |||
| 2706 | if (sb_width > 0) | ||
| 2707 | { | ||
| 2708 | int bar_area_x = WINDOW_SCROLL_BAR_AREA_X (w); | ||
| 2709 | int bar_area_width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w); | ||
| 2710 | |||
| 2711 | if (bar_area_x + bar_area_width == x) | ||
| 2712 | { | ||
| 2713 | x = bar_area_x + sb_width; | ||
| 2714 | width += bar_area_width - sb_width; | ||
| 2715 | } | ||
| 2716 | else if (x + width == bar_area_x) | ||
| 2717 | width += bar_area_width - sb_width; | ||
| 2718 | } | ||
| 2719 | } | ||
| 2720 | |||
| 2721 | from_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->current_y); | 2647 | from_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->current_y); |
| 2722 | to_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->desired_y); | 2648 | to_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->desired_y); |
| 2723 | bottom_y = y + height; | 2649 | bottom_y = y + height; |
| @@ -3719,7 +3645,6 @@ x_scroll_bar_create (struct window *w, int top, int left, int width, int height) | |||
| 3719 | bar->start = 0; | 3645 | bar->start = 0; |
| 3720 | bar->end = 0; | 3646 | bar->end = 0; |
| 3721 | bar->dragging = 0; | 3647 | bar->dragging = 0; |
| 3722 | bar->fringe_extended_p = 0; | ||
| 3723 | 3648 | ||
| 3724 | /* Requires geometry to be set before call to create the real window */ | 3649 | /* Requires geometry to be set before call to create the real window */ |
| 3725 | 3650 | ||
| @@ -3781,33 +3706,17 @@ w32_set_vertical_scroll_bar (struct window *w, | |||
| 3781 | struct frame *f = XFRAME (w->frame); | 3706 | struct frame *f = XFRAME (w->frame); |
| 3782 | Lisp_Object barobj; | 3707 | Lisp_Object barobj; |
| 3783 | struct scroll_bar *bar; | 3708 | struct scroll_bar *bar; |
| 3784 | int top, height, left, sb_left, width, sb_width; | 3709 | int top, height, left, width; |
| 3785 | int window_y, window_height; | 3710 | int window_y, window_height; |
| 3786 | bool fringe_extended_p; | ||
| 3787 | 3711 | ||
| 3788 | /* Get window dimensions. */ | 3712 | /* Get window dimensions. */ |
| 3789 | window_box (w, ANY_AREA, 0, &window_y, 0, &window_height); | 3713 | window_box (w, ANY_AREA, 0, &window_y, 0, &window_height); |
| 3790 | top = window_y; | 3714 | top = window_y; |
| 3791 | width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w); | ||
| 3792 | height = window_height; | 3715 | height = window_height; |
| 3793 | 3716 | ||
| 3794 | /* Compute the left edge of the scroll bar area. */ | 3717 | /* Compute the left edge and the width of the scroll bar area. */ |
| 3795 | left = WINDOW_SCROLL_BAR_AREA_X (w); | 3718 | left = WINDOW_SCROLL_BAR_AREA_X (w); |
| 3796 | 3719 | width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w); | |
| 3797 | /* Compute the width of the scroll bar which might be less than | ||
| 3798 | the width of the area reserved for the scroll bar. */ | ||
| 3799 | if (WINDOW_CONFIG_SCROLL_BAR_WIDTH (w) > 0) | ||
| 3800 | sb_width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w); | ||
| 3801 | else | ||
| 3802 | sb_width = width; | ||
| 3803 | |||
| 3804 | /* Compute the left edge of the scroll bar. */ | ||
| 3805 | if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)) | ||
| 3806 | sb_left = left + (WINDOW_RIGHTMOST_P (w) ? width - sb_width : 0); | ||
| 3807 | else | ||
| 3808 | sb_left = left + (WINDOW_LEFTMOST_P (w) ? 0 : width - sb_width); | ||
| 3809 | |||
| 3810 | fringe_extended_p = WINDOW_FRINGE_EXTENDED_P (w); | ||
| 3811 | 3720 | ||
| 3812 | /* Does the scroll bar exist yet? */ | 3721 | /* Does the scroll bar exist yet? */ |
| 3813 | if (NILP (w->vertical_scroll_bar)) | 3722 | if (NILP (w->vertical_scroll_bar)) |
| @@ -3817,15 +3726,12 @@ w32_set_vertical_scroll_bar (struct window *w, | |||
| 3817 | if (width > 0 && height > 0) | 3726 | if (width > 0 && height > 0) |
| 3818 | { | 3727 | { |
| 3819 | hdc = get_frame_dc (f); | 3728 | hdc = get_frame_dc (f); |
| 3820 | if (fringe_extended_p) | 3729 | w32_clear_area (f, hdc, left, top, width, height); |
| 3821 | w32_clear_area (f, hdc, sb_left, top, sb_width, height); | ||
| 3822 | else | ||
| 3823 | w32_clear_area (f, hdc, left, top, width, height); | ||
| 3824 | release_frame_dc (f, hdc); | 3730 | release_frame_dc (f, hdc); |
| 3825 | } | 3731 | } |
| 3826 | unblock_input (); | 3732 | unblock_input (); |
| 3827 | 3733 | ||
| 3828 | bar = x_scroll_bar_create (w, top, sb_left, sb_width, height); | 3734 | bar = x_scroll_bar_create (w, top, left, width, height); |
| 3829 | } | 3735 | } |
| 3830 | else | 3736 | else |
| 3831 | { | 3737 | { |
| @@ -3836,11 +3742,10 @@ w32_set_vertical_scroll_bar (struct window *w, | |||
| 3836 | hwnd = SCROLL_BAR_W32_WINDOW (bar); | 3742 | hwnd = SCROLL_BAR_W32_WINDOW (bar); |
| 3837 | 3743 | ||
| 3838 | /* If already correctly positioned, do nothing. */ | 3744 | /* If already correctly positioned, do nothing. */ |
| 3839 | if (bar->left == sb_left | 3745 | if (bar->left == left |
| 3840 | && bar->top == top | 3746 | && bar->top == top |
| 3841 | && bar->width == sb_width | 3747 | && bar->width == width |
| 3842 | && bar->height == height | 3748 | && bar->height == height) |
| 3843 | && bar->fringe_extended_p == fringe_extended_p) | ||
| 3844 | { | 3749 | { |
| 3845 | /* Redraw after clear_frame. */ | 3750 | /* Redraw after clear_frame. */ |
| 3846 | if (!my_show_window (f, hwnd, SW_NORMAL)) | 3751 | if (!my_show_window (f, hwnd, SW_NORMAL)) |
| @@ -3857,17 +3762,13 @@ w32_set_vertical_scroll_bar (struct window *w, | |||
| 3857 | hdc = get_frame_dc (f); | 3762 | hdc = get_frame_dc (f); |
| 3858 | /* Since Windows scroll bars are smaller than the space reserved | 3763 | /* Since Windows scroll bars are smaller than the space reserved |
| 3859 | for them on the frame, we have to clear "under" them. */ | 3764 | for them on the frame, we have to clear "under" them. */ |
| 3860 | if (fringe_extended_p) | 3765 | w32_clear_area (f, hdc, left, top, width, height); |
| 3861 | w32_clear_area (f, hdc, sb_left, top, sb_width, height); | ||
| 3862 | else | ||
| 3863 | w32_clear_area (f, hdc, left, top, width, height); | ||
| 3864 | release_frame_dc (f, hdc); | 3766 | release_frame_dc (f, hdc); |
| 3865 | } | 3767 | } |
| 3866 | /* Make sure scroll bar is "visible" before moving, to ensure the | 3768 | /* Make sure scroll bar is "visible" before moving, to ensure the |
| 3867 | area of the parent window now exposed will be refreshed. */ | 3769 | area of the parent window now exposed will be refreshed. */ |
| 3868 | my_show_window (f, hwnd, SW_HIDE); | 3770 | my_show_window (f, hwnd, SW_HIDE); |
| 3869 | MoveWindow (hwnd, sb_left, top, sb_width, | 3771 | MoveWindow (hwnd, left, top, width, max (height, 1), TRUE); |
| 3870 | max (height, 1), TRUE); | ||
| 3871 | 3772 | ||
| 3872 | si.cbSize = sizeof (si); | 3773 | si.cbSize = sizeof (si); |
| 3873 | si.fMask = SIF_RANGE; | 3774 | si.fMask = SIF_RANGE; |
| @@ -3881,16 +3782,14 @@ w32_set_vertical_scroll_bar (struct window *w, | |||
| 3881 | /* InvalidateRect (w, NULL, FALSE); */ | 3782 | /* InvalidateRect (w, NULL, FALSE); */ |
| 3882 | 3783 | ||
| 3883 | /* Remember new settings. */ | 3784 | /* Remember new settings. */ |
| 3884 | bar->left = sb_left; | 3785 | bar->left = left; |
| 3885 | bar->top = top; | 3786 | bar->top = top; |
| 3886 | bar->width = sb_width; | 3787 | bar->width = width; |
| 3887 | bar->height = height; | 3788 | bar->height = height; |
| 3888 | 3789 | ||
| 3889 | unblock_input (); | 3790 | unblock_input (); |
| 3890 | } | 3791 | } |
| 3891 | } | 3792 | } |
| 3892 | bar->fringe_extended_p = fringe_extended_p; | ||
| 3893 | |||
| 3894 | w32_set_scroll_bar_thumb (bar, portion, position, whole); | 3793 | w32_set_scroll_bar_thumb (bar, portion, position, whole); |
| 3895 | XSETVECTOR (barobj, bar); | 3794 | XSETVECTOR (barobj, bar); |
| 3896 | wset_vertical_scroll_bar (w, barobj); | 3795 | wset_vertical_scroll_bar (w, barobj); |
diff --git a/src/w32term.h b/src/w32term.h index b8a1823d7b0..0372bb1e970 100644 --- a/src/w32term.h +++ b/src/w32term.h | |||
| @@ -449,12 +449,6 @@ struct scroll_bar { | |||
| 449 | place where the user grabbed it. If the handle isn't currently | 449 | place where the user grabbed it. If the handle isn't currently |
| 450 | being dragged, this is Qnil. */ | 450 | being dragged, this is Qnil. */ |
| 451 | int dragging; | 451 | int dragging; |
| 452 | |||
| 453 | /* 1 if the background of the fringe that is adjacent to a scroll | ||
| 454 | bar is extended to the gap between the fringe and the bar. */ | ||
| 455 | /* Note: this could be a bit field, but we need to take its address | ||
| 456 | in ALLOCATE_PSEUDOVECTOR (see x_scroll_bar_create). */ | ||
| 457 | bool fringe_extended_p; | ||
| 458 | }; | 452 | }; |
| 459 | 453 | ||
| 460 | /* Turning a lisp vector value into a pointer to a struct scroll_bar. */ | 454 | /* Turning a lisp vector value into a pointer to a struct scroll_bar. */ |