From b0c4527c2edb1ee177fd09b3c412b65b385bf35b Mon Sep 17 00:00:00 2001 From: Tolik <85737314+Tolik-Trek@users.noreply.github.com> Date: Tue, 26 May 2026 22:52:53 +1000 Subject: [PATCH] =?UTF-8?q?=D0=92=D1=8B=D0=BD=D0=B5=D1=81=20=D0=BF=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D1=83=20=C2=AB=D0=BE=D1=81=D0=B2?= =?UTF-8?q?=D0=BE=D0=B1=D0=BE=D0=B6=D0=B4=D1=91=D0=BD=20=E2=86=92=20=D0=BA?= =?UTF-8?q?=D0=BB=D0=B8=D0=BA=20=D0=B2=20=D0=BE=D0=BA=D0=BD=D0=B5=20?= =?UTF-8?q?=E2=86=92=20recapture=5Fpointer()=C2=BB=20=D0=B8=D0=B7-=D0=BF?= =?UTF-8?q?=D0=BE=D0=B4=20debug-=D0=B3=D0=B5=D0=B9=D1=82=D0=B0=20=D0=B2=20?= =?UTF-8?q?sdl/window.cpp=20=D0=B8=20sdl3/window.cpp=20=E2=80=94=20=D1=82?= =?UTF-8?q?=D0=B5=D0=BF=D0=B5=D1=80=D1=8C=20=D0=BE=D0=BD=D0=B0=20=D0=B2?= =?UTF-8?q?=D1=8B=D0=BF=D0=BE=D0=BB=D0=BD=D1=8F=D0=B5=D1=82=D1=81=D1=8F=20?= =?UTF-8?q?=D0=B2=D1=81=D0=B5=D0=B3=D0=B4=D0=B0,=20=D0=BA=D0=B0=D0=BA=20?= =?UTF-8?q?=D0=BD=D0=B0=20Windows.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- makefile | 2 +- src/osd/sdl/window.cpp | 20 ++++++++++++-------- src/osd/sdl3/window.cpp | 20 ++++++++++++-------- 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/makefile b/makefile index 3da69b80f..1d640a4d5 100644 --- a/makefile +++ b/makefile @@ -1037,7 +1037,7 @@ else OLD_GIT_VERSION := $(shell cat $(GENDIR)/git_desc 2> NUL) endif ifneq ($(IGNORE_GIT),1) -NEW_GIT_VERSION := $(shell git describe --dirty) +NEW_GIT_VERSION := $(shell git describe --dirty --always) else NEW_GIT_VERSION := unknown endif diff --git a/src/osd/sdl/window.cpp b/src/osd/sdl/window.cpp index c4a034529..a122ad237 100644 --- a/src/osd/sdl/window.cpp +++ b/src/osd/sdl/window.cpp @@ -281,18 +281,22 @@ void sdl_window_info::update_cursor_state() c=SDL_CreateCursor(data, data, 8, 8, 0, 0); SDL_SetCursor(c); #else + auto &sdlosd = downcast(machine().osd()); + + // if the pointer was freed to the OS, re-capture when the user clicks back in + // the window - do this even with the debugger enabled, otherwise the pointer + // (and all input, since polling is suspended while released) gets stuck with no + // way to recover: the recapture combo can't re-fire because the keyboard isn't + // polled, so the click is the only escape hatch + if (sdlosd.pointer_released() + && (SDL_GetMouseFocus() == platform_window()) + && (SDL_GetMouseState(nullptr, nullptr) & SDL_BUTTON(SDL_BUTTON_LEFT))) + sdlosd.recapture_pointer(); + // do not do mouse capture if the debugger's enabled to avoid // the possibility of losing control if (!(machine().debug_flags & DEBUG_FLAG_OSD_ENABLED)) { - auto &sdlosd = downcast(machine().osd()); - - // if the pointer was freed to the OS, re-capture when the user clicks back in the window - if (sdlosd.pointer_released() - && (SDL_GetMouseFocus() == platform_window()) - && (SDL_GetMouseState(nullptr, nullptr) & SDL_BUTTON(SDL_BUTTON_LEFT))) - sdlosd.recapture_pointer(); - bool should_hide_mouse = sdlosd.should_hide_mouse(); if (!fullscreen() && !should_hide_mouse) diff --git a/src/osd/sdl3/window.cpp b/src/osd/sdl3/window.cpp index 81a4090bb..72df56f92 100644 --- a/src/osd/sdl3/window.cpp +++ b/src/osd/sdl3/window.cpp @@ -280,18 +280,22 @@ void sdl_window_info::update_cursor_state() c=SDL_CreateCursor(data, data, 8, 8, 0, 0); SDL_SetCursor(c); #else + auto &sdlosd = downcast(machine().osd()); + + // if the pointer was freed to the OS, re-capture when the user clicks back in + // the window - do this even with the debugger enabled, otherwise the pointer + // (and all input, since polling is suspended while released) gets stuck with no + // way to recover: the recapture combo can't re-fire because the keyboard isn't + // polled, so the click is the only escape hatch + if (sdlosd.pointer_released() + && (SDL_GetMouseFocus() == platform_window()) + && (SDL_GetMouseState(nullptr, nullptr) & SDL_BUTTON_MASK(SDL_BUTTON_LEFT))) + sdlosd.recapture_pointer(); + // do not do mouse capture if the debugger's enabled to avoid // the possibility of losing control if (!(machine().debug_flags & DEBUG_FLAG_OSD_ENABLED)) { - auto &sdlosd = downcast(machine().osd()); - - // if the pointer was freed to the OS, re-capture when the user clicks back in the window - if (sdlosd.pointer_released() - && (SDL_GetMouseFocus() == platform_window()) - && (SDL_GetMouseState(nullptr, nullptr) & SDL_BUTTON_MASK(SDL_BUTTON_LEFT))) - sdlosd.recapture_pointer(); - bool should_hide_mouse = sdlosd.should_hide_mouse(); if (!fullscreen() && !should_hide_mouse)