Bug fix: Keep the user mouse dimensions reported to the guest up to date with the window size, instead of only whenever the mouse moves

This commit is contained in:
Jonathan Campbell 2025-05-06 00:18:36 -07:00
parent 383ed6e4cf
commit 921acaa291

View File

@ -2090,6 +2090,7 @@ void drawmenu(Bitu) {
#endif
void RENDER_Reset(void);
void UpdateUserCursorScreenDimensions(void);
Bitu GFX_SetSize(Bitu width, Bitu height, Bitu flags, double scalex, double scaley, GFX_CallBack_t callback)
{
@ -2242,7 +2243,7 @@ Bitu GFX_SetSize(Bitu width, Bitu height, Bitu flags, double scalex, double scal
}
#endif
UpdateWindowDimensions();
UpdateUserCursorScreenDimensions();
#if defined(WIN32) && !defined(HX_DOS) && !defined(_WIN32_WINDOWS)
WindowsTaskbarUpdatePreviewRegion();
#endif
@ -4465,6 +4466,16 @@ bool GFX_CursorInOrNearScreen(int wx,int wy) {
return (wx >= minx && wx < maxx) && (wy >= miny && wy < maxy);
}
void UpdateUserCursorScreenDimensions(void) {
user_cursor_sw = sdl.clip.w;
user_cursor_sh = sdl.clip.h;
if (video_debug_overlay && vga.draw.width < render.src.width) {
user_cursor_sw = (vga.draw.width*user_cursor_sw)/render.src.width;
user_cursor_sh = (vga.draw.height*user_cursor_sh)/render.src.height;
}
}
static void HandleMouseMotion(SDL_MouseMotionEvent * motion) {
bool inputToScreen = false;
@ -4547,13 +4558,8 @@ static void HandleMouseMotion(SDL_MouseMotionEvent * motion) {
user_cursor_y = motion->y - sdl.clip.y;
user_cursor_locked = sdl.mouse.locked;
user_cursor_emulation = sdl.mouse.emulation;
user_cursor_sw = sdl.clip.w;
user_cursor_sh = sdl.clip.h;
if (video_debug_overlay && vga.draw.width < render.src.width) {
user_cursor_sw = (vga.draw.width*user_cursor_sw)/render.src.width;
user_cursor_sh = (vga.draw.height*user_cursor_sh)/render.src.height;
}
UpdateUserCursorScreenDimensions();
auto xrel = static_cast<float>(motion->xrel) * sdl.mouse.xsensitivity / 100.0f;
auto yrel = static_cast<float>(motion->yrel) * sdl.mouse.ysensitivity / 100.0f;