|
@@ -495,10 +495,47 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT 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:
|
|
|
{
|
|
|
_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)
|
|
|
_glfwPlatformSetCursorMode(window, GLFW_CURSOR_DISABLED);
|
|
|
|
|
@@ -758,6 +795,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|
|
case WM_ENTERSIZEMOVE:
|
|
|
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)
|
|
|
_glfwPlatformSetCursorMode(window, GLFW_CURSOR_NORMAL);
|
|
|
|
|
@@ -767,6 +806,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|
|
case WM_EXITSIZEMOVE:
|
|
|
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)
|
|
|
_glfwPlatformSetCursorMode(window, GLFW_CURSOR_DISABLED);
|
|
|
|