Import Tk 8.6.10
This commit is contained in:
@@ -81,6 +81,12 @@ TkWinGetModifierState(void)
|
||||
if (GetKeyState(VK_RBUTTON) & 0x8000) {
|
||||
state |= Button3Mask;
|
||||
}
|
||||
if (GetKeyState(VK_XBUTTON1) & 0x8000) {
|
||||
state |= Button4Mask;
|
||||
}
|
||||
if (GetKeyState(VK_XBUTTON2) & 0x8000) {
|
||||
state |= Button5Mask;
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -330,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.
|
||||
@@ -344,6 +350,31 @@ 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;
|
||||
int xscreen = (int)(GetSystemMetrics(SM_CXSCREEN) - 1);
|
||||
int yscreen = (int)(GetSystemMetrics(SM_CYSCREEN) - 1);
|
||||
|
||||
input.type = INPUT_MOUSE;
|
||||
input.mi.dx = (x * 65535 + xscreen/2) / xscreen;
|
||||
input.mi.dy = (y * 65535 + yscreen/2) / yscreen;
|
||||
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,
|
||||
@@ -359,7 +390,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;
|
||||
}
|
||||
|
||||
@@ -371,9 +402,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -537,6 +568,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
|
||||
|
||||
Reference in New Issue
Block a user