diff options
| author | Joakim Verona | 2011-10-15 23:07:46 +0200 |
|---|---|---|
| committer | Joakim Verona | 2011-10-15 23:07:46 +0200 |
| commit | 38ea27d5ef38b273942e90a095509883320d5c0b (patch) | |
| tree | 287f8e5419dd385ee5d2cdd24d694f1b2bb2179f /src/window.c | |
| parent | e1745b4659af41901c02b6320708c5497d9103f9 (diff) | |
| parent | 21fedf28e5c59fd17e846f4b8abcbb223ae5ed90 (diff) | |
| download | emacs-38ea27d5ef38b273942e90a095509883320d5c0b.tar.gz emacs-38ea27d5ef38b273942e90a095509883320d5c0b.zip | |
upstream
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 81 |
1 files changed, 30 insertions, 51 deletions
diff --git a/src/window.c b/src/window.c index 94b9f8a451f..7f4714ba17e 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -921,22 +921,45 @@ static enum window_part | |||
| 921 | coordinates_in_window (register struct window *w, int x, int y) | 921 | coordinates_in_window (register struct window *w, int x, int y) |
| 922 | { | 922 | { |
| 923 | struct frame *f = XFRAME (WINDOW_FRAME (w)); | 923 | struct frame *f = XFRAME (WINDOW_FRAME (w)); |
| 924 | int left_x, right_x; | ||
| 925 | enum window_part part; | 924 | enum window_part part; |
| 926 | int ux = FRAME_COLUMN_WIDTH (f); | 925 | int ux = FRAME_COLUMN_WIDTH (f); |
| 927 | int x0 = WINDOW_LEFT_EDGE_X (w); | 926 | int left_x = WINDOW_LEFT_EDGE_X (w); |
| 928 | int x1 = WINDOW_RIGHT_EDGE_X (w); | 927 | int right_x = WINDOW_RIGHT_EDGE_X (w); |
| 928 | int top_y = WINDOW_TOP_EDGE_Y (w); | ||
| 929 | int bottom_y = WINDOW_BOTTOM_EDGE_Y (w); | ||
| 929 | /* The width of the area where the vertical line can be dragged. | 930 | /* The width of the area where the vertical line can be dragged. |
| 930 | (Between mode lines for instance. */ | 931 | (Between mode lines for instance. */ |
| 931 | int grabbable_width = ux; | 932 | int grabbable_width = ux; |
| 932 | int lmargin_width, rmargin_width, text_left, text_right; | 933 | int lmargin_width, rmargin_width, text_left, text_right; |
| 933 | int top_y = WINDOW_TOP_EDGE_Y (w); | ||
| 934 | int bottom_y = WINDOW_BOTTOM_EDGE_Y (w); | ||
| 935 | 934 | ||
| 936 | /* Outside any interesting row? */ | 935 | /* Outside any interesting row or column? */ |
| 937 | if (y < top_y || y >= bottom_y) | 936 | if (y < top_y || y >= bottom_y || x < left_x || x >= right_x) |
| 938 | return ON_NOTHING; | 937 | return ON_NOTHING; |
| 939 | 938 | ||
| 939 | /* On the mode line or header line? */ | ||
| 940 | if ((WINDOW_WANTS_MODELINE_P (w) | ||
| 941 | && y >= bottom_y - CURRENT_MODE_LINE_HEIGHT (w) | ||
| 942 | && (part = ON_MODE_LINE)) | ||
| 943 | || (WINDOW_WANTS_HEADER_LINE_P (w) | ||
| 944 | && y < top_y + CURRENT_HEADER_LINE_HEIGHT (w) | ||
| 945 | && (part = ON_HEADER_LINE))) | ||
| 946 | { | ||
| 947 | /* If it's under/over the scroll bar portion of the mode/header | ||
| 948 | line, say it's on the vertical line. That's to be able to | ||
| 949 | resize windows horizontally in case we're using toolkit scroll | ||
| 950 | bars. Note: If scrollbars are on the left, the window that | ||
| 951 | must be eventually resized is that on the left of WINDOW. */ | ||
| 952 | if ((WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) | ||
| 953 | && !WINDOW_LEFTMOST_P (w) | ||
| 954 | && eabs (x - left_x) < grabbable_width) | ||
| 955 | || (!WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) | ||
| 956 | && !WINDOW_RIGHTMOST_P (w) | ||
| 957 | && eabs (x - right_x) < grabbable_width)) | ||
| 958 | return ON_VERTICAL_BORDER; | ||
| 959 | else | ||
| 960 | return part; | ||
| 961 | } | ||
| 962 | |||
| 940 | /* In what's below, we subtract 1 when computing right_x because we | 963 | /* In what's below, we subtract 1 when computing right_x because we |
| 941 | want the rightmost pixel, which is given by left_pixel+width-1. */ | 964 | want the rightmost pixel, which is given by left_pixel+width-1. */ |
| 942 | if (w->pseudo_window_p) | 965 | if (w->pseudo_window_p) |
| @@ -950,50 +973,6 @@ coordinates_in_window (register struct window *w, int x, int y) | |||
| 950 | right_x = WINDOW_BOX_RIGHT_EDGE_X (w) - 1; | 973 | right_x = WINDOW_BOX_RIGHT_EDGE_X (w) - 1; |
| 951 | } | 974 | } |
| 952 | 975 | ||
| 953 | /* On the mode line or header line? If it's near the start of | ||
| 954 | the mode or header line of window that's has a horizontal | ||
| 955 | sibling, say it's on the vertical line. That's to be able | ||
| 956 | to resize windows horizontally in case we're using toolkit | ||
| 957 | scroll bars. */ | ||
| 958 | |||
| 959 | if (WINDOW_WANTS_MODELINE_P (w) | ||
| 960 | && y >= bottom_y - CURRENT_MODE_LINE_HEIGHT (w)) | ||
| 961 | { | ||
| 962 | part = ON_MODE_LINE; | ||
| 963 | |||
| 964 | header_vertical_border_check: | ||
| 965 | /* We're somewhere on the mode line. We consider the place | ||
| 966 | between mode lines of horizontally adjacent mode lines | ||
| 967 | as the vertical border. If scroll bars on the left, | ||
| 968 | return the right window. */ | ||
| 969 | if ((WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) | ||
| 970 | || WINDOW_RIGHTMOST_P (w)) | ||
| 971 | && !WINDOW_LEFTMOST_P (w) | ||
| 972 | && eabs (x - x0) < grabbable_width) | ||
| 973 | return ON_VERTICAL_BORDER; | ||
| 974 | |||
| 975 | /* Make sure we're not at the rightmost position of a | ||
| 976 | mode-/header-line and there's yet another window on the | ||
| 977 | right. (Bug#1372) */ | ||
| 978 | else if ((WINDOW_RIGHTMOST_P (w) || x < x1) | ||
| 979 | && eabs (x - x1) < grabbable_width) | ||
| 980 | return ON_VERTICAL_BORDER; | ||
| 981 | |||
| 982 | if (x < x0 || x >= x1) | ||
| 983 | return ON_NOTHING; | ||
| 984 | |||
| 985 | return part; | ||
| 986 | } | ||
| 987 | |||
| 988 | if (WINDOW_WANTS_HEADER_LINE_P (w) | ||
| 989 | && y < top_y + CURRENT_HEADER_LINE_HEIGHT (w)) | ||
| 990 | { | ||
| 991 | part = ON_HEADER_LINE; | ||
| 992 | goto header_vertical_border_check; | ||
| 993 | } | ||
| 994 | |||
| 995 | if (x < x0 || x >= x1) return ON_NOTHING; | ||
| 996 | |||
| 997 | /* Outside any interesting column? */ | 976 | /* Outside any interesting column? */ |
| 998 | if (x < left_x || x > right_x) | 977 | if (x < left_x || x > right_x) |
| 999 | return ON_SCROLL_BAR; | 978 | return ON_SCROLL_BAR; |