mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 13:04:35 +00:00
Win32: Fix disabled cursor mode vs caption buttons
This postpones disabling the cursor until the user is done interacting with a caption button. Related to #650. Fixes #1071.
This commit is contained in:
parent
d80d4be030
commit
a368d89c94
@ -191,6 +191,8 @@ information on what to include when reporting a bug.
|
|||||||
- [Win32] Bugfix: The Cygwin DLL was installed to the wrong directory (#1035)
|
- [Win32] Bugfix: The Cygwin DLL was installed to the wrong directory (#1035)
|
||||||
- [Win32] Bugfix: Normalization of axis data via XInput was incorrect (#1045)
|
- [Win32] Bugfix: Normalization of axis data via XInput was incorrect (#1045)
|
||||||
- [Win32] Bugfix: `glfw3native.h` would undefine a foreign `APIENTRY` (#1062)
|
- [Win32] Bugfix: `glfw3native.h` would undefine a foreign `APIENTRY` (#1062)
|
||||||
|
- [Win32] Bugfix: Disabled cursor mode prevented use of caption buttons
|
||||||
|
(#650,#1071)
|
||||||
- [X11] Moved to XI2 `XI_RawMotion` for disable cursor mode motion input (#125)
|
- [X11] Moved to XI2 `XI_RawMotion` for disable cursor mode motion input (#125)
|
||||||
- [X11] Replaced `_GLFW_HAS_XF86VM` compile-time option with dynamic loading
|
- [X11] Replaced `_GLFW_HAS_XF86VM` compile-time option with dynamic loading
|
||||||
- [X11] Bugfix: `glfwGetVideoMode` would segfault on Cygwin/X
|
- [X11] Bugfix: `glfwGetVideoMode` would segfault on Cygwin/X
|
||||||
|
@ -233,6 +233,7 @@ typedef struct _GLFWwindowWin32
|
|||||||
HICON smallIcon;
|
HICON smallIcon;
|
||||||
|
|
||||||
GLFWbool cursorTracked;
|
GLFWbool cursorTracked;
|
||||||
|
GLFWbool frameAction;
|
||||||
GLFWbool iconified;
|
GLFWbool iconified;
|
||||||
GLFWbool maximized;
|
GLFWbool maximized;
|
||||||
|
|
||||||
|
@ -495,10 +495,47 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
|
|
||||||
switch (uMsg)
|
switch (uMsg)
|
||||||
{
|
{
|
||||||
|
case WM_MOUSEACTIVATE:
|
||||||
|
{
|
||||||
|
// HACK: Postpone cursor disabling when the window was activated by
|
||||||
|
// clicking a caption button
|
||||||
|
if (HIWORD(lParam) == WM_LBUTTONDOWN)
|
||||||
|
{
|
||||||
|
if (LOWORD(lParam) == HTCLOSE ||
|
||||||
|
LOWORD(lParam) == HTMINBUTTON ||
|
||||||
|
LOWORD(lParam) == HTMAXBUTTON)
|
||||||
|
{
|
||||||
|
window->win32.frameAction = GLFW_TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case WM_CAPTURECHANGED:
|
||||||
|
{
|
||||||
|
// HACK: Disable the cursor once the caption button action has been
|
||||||
|
// completed or cancelled
|
||||||
|
if (lParam == 0 && window->win32.frameAction)
|
||||||
|
{
|
||||||
|
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||||
|
_glfwPlatformSetCursorMode(window, GLFW_CURSOR_DISABLED);
|
||||||
|
|
||||||
|
window->win32.frameAction = GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case WM_SETFOCUS:
|
case WM_SETFOCUS:
|
||||||
{
|
{
|
||||||
_glfwInputWindowFocus(window, GLFW_TRUE);
|
_glfwInputWindowFocus(window, GLFW_TRUE);
|
||||||
|
|
||||||
|
// HACK: Do not disable cursor while the user is interacting with
|
||||||
|
// a caption button
|
||||||
|
if (window->win32.frameAction)
|
||||||
|
break;
|
||||||
|
|
||||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||||
_glfwPlatformSetCursorMode(window, GLFW_CURSOR_DISABLED);
|
_glfwPlatformSetCursorMode(window, GLFW_CURSOR_DISABLED);
|
||||||
|
|
||||||
@ -758,6 +795,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
case WM_ENTERSIZEMOVE:
|
case WM_ENTERSIZEMOVE:
|
||||||
case WM_ENTERMENULOOP:
|
case WM_ENTERMENULOOP:
|
||||||
{
|
{
|
||||||
|
// HACK: Postpone cursor disabling while the user is moving or
|
||||||
|
// resizing the window or using the menu
|
||||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||||
_glfwPlatformSetCursorMode(window, GLFW_CURSOR_NORMAL);
|
_glfwPlatformSetCursorMode(window, GLFW_CURSOR_NORMAL);
|
||||||
|
|
||||||
@ -767,6 +806,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
case WM_EXITSIZEMOVE:
|
case WM_EXITSIZEMOVE:
|
||||||
case WM_EXITMENULOOP:
|
case WM_EXITMENULOOP:
|
||||||
{
|
{
|
||||||
|
// HACK: Disable the cursor once the user is done moving or
|
||||||
|
// resizing the window or using the menu
|
||||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||||
_glfwPlatformSetCursorMode(window, GLFW_CURSOR_DISABLED);
|
_glfwPlatformSetCursorMode(window, GLFW_CURSOR_DISABLED);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user