diff options
author | Kevin Walzer <kw@codebykevin.com> | 2019-09-02 13:48:07 (GMT) |
---|---|---|
committer | Kevin Walzer <kw@codebykevin.com> | 2019-09-02 13:48:07 (GMT) |
commit | f44aa5c0157a509a8242a1fdf2813f3cae6eef27 (patch) | |
tree | 24d9aa4502fb83c853046bece8f3e7a2fb8d4c60 /win | |
parent | 06d12e69e9974547cb077ad90a2fbff640b8d5ee (diff) | |
parent | 6a358e30155c94e44a4fd964ac793161cbc36164 (diff) | |
download | tk-f44aa5c0157a509a8242a1fdf2813f3cae6eef27.zip tk-f44aa5c0157a509a8242a1fdf2813f3cae6eef27.tar.gz tk-f44aa5c0157a509a8242a1fdf2813f3cae6eef27.tar.bz2 |
Merge recent fixes for macOS into release branch from core-8-6-branch
Diffstat (limited to 'win')
-rw-r--r-- | win/Makefile.in | 1 | ||||
-rw-r--r-- | win/tkWinInt.h | 6 | ||||
-rw-r--r-- | win/tkWinPointer.c | 58 | ||||
-rw-r--r-- | win/tkWinPort.h | 1 | ||||
-rw-r--r-- | win/tkWinWindow.c | 4 |
5 files changed, 62 insertions, 8 deletions
diff --git a/win/Makefile.in b/win/Makefile.in index 9fe8ada..7b3675e 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -28,6 +28,7 @@ bindir = @bindir@ libdir = @libdir@ includedir = @includedir@ datarootdir = @datarootdir@ +runstatedir = @runstatedir@ mandir = @mandir@ # The following definition can be set to non-null for special systems diff --git a/win/tkWinInt.h b/win/tkWinInt.h index 0e2c844..9cd49cd 100644 --- a/win/tkWinInt.h +++ b/win/tkWinInt.h @@ -201,6 +201,12 @@ MODULE_SCOPE void TkpWinToplevelDetachWindow(TkWindow *winPtr); MODULE_SCOPE int TkpWmGetState(TkWindow *winPtr); /* + * The following is implemented in tkWinPointer.c and also used in tkWinWindow.c + */ + +MODULE_SCOPE void TkSetCursorPos(int x, int y); + +/* * Common routines used in Windows implementation */ MODULE_SCOPE Tcl_Obj * TkWin32ErrorObj(HRESULT hrError); diff --git a/win/tkWinPointer.c b/win/tkWinPointer.c index 251b5b9..896500c 100644 --- a/win/tkWinPointer.c +++ b/win/tkWinPointer.c @@ -336,10 +336,10 @@ XQueryPointer( /* *---------------------------------------------------------------------- * - * XWarpPointer -- + * XWarpPointer, TkpWarpPointer -- * - * Move pointer to new location. This is not a complete implementation of - * this function. + * Move pointer to new location. Note that implementation of XWarpPointer + * is incomplete. * * Results: * None. @@ -350,6 +350,29 @@ XQueryPointer( *---------------------------------------------------------------------- */ +/* + * TkSetCursorPos is a helper function replacing SetCursorPos since this + * latter Windows function appears to have been broken by Microsoft + * since Win10 Falls Creator Update - See ticket [69b48f427e] along with + * several other Internet reports about this breakage. + */ + +void TkSetCursorPos( + int x, + int y) +{ + INPUT input; + + input.type = INPUT_MOUSE; + input.mi.dx = x * (65535.0 / (GetSystemMetrics(SM_CXSCREEN) - 1)); + input.mi.dy = y * (65535.0 / (GetSystemMetrics(SM_CYSCREEN) - 1)); + input.mi.mouseData = 0; + input.mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE; + input.mi.time = 0; + input.mi.dwExtraInfo = 0; + SendInput(1, &input, sizeof(input)); +} + int XWarpPointer( Display *display, @@ -365,7 +388,7 @@ XWarpPointer( RECT r; GetWindowRect(Tk_GetHWND(dest_w), &r); - SetCursorPos(r.left+dest_x, r.top+dest_y); + TkSetCursorPos(r.left+dest_x, r.top+dest_y); return Success; } @@ -377,9 +400,9 @@ TkpWarpPointer( RECT r; GetWindowRect(Tk_GetHWND(Tk_WindowId(dispPtr->warpWindow)), &r); - SetCursorPos(r.left + dispPtr->warpX, r.top + dispPtr->warpY); + TkSetCursorPos(r.left + dispPtr->warpX, r.top + dispPtr->warpY); } else { - SetCursorPos(dispPtr->warpX, dispPtr->warpY); + TkSetCursorPos(dispPtr->warpX, dispPtr->warpY); } } @@ -544,6 +567,29 @@ TkpSetCapture( } /* + *---------------------------------------------------------------------- + * + * TkpGetCapture -- + * + * This function requests which window is capturing the mouse. + * + * Results: + * The return value is a pointer to the capture window, if there is + * one, otherwise it is NULL. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +Tk_Window +TkpGetCapture(void) +{ + return Tk_HWNDToWindow(GetCapture()); +} + +/* * Local Variables: * mode: c * c-basic-offset: 4 diff --git a/win/tkWinPort.h b/win/tkWinPort.h index f5ac68b..8cc5677 100644 --- a/win/tkWinPort.h +++ b/win/tkWinPort.h @@ -24,6 +24,7 @@ #include <wchar.h> #include <io.h> #include <stdlib.h> +#include <assert.h> #include <errno.h> #include <fcntl.h> #include <malloc.h> diff --git a/win/tkWinWindow.c b/win/tkWinWindow.c index 445ff9c..57c948e 100644 --- a/win/tkWinWindow.c +++ b/win/tkWinWindow.c @@ -882,7 +882,7 @@ TkpShowBusyWindow( */ GetCursorPos(&point); - SetCursorPos(point.x, point.y); + TkSetCursorPos(point.x, point.y); } /* @@ -924,7 +924,7 @@ TkpHideBusyWindow( */ GetCursorPos(&point); - SetCursorPos(point.x, point.y); + TkSetCursorPos(point.x, point.y); } /* |