mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 10:05:10 +00:00
Win32: Fix handling of local absolute raw motion
The implementation for how to handle absolute raw motion remotely is just how to handle absolute raw motion, period.
This commit is contained in:
parent
275b92f887
commit
d93868bcf3
@ -698,9 +698,6 @@ int _glfwInitWin32(void)
|
|||||||
if (!createHelperWindow())
|
if (!createHelperWindow())
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
|
|
||||||
// Check if the current process was started via Remote Desktop
|
|
||||||
_glfw.win32.isRemoteSession = GetSystemMetrics(SM_REMOTESESSION) > 0;
|
|
||||||
|
|
||||||
_glfwPollMonitorsWin32();
|
_glfwPollMonitorsWin32();
|
||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -458,8 +458,6 @@ typedef struct _GLFWlibraryWin32
|
|||||||
RAWINPUT* rawInput;
|
RAWINPUT* rawInput;
|
||||||
int rawInputSize;
|
int rawInputSize;
|
||||||
UINT mouseTrailSize;
|
UINT mouseTrailSize;
|
||||||
// Indicate if the process was started behind Remote Destop
|
|
||||||
BOOL isRemoteSession;
|
|
||||||
// The cursor handle to use to hide the cursor (NULL or a transparent cursor)
|
// The cursor handle to use to hide the cursor (NULL or a transparent cursor)
|
||||||
HCURSOR blankCursor;
|
HCURSOR blankCursor;
|
||||||
|
|
||||||
|
@ -929,38 +929,28 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
|
|||||||
data = _glfw.win32.rawInput;
|
data = _glfw.win32.rawInput;
|
||||||
if (data->data.mouse.usFlags & MOUSE_MOVE_ABSOLUTE)
|
if (data->data.mouse.usFlags & MOUSE_MOVE_ABSOLUTE)
|
||||||
{
|
{
|
||||||
if (_glfw.win32.isRemoteSession)
|
POINT pos = {0};
|
||||||
|
int width, height;
|
||||||
|
|
||||||
|
if (data->data.mouse.usFlags & MOUSE_VIRTUAL_DESKTOP)
|
||||||
{
|
{
|
||||||
// NOTE: According to DirectXTK, when running via Remote Desktop, raw
|
pos.x += GetSystemMetrics(SM_XVIRTUALSCREEN);
|
||||||
// mouse motion is provided as MOUSE_MOVE_ABSOLUTE and
|
pos.y += GetSystemMetrics(SM_YVIRTUALSCREEN);
|
||||||
// MOUSE_VIRTUAL_DESKTOP.
|
width = GetSystemMetrics(SM_CXVIRTUALSCREEN);
|
||||||
|
height = GetSystemMetrics(SM_CYVIRTUALSCREEN);
|
||||||
int width, height;
|
|
||||||
|
|
||||||
if (data->data.mouse.usFlags & MOUSE_VIRTUAL_DESKTOP)
|
|
||||||
{
|
|
||||||
width = GetSystemMetrics(SM_CXVIRTUALSCREEN);
|
|
||||||
height = GetSystemMetrics(SM_CYVIRTUALSCREEN);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
width = GetSystemMetrics(SM_CXSCREEN);
|
|
||||||
height = GetSystemMetrics(SM_CYSCREEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
POINT pos;
|
|
||||||
pos.x = (int) ((data->data.mouse.lLastX / 65535.f) * width);
|
|
||||||
pos.y = (int) ((data->data.mouse.lLastY / 65535.f) * height);
|
|
||||||
ScreenToClient(window->win32.handle, &pos);
|
|
||||||
|
|
||||||
dx = pos.x - window->win32.lastCursorPosX;
|
|
||||||
dy = pos.y - window->win32.lastCursorPosY;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dx = data->data.mouse.lLastX - window->win32.lastCursorPosX;
|
width = GetSystemMetrics(SM_CXSCREEN);
|
||||||
dy = data->data.mouse.lLastY - window->win32.lastCursorPosY;
|
height = GetSystemMetrics(SM_CYSCREEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pos.x += (int) ((data->data.mouse.lLastX / 65535.f) * width);
|
||||||
|
pos.y += (int) ((data->data.mouse.lLastY / 65535.f) * height);
|
||||||
|
ScreenToClient(window->win32.handle, &pos);
|
||||||
|
|
||||||
|
dx = pos.x - window->win32.lastCursorPosX;
|
||||||
|
dy = pos.y - window->win32.lastCursorPosY;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1324,7 +1314,7 @@ static int createNativeWindow(_GLFWwindow* window,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_glfw.win32.isRemoteSession)
|
if (GetSystemMetrics(SM_REMOTESESSION))
|
||||||
{
|
{
|
||||||
// NOTE: On Remote Desktop, setting the cursor to NULL does not hide it
|
// NOTE: On Remote Desktop, setting the cursor to NULL does not hide it
|
||||||
// HACK: Create a transparent cursor and always set that instead of NULL
|
// HACK: Create a transparent cursor and always set that instead of NULL
|
||||||
|
Loading…
Reference in New Issue
Block a user