Closed rayrapetyan closed 1 week ago
Update: When running Windows 9x in DOSBox-X in headless mode, the mouse doesn't work properly in any mode. It sticks to the border of the screen, and you can only move it across the screen very slowly. The screen behaves like a magnet, and any careless movement sends the mouse back to the border.
UPD:
XTestFakeMotionEvent and XWarpPointer behave the same way, mouse cursor jumps all over the screen.
XTestFakeRelativeMotionEvent works properly, mouse moves smoothly and as expected.
I've tried to use XQueryPointer before XTestFakeRelativeMotionEvent to find deltas, and mouse cursor started to jump exactly as it did with XTestFakeMotionEvent/XWarpPointer! So It turns out, XQueryPointer returns valid coordinates only when mouse is not locked. Once mouse is locked (after the click or with the autolock=true), XQueryPointer constantly returns 320,240. I believe 320,240 comes from this:
LOG: XRandR CRTC 0: pos=(0,0) size=(640,480) outputs=1
LOG: Our window lies on this CRTC display (window pos=(0,0) size=(640,480) match=(320,240)).
LOG: Goes to output 0: name='DUMMY0' size_mm=(0 x 0)
LOG: Screen report: Method 'XRandR' (640.000 x 480.000 pixels) at (0.000 x 0.000) (0.000 x 0.000 mm) (0.000 x 0.000 in) (-1.000 x -1.000 DPI)
So to summarize, the root cause of the described mouse issue relies within XQueryPointer - somehow it breaks after the mouse lock, XQueryPointer thinks mouse never moves (probably it performs checks on the wrong window?). I've checked and there is only one screen attached to my display and I'm taking a root window on this single screen:
RootWindowOfScreen(screen)
so not sure which other window dosbox-x switches to on mouse lock... Anyway it's a dosbox-x only issue, there are no any problems like that in scummvm or wine, they properly handle XTestFakeMotionEvent and XWarpPointer and don't "lock" the pointer the way dosbox-x does.
@aybe, I see you did some mouse-related fixes, could you look into the described issue and provide your thoughts?
Cursor behaves like this when absolute coordinates are being sent while app is waiting for relative coordinates. There are other conditions causing same behavior, too many to put into the same issue, closing.
Describe the bug
With any game/app, mouse sticks to the border of the visible area of the window when running dosbox-x in a headless environment.
Steps to reproduce the behaviour
In a headless mode (e.g. a docker container running on a remote server) run some app, e.g.:
Expected behavior
Mouse should be working and reaching any part of the screen. Instead mouse cursor sticks to the edges of the visible area and can move only along these borders. If you move mouse very slowly, you can position it on the screen, but it behaves line an extra-strong magnet - any fast move and mouse cursor is sent back to the edge.
What operating system(s) this bug have occurred on?
Debian Bookworm
What version(s) of DOSBox-X have this bug?
2024.03.01
Used configuration
Output log
Additional information
Using
mouse emulation=integration
in win 3.11 fixes the issue in the headless mode. Using standard env (non-headless) works with no issues.Have you checked that no similar bug report(s) exist?
Code of Conduct & Contributing Guidelines