Skip to content

Fix mouse not detected under Wine/Proton (invalid EnumObjects flags) - #1495

Closed
GG2R10 wants to merge 1 commit into
etternagame:developfrom
GG2R10:fix-wine-mouse-enumobjects
Closed

GG2R10 wants to merge 1 commit into
etternagame:developfrom
GG2R10:fix-wine-mouse-enumobjects

Conversation

@GG2R10

@GG2R10 GG2R10 commented Oct 25, 2026

Copy link
Copy Markdown

Problem

Running the Windows build under Wine/Proton (recent versions, e.g. GE-Proton 11),
the mouse is not detected at all: no cursor movement, no clicks. The log shows:

Found 2 DirectInput devices:
   1: 'Wine Mouse' axes: 0, hats: 0, buttons: 0 (buffered)

Cause

DIDevice::Open enumerates the mouse objects with:

Device->EnumObjects(DIMouse_EnumDevObjectsProc, this,
                    DIDFT_BUTTON | DIDFT_AXIS | DIDFT_ANYINSTANCE);

DIDFT_ANYINSTANCE is meant to identify an object's instance (it is part of
dwType), not to be used as an EnumObjects filter. Native Windows and older
Wine ignore the extra bits, but current Wine validates the flags and returns
DIERR_INVALIDPARAM if anything other than DIDFT_AXIS | DIDFT_POV | DIDFT_BUTTON | DIDFT_NODATA | DIDFT_COLLECTION is passed
(dlls/dinput/device.c, dinput_device_EnumObjects).

The return value is not checked, so the mouse ends up registered with an empty
Inputs list. The DirectInput thread then never emits mouse events, and the
cursor location (updated from GetCursorPos when an event is processed) is
never refreshed either.

Fix

Pass only DIDFT_BUTTON | DIDFT_AXIS, which is what the callback actually
handles. The SupportedMask check in DIMouse_EnumDevObjectsProc is updated
accordingly, and a failing EnumObjects is now logged.

Testing

  • Built from this branch with the project's CI on my fork (all jobs green,
    including Windows x64).
  • Ran that Windows build under GE-Proton 11-3 on Arch Linux (KDE Plasma,
    Wayland): the mouse is now detected ('Wine Mouse' axes: 3, hats: 0, buttons: 5) and works in menus. Before the change it reported 0 axes and
    0 buttons and the mouse did nothing.
  • Not tested on native Windows. As far as I know the removed bits had no
    effect there.

I used an AI assistant to help investigate and draft this change; I tested it myself.

DIDFT_ANYINSTANCE is not a valid EnumObjects filter. Native Windows ignores it,
but current Wine returns DIERR_INVALIDPARAM, leaving the mouse with no inputs.
Pass only DIDFT_BUTTON | DIDFT_AXIS and log if EnumObjects fails.
@poco0317 poco0317 closed this Oct 25, 2026
@poco0317

Copy link
Copy Markdown
Member

this pull request is AI generated

@GG2R10

GG2R10 commented Oct 25, 2026

Copy link
Copy Markdown
Author

mb, didn't know you had no AI policy. Can i redo the PR with my own words? It's a useful fix and I already tested it with the compiled windows version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants