From 35e2ffb4ab9786819cc47538beeaccf3088174be Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 6 Aug 2023 12:57:22 +0900 Subject: [PATCH] [console] Release the mouse when showing the mouse This makes mouse grabbing much less painful. --- libs/console/cl_debug.c | 3 ++- libs/console/client.c | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/libs/console/cl_debug.c b/libs/console/cl_debug.c index 3380940b6..1870dc225 100644 --- a/libs/console/cl_debug.c +++ b/libs/console/cl_debug.c @@ -201,6 +201,7 @@ debug_app_window (const IE_event_t *ie_event) } return 1; } + static int capture_mouse_event (const IE_event_t *ie_event) { @@ -217,7 +218,7 @@ capture_mouse_event (const IE_event_t *ie_event) }; } else if (ie_event->mouse.type == ie_mouseup && ((ie_event->mouse.buttons ^ prev_mouse.buttons) & 4)) { - IN_UpdateGrab (in_grab); + IN_UpdateGrab (0); dragging = false; } diff --git a/libs/console/client.c b/libs/console/client.c index e1ce24bbf..6c21b6efb 100644 --- a/libs/console/client.c +++ b/libs/console/client.c @@ -46,6 +46,7 @@ #include "QF/console.h" #include "QF/cvar.h" #include "QF/dstring.h" +#include "QF/input.h" #include "QF/keys.h" #include "QF/qargs.h" #include "QF/quakefs.h" @@ -338,9 +339,11 @@ ClearNotify (void) static void con_update_mouse (void) { - VID_SetCursor (con_force_mouse_visible - || con_show_mouse - || !con_hide_mouse); + bool show_cursor = (con_force_mouse_visible + || con_show_mouse + || !con_hide_mouse); + VID_SetCursor (show_cursor); + IN_UpdateGrab (show_cursor ? 0 : in_grab); } void