summaryrefslogtreecommitdiffstats
path: root/video/out/w32_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/w32_common.c')
-rw-r--r--video/out/w32_common.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/video/out/w32_common.c b/video/out/w32_common.c
index 614d6ec8a7..c7dfd0d45f 100644
--- a/video/out/w32_common.c
+++ b/video/out/w32_common.c
@@ -98,6 +98,9 @@ struct vo_w32_state {
int mouse_x;
int mouse_y;
+ // Should SetCursor be called when handling VOCTRL_SET_CURSOR_VISIBILITY?
+ bool can_set_cursor;
+
// UTF-16 decoding state for WM_CHAR and VK_PACKET
int high_surrogate;
@@ -679,7 +682,10 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
mp_input_put_key(w32->input_ctx, MP_INPUT_RELEASE_ALL);
break;
case WM_SETCURSOR:
- if (LOWORD(lParam) == HTCLIENT && !w32->cursor_visible) {
+ // The cursor should only be hidden if the mouse is in the client area
+ // and if the window isn't in menu mode (HIWORD(lParam) is non-zero)
+ w32->can_set_cursor = LOWORD(lParam) == HTCLIENT && HIWORD(lParam);
+ if (w32->can_set_cursor && !w32->cursor_visible) {
SetCursor(NULL);
return TRUE;
}
@@ -1199,12 +1205,6 @@ fail:
return 0;
}
-static bool vo_w32_is_cursor_in_client(struct vo_w32_state *w32)
-{
- DWORD pos = GetMessagePos();
- return SendMessage(w32->window, WM_NCHITTEST, 0, pos) == HTCLIENT;
-}
-
static int gui_thread_control(struct vo_w32_state *w32, int request, void *arg)
{
switch (request) {
@@ -1250,7 +1250,7 @@ static int gui_thread_control(struct vo_w32_state *w32, int request, void *arg)
case VOCTRL_SET_CURSOR_VISIBILITY:
w32->cursor_visible = *(bool *)arg;
- if (vo_w32_is_cursor_in_client(w32)) {
+ if (w32->can_set_cursor && w32->tracking) {
if (w32->cursor_visible)
SetCursor(LoadCursor(NULL, IDC_ARROW));
else