openspades icon indicating copy to clipboard operation
openspades copied to clipboard

[Feature request] Support Wayland natively

Open liferooter opened this issue 4 years ago • 5 comments

It will be good to support Wayland. I still can run OpenSpades on Wayland via XWayland, but it works bad with some features such as scaling (personally I use 1.25 scaling on my 14" laptop). If you use scaliing on Wayland, all XWayland clients become blurry, OpenSpades becomes unplayable.

liferooter avatar Jul 22 '21 05:07 liferooter

This should just require an upgrade of the windowing library?

NotAFile avatar Jul 22 '21 07:07 NotAFile

This should just require an upgrade of the windowing library?

OpenSpades uses OpenGL, it's not as trivial as it would be with GTK or Qt. Wayland uses EGL, X uses GLX

liferooter avatar Jul 22 '21 07:07 liferooter

SDL2 does have a Wayland support (https://github.com/libsdl-org/SDL/issues/2710), which can be enabled by specifying env SDL_VIDEODRIVER=wayland. GLEW needs to be configured for EGL at build time (glew vs glew-egl on NixOS); otherwise it'll fail to initialize with "Unknown error".

I tried this just now (coincidentally I use a Wayland-based desktop and 1.25 scaling, too). Unfortunately, it seems more broken than running on XWayland in the following ways:

  • The pixel format is locked to RGB565, which causes severe banding.
  • In the full screen mode, the specified screen resolution is ignored.
  • Also in the full screen mode, the window size is larger than the screen. (Similar to #927; I think the final window size is incorrectly calculated as final_size_in_logical_pixels = monitor_size_in_physical_pixels.)
  • In the window mode, the window is not centered on the screen.
  • The startup window lacks a window decoration. (https://github.com/libsdl-org/SDL/issues/3739)

yvt avatar Jul 22 '21 08:07 yvt

OpenSpades uses OpenGL, it's not as trivial as it would be with GTK or Qt. Wayland uses EGL, X uses GLX

That has nothing to do with each other. You can request a variety of contexts (including OpenGL) via EGL and other APIs both under Wayland and X. Wayland just gives you a buffer, it doesn't care much how you render into it.

NotAFile avatar Jul 22 '21 10:07 NotAFile

considering i don't see it mentioned, thought i would let you know that on manjaro sway (version 1.8.1) the mouse is invisible when SDL_VIDEODRIVER is set to wayland

unmellow avatar Sep 06 '23 21:09 unmellow