Games can't seem to keep mouse focus
Closed this issue · 3 comments
System info:
arch
NsCDE
fvwm3 1.1.1 (released)
with support for: XPM, PNG, SVG, Shape, XShm, SM, Bidi text, XRandR, XRender, XCursor, XFT, XFixes, NLS
I have 3 monitors setup, and when I try to play a game (Using 'The finals' as an test-case playing via steam/proton), the mouse refuses to stay within the bounds of the game window, regardless of fullscreen/windowed etc. This issue only seems to happen on fvwm3. I've also got bspwm running and the issue doesn't exist there. I've got the xprop output for the window from both fvwm3 and bspwm to compare.
This makes gaming pretty much impossible, so currently I just switch to bspwm to play games, but it's annoying and I'd prefer to stick with fvwm3 & nscde. If it's something obvious within the xprop output then at least I can make a script/keybind to change whatever that is for the current active window and workaround my issue, but nothing jumps out to me here:
fvwm3 xprop output (I've omitted the icon)
_NET_WM_DESKTOP(CARDINAL) = 0
WM_DESKTOP(WM_DESKTOP) = 0x0
_NET_FRAME_EXTENTS(CARDINAL) = 0, 0, 0, 0
_KDE_NET_WM_FRAME_STRUT(CARDINAL) = 0, 0, 0, 0
_NET_WM_ALLOWED_ACTIONS(ATOM) = _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_CLOSE, _NET_WM_ACTION_MOVE, _NET_WM_ACTION_RESIZE, _NET_WM_ACTION_SHADE, _NET_WM_ACTION_STICK
_NET_WM_ICON_VISIBLE_NAME(UTF8_STRING) = "THE FINALS"
WM_STATE(WM_STATE):
window state: Normal
icon window: 0x0
_NET_WM_VISIBLE_NAME(UTF8_STRING) = "THE FINALS"
_NET_WM_BYPASS_COMPOSITOR(CARDINAL) = 0
_NET_WM_STATE(ATOM) = _NET_WM_STATE_FULLSCREEN
_NET_WM_NAME(UTF8_STRING) = "THE FINALS"
WM_ICON_NAME(COMPOUND_TEXT) = "THE FINALS"
WM_NAME(COMPOUND_TEXT) = "THE FINALS"
_WINE_HWND_EXSTYLE(CARDINAL) = 262144
_WINE_HWND_STYLE(CARDINAL) = 2483027968
WM_HINTS(WM_HINTS):
Client accepts input or input focus: True
Initial state is Normal State.
bitmap id # to use for icon: 0x6c0004e
bitmap id # of mask for icon: 0x6c00050
window id # of group leader: 0x2000001
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL
_MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 0x3, 0x26, 0x0, 0x0, 0x0
WM_NORMAL_HINTS(WM_SIZE_HINTS):
program specified location: 2560, 1080
window gravity: Static
_NET_WM_USER_TIME_WINDOW(WINDOW): window id # 0x6c00009
XdndAware(ATOM) = BITMAP
_NET_WM_PID(CARDINAL) = 11117
WM_LOCALE_NAME(STRING) = "en_US.UTF-8"
WM_CLIENT_MACHINE(STRING) = "archlinux-desktop"
WM_CLASS(STRING) = "steam_app_2073850", "steam_app_2073850"
WM_PROTOCOLS(ATOM): protocols WM_DELETE_WINDOW, _NET_WM_PING
_WINE_ALLOW_FLIP(CARDINAL) = 0
STEAM_GAME(CARDINAL) = 2073850
bspwm xprop output (this one works great)
_NET_WM_DESKTOP(CARDINAL) = 4
WM_STATE(WM_STATE):
window state: Normal
icon window: 0x0
_NET_WM_ICON(CARDINAL) = Icon (32 x 32):
_NET_WM_BYPASS_COMPOSITOR(CARDINAL) = 0
_NET_WM_STATE(ATOM) = _NET_WM_STATE_FULLSCREEN
_NET_WM_NAME(UTF8_STRING) = "THE FINALS"
WM_ICON_NAME(COMPOUND_TEXT) = "THE FINALS"
WM_NAME(COMPOUND_TEXT) = "THE FINALS"
_WINE_HWND_EXSTYLE(CARDINAL) = 262144
_WINE_HWND_STYLE(CARDINAL) = 2483027968
WM_HINTS(WM_HINTS):
Client accepts input or input focus: True
Initial state is Normal State.
bitmap id # to use for icon: 0x500004e
bitmap id # of mask for icon: 0x5000050
window id # of group leader: 0x4c00001
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL
_MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 0x3, 0x26, 0x0, 0x0, 0x0
WM_NORMAL_HINTS(WM_SIZE_HINTS):
program specified location: 2560, 1080
window gravity: Static
_NET_WM_USER_TIME_WINDOW(WINDOW): window id # 0x5000009
XdndAware(ATOM) = BITMAP
_NET_WM_PID(CARDINAL) = 24603
WM_LOCALE_NAME(STRING) = "en_US.UTF-8"
WM_CLIENT_MACHINE(STRING) = "archlinux-desktop"
WM_CLASS(STRING) = "steam_app_2073850", "steam_app_2073850"
WM_PROTOCOLS(ATOM): protocols WM_DELETE_WINDOW, _NET_WM_PING
_WINE_ALLOW_FLIP(CARDINAL) = 0
STEAM_GAME(CARDINAL) = 2073850
This sounds like a prime candidate for the CursorBarrier option in fvwm3-1.1.1
Wew, that took a moment to figure out. I'm yet to test how well this works in games yet, but I did come up with a solution using CursorBarrier (alt+tab toggles a CursorBarrier on my primary monitor).
SetEnv TabToggle 0
DestroyFunc AltTab
AddToFunc AltTab
+ I Test (EnvMatch TabToggle 0) CursorBarrier 50 15 0 0
+ I TestRc (EnvMatch TabToggle 1) CursorBarrier destroy
+ I Test (EnvMatch TabToggle 0) SetEnv TabToggle 1
+ I TestRc (EnvMatch TabToggle 1) SetEnv TabToggle 0
Silent Key Tab A M AltTab
Out of curiosity, does anyone know why this bug happens in the first place? I have a feeling there might be some side effects to how well mouse input is received from just locking the mouse to bounds, vs actually having the window properly focus and lock the mouse as is intended. I play a lot of games that are sensitive to mouse input problems (fast-paced competitive quake for example) and would love a real fix.
This is hopefully a workaround for now though.
Possible useful discovery. I'm using 'DesktopConfiguration per-monitor' and the issue only happens have after switched to a different page and back. Upon starting games, everything seems fine from what I can tell, but as soon as I switch page and back to the game, the mouse stops focusing/locking to the game and leaves the screen, so it seems directly related to changing page on the monitor that the game is on (though if I just tab out to another monitor and keep the games monitor on the same page, the issue doesn't seem to happen?), the above solution seems like an okish workaround for now.
Edit; Not as useful as I thought. CursorBarrier fails when I pause the game and my mouse is warped to the left of my left monitor, which then means my mouse is stuck outside of my primary monitor by the barrier. I have to destroy the barrier, move my mouse back to the main monitor, and create the barrier again. If there was a way to make the barrier always keep the mouse within its bounds (like min/max the mouse coordinates to the bounds) then it would work, but looking at the PR that added CursorBarrier I can't see a way to do that.