Quake3e icon indicating copy to clipboard operation
Quake3e copied to clipboard

wayland: cursor stucks on screen

Open shumvgolove opened this issue 3 years ago • 24 comments

OS: Alpine Linux Wayland compositor: sway 1.5.1 Graphics card: AMD RX590 Quake3e version: master db258d4901b15bf82f661195a2572f47f4dac8d8 Configs: none

After launching q3e in wayland mode (SDL_VIDEODRIVER=wayland) cursor gets stuck on the screen: img (and can not be captured with wayland's grim). Changing workspaces and then selecting q3e window resolves the issue. This is not happening with ioq3.

shumvgolove avatar Mar 01 '21 14:03 shumvgolove

Try with recent build

ec- avatar Mar 02 '21 11:03 ec-

Everything's same.

shumvgolove avatar Mar 02 '21 12:03 shumvgolove

What SDL version? Pretty sure this is a SDL bug. I saw a commit last month that fixed similar for kde and wayland but this is post 2.0.14 but it mentioned that sway and others may have already been fixed.

ensiform avatar Mar 02 '21 12:03 ensiform

Yeah, it's sdl2 2.0.14.

shumvgolove avatar Mar 02 '21 12:03 shumvgolove

Try to remove SDL_WINDOW_BORDERLESS flag for fullscreen mode in sdl_glimp

ec- avatar Mar 02 '21 14:03 ec-

Doesn't change anything unfortunately.

shumvgolove avatar Mar 02 '21 21:03 shumvgolove

Try most recent build

ec- avatar Mar 06 '21 20:03 ec-

https://github.com/ec-/Quake3e/commit/cab52dfee9ff39ccc0a600b65e7c2a8cc903ee8c: same.

shumvgolove avatar Mar 07 '21 07:03 shumvgolove

Uncomment DEBUG_EVENTS definition in sdl_input.c and show window events order - I suspect that it may be different for x11/wayland backends so gw_active / gw_minimized flags may be not correctly set at initial startup.

ec- avatar Mar 07 '21 18:03 ec-

It seems like wayland delays input focus a lot comparing to x11, try recent build, I hope it will fix everything. If it doesn't help - provide event log when you're changing workspaces when normal capture occurs

ec- avatar Mar 08 '21 18:03 ec-

Well, everything's same..

Here's log when cursor disappears when changing workspaces: w.txt

shumvgolove avatar Mar 08 '21 21:03 shumvgolove

Try to add SDL_SetWindowGrab( SDL_window, SDL_FALSE ); at this line

Also tell if this happens in windowed mode?

ec- avatar Mar 08 '21 22:03 ec-

SDL_SetWindowGrab( SDL_window, SDL_FALSE ); doesn't work.

Also tell if this happens in windowed mode?

I'm not sure I can do that. sway instantly launches q3e in fullscreen and only then I can change it to "windowed". sway is tiling wm like i3 after all.

shumvgolove avatar Mar 08 '21 22:03 shumvgolove

I believe etlegacy project recently discovered there's some issues with their new Linux builds and wayland. Plus also some weirdness with fullscreen<>windowed under both.

Perhaps worth checking what they have been investigating and fixing since the 2.77 release.

ensiform avatar Mar 09 '21 00:03 ensiform

Try recent build, and show event log

ec- avatar Mar 09 '21 14:03 ec-

https://github.com/ec-/Quake3e/commit/6ecbc29b5c9565fa531b77e62efa4f8f4f4cc555: w2.txt

shumvgolove avatar Mar 09 '21 14:03 shumvgolove

https://github.com/ec-/Quake3e/commit/553d4a4c09476e353ced42210052cb46a5d74dc0 fixed the issue with stucked cursor! Thank you!

But there's one catch... After exiting q3e, cursor remains invisible until I, again, switch between workspaces. This is similar with ioq3 behavior.

shumvgolove avatar Mar 10 '21 16:03 shumvgolove

I'm installed fedora 33 and tested it in wayland: it seems like mouse should be captured exactly after FOCUS_GAINED and ENTER events.

To fix invisible cursor try to insert SDL_ShowCursor( SDL_TRUE ); there

Also I discovered a few other bugs related to sdl2+wayland:

  • it bypasses characters to console input when using CTRL+key shortcuts (CTRL+l for example)
  • recently pressed key may stuck at vid_restart

As for me - it looks a bit unstable for everyday use

ec- avatar Mar 10 '21 18:03 ec-

SDL_ShowCursor( SDL_TRUE ); doesn't fix it.

shumvgolove avatar Mar 10 '21 23:03 shumvgolove

Unfortunately, this is not reproducible for me on fedora-33 and ubuntu-20.10.

Also, I found another sdl2+wayland-specific bug: repeating key-down events is not sent when you keep some key down, this is mostly noticeable if you want to scroll in-game console

ec- avatar Mar 14 '21 10:03 ec-

Try with recent buid.

Another sdl2+wayland bug found: SDL_MinimizeWindow( SDL_window ); does not work - hence \minimize bind is useless

ec- avatar Mar 16 '21 18:03 ec-

https://github.com/ec-/Quake3e/commit/9fa902327f5850e15e2ab9f1759657f890386ca9: I've noticed that executing q3e in terminal (tried with alacritty and foot) and then exiting the game always makes cursor invisible (in rare cases cursor gets appeard, which is weird). Executing q3e through wofi (like dmenu, but for wayland) on clear workspace always has visible cursor upon exiting.

shumvgolove avatar Mar 16 '21 20:03 shumvgolove

It's https://github.com/swaywm/sway/issues/6008 bug, sorry for the fuss. While initial issue has been fixed, it's seems like we need to open a new "general sdl2+wayland tracking issue" to track everything in one place.

shumvgolove avatar Mar 17 '21 10:03 shumvgolove