Mirror of the Vim source from https://github.com/vim/vim
Revision | 159d87361e4b0d99c3863b3c82b7121a474cdf1f (tree) |
---|---|
Zeit | 2007-12-04 06:21:03 |
Autor | vimboss |
Commiter | vimboss |
updated for version 7.1-168
@@ -290,6 +290,11 @@ | ||
290 | 290 | |
291 | 291 | /* Local variables */ |
292 | 292 | static int s_button_pending = -1; |
293 | + | |
294 | +/* s_getting_focus is set when we got focus but didn't see mouse-up event yet, | |
295 | + * so don't reset s_button_pending. */ | |
296 | +static int s_getting_focus = FALSE; | |
297 | + | |
293 | 298 | static int s_x_pending; |
294 | 299 | static int s_y_pending; |
295 | 300 | static UINT s_kFlags_pending; |
@@ -671,6 +676,8 @@ | ||
671 | 676 | { |
672 | 677 | int vim_modifiers = 0x0; |
673 | 678 | |
679 | + s_getting_focus = FALSE; | |
680 | + | |
674 | 681 | if (keyFlags & MK_SHIFT) |
675 | 682 | vim_modifiers |= MOUSE_SHIFT; |
676 | 683 | if (keyFlags & MK_CONTROL) |
@@ -792,6 +799,7 @@ | ||
792 | 799 | { |
793 | 800 | int button; |
794 | 801 | |
802 | + s_getting_focus = FALSE; | |
795 | 803 | if (s_button_pending > -1) |
796 | 804 | { |
797 | 805 | /* Delayed action for mouse down event */ |
@@ -1951,8 +1959,10 @@ | ||
1951 | 1959 | allow_scrollbar = FALSE; |
1952 | 1960 | |
1953 | 1961 | /* Clear pending mouse button, the release event may have been |
1954 | - * taken by the dialog window. */ | |
1955 | - s_button_pending = -1; | |
1962 | + * taken by the dialog window. But don't do this when getting | |
1963 | + * focus, we need the mouse-up event then. */ | |
1964 | + if (!s_getting_focus) | |
1965 | + s_button_pending = -1; | |
1956 | 1966 | |
1957 | 1967 | return OK; |
1958 | 1968 | } |
@@ -2702,6 +2712,7 @@ | ||
2702 | 2712 | HWND hwndOldFocus) |
2703 | 2713 | { |
2704 | 2714 | gui_focus_change(TRUE); |
2715 | + s_getting_focus = TRUE; | |
2705 | 2716 | (void)MyWindowProc(hwnd, WM_SETFOCUS, (WPARAM)hwndOldFocus, 0); |
2706 | 2717 | } |
2707 | 2718 |
@@ -2711,6 +2722,7 @@ | ||
2711 | 2722 | HWND hwndNewFocus) |
2712 | 2723 | { |
2713 | 2724 | gui_focus_change(FALSE); |
2725 | + s_getting_focus = FALSE; | |
2714 | 2726 | (void)MyWindowProc(hwnd, WM_KILLFOCUS, (WPARAM)hwndNewFocus, 0); |
2715 | 2727 | } |
2716 | 2728 |
@@ -667,6 +667,8 @@ | ||
667 | 667 | static int included_patches[] = |
668 | 668 | { /* Add new patch number below this line */ |
669 | 669 | /**/ |
670 | + 168, | |
671 | +/**/ | |
670 | 672 | 167, |
671 | 673 | /**/ |
672 | 674 | 166, |