libsdl-org / sdl12-compat

An SDL-1.2 compatibility layer that uses SDL 2.0 behind the scenes.
Other
191 stars 40 forks source link

Advanced Strategic Command (asc): mouse confined to less than full screen #256

Open smcv opened 1 year ago

smcv commented 1 year ago

Prerequisites:

To reproduce:

Expected result: mouse can be moved anywhere

Actual result: real SDL 1.2 works. With sdl12-compat the mouse is confined to a subset of the screen and cannot enter the menu bar. The exact bounds seem to be unpredictable (uninitialized?)

icculus commented 1 year ago

So what's weird about this is that there isn't an SDL API in either SDL 1.2 or SDL2 to confine the cursor to a subregion of a window, so I'm not sure what is causing this yet.

The game is not calling SDL_WarpMouse either.

icculus commented 1 year ago

If I alt-tab out of the game and back, it fixes itself and I can move the cursor to the top of the screen.

Happens with both Wayland and XWayland...could it be a window manager bug?

smcv commented 1 year ago

Running asc on the same GNOME version in Xorg mode, I can't reproduce the bug.

psycho-driver commented 1 year ago

Seeing same behavior in Rune

5.10.0-19-amd64 #1 SMP Debian 5.10.149-2 (2022-10-21) x86_64 GNU/Linux (MX-21)

sdl12-compat checked out 1/1/23 af404f0f9cd9a4f51a43a0d4078cbae70cca637c libsdl2-2.0-0 2.0.14+dfsg2-3+deb11u1

EDIT: For Rune's case the problem goes away if I set CaptureMouse=False in Rune.ini

With normal SDL1.2 the mouse behaves as expected with CaptureMouse=True

smcv commented 1 year ago

libsdl2-2.0-0 2.0.14+dfsg2-3+deb11u1

That's quite old, you might want to try with a locally-built SDL2.

icculus commented 1 year ago

Under the assumption this isn't an sdl12-compat bug, I'm bumping this out of the current milestone. But if anyone has some insight (including "it went away when I upgraded my system"), it would be welcome!

Eventually, if we don't find a reasonable way to track this issue down, I'll throw up my hands and close the issue outright, but it can live on for now.

smcv commented 1 year ago

I'm still seeing this with sdl12-compat 1.2.64 and SDL 2.26.5, in GNOME 43 on Debian 12.

The region I can't move the mouse into seems vaguely similar to the size of GNOME's top menu bar? That's space that's available to fullscreen apps like this one, but not used by maximized windows (analogous to the Windows taskbar).

Alt+Tab continues to be a workaround for this. Pressing the Windows key to go to the overview, and then going back into the fullscreen game, is also a workaround.

icculus commented 1 year ago

I'm wondering if this reproduces with a simple SDL_WINDOW_FULLSCREEN_DESKTOP app in SDL2 itself. I'll see if I can scratch together something comparable as a minimum reproduction case...but it's surprising this has never come up before, so it might be something about the exact sequence of things sdl12-compat does with SDL2...?

smcv commented 1 year ago

I'm wondering if this reproduces with a simple SDL_WINDOW_FULLSCREEN_DESKTOP app in SDL2 itself.

If I install the libsdl2-tests package, /usr/libexec/installed-tests/SDL2/testgeometry --fullscreen-desktop doesn't reproduce this issue.

smcv commented 1 year ago

Happens with both Wayland and XWayland...could it be a window manager bug?

It could be. I couldn't reproduce the bug with KDE Plasma (again in Wayland mode) on the same hardware, also under Debian 12. If it's a window manager bug then it seems odd that it's specific to sdl12-compat, though...

smcv commented 1 year ago

I opened https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1038738 in the hope that Debian's asc maintainers might have some ideas.

rebsol commented 1 year ago

I have the same problem in OpenXCom issue 215. Just realized, I solved it by using Xorg instead of Wayland.