| Summary: | wayland: add support for fullscreen shell compositors. | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Nathaniel Lewis <nlewis> |
| Component: | video | Assignee: | Gabriel Jacobo <gabomdq> |
| Status: | ASSIGNED --- | QA Contact: | Sam Lantinga <slouken> |
| Severity: | enhancement | ||
| Priority: | P2 | CC: | nlewis |
| Version: | HG 2.1 | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Attachments: | Proposed patch | ||
Gabriel, are you maintaining the Wayland code these days? |
Created attachment 2721 [details] Proposed patch Add support for wayland compositors that implement fullscreen-shell. An example of which is weston with the fullscreen-shell plugins (instead of the default desktop-shell one). The idea of the fullscreen compositor is that only one, fullscreen surface is visible at any time without any sort of window management. The primary purpose is to run other compositors to provide fast switching, but there may be other interesting usages of them. I've attached a proposed patch. fullscreen compositors do not have the wl_shell interface, so all functions using wl_shell or wl_shell_surface had to be guarded. The window show and window show fullscreen functions had to be modified to call zwp_fullscreen_shell_present in the event that the SDL application is running in a fullscreen compositor (checked by whether or not zwp_fullscreen_shell is available). Testing: - Apply patch to master SDL and build - Launch weston via "weston --no-config --width=1024 --height=768 --shell=fullscreen-shell.so --backend=<drm-backend.so, wayland-backend.so or x11-backend.so>" - Run an SDL client via ssh (if drm) or locally (if wayland or x11) with WAYLAND_DISPLAY set to the correct display. Notes: 1) I noticed that without these changes if a window is CREATED with flags specifying fullscreen, the surface will be created with the display's dimensions regardless of the specified size. It's curious to me as wayland supports fullscreening arbitrarily sized surfaces via scaling. If it is not created as fullscreen and then later made fullscreen via SDL_SetWindowFullscreen, it is drawn with the regular wayland fullscreen method (draw centered on a black background). 2) Since there is no concept of "fullscreen" and "windowed" in fullscreen compositors (only one surface draws to the output at a time), I made "windowed" mode drawing the surface at its specified resolution centered on the display (fullscreen presentation mode "default") and "fullscreen" mode drawing zoomed on the display (no cropping). 3) Fullscreen compositors support mode switching by trying to match the surface size to an output mode. Since the existing wayland video implementation doesn't support mode switching, I didn't add it quite yet. Still working on a graceful method to support it, but the patch as is is functional. Need to understand (1) a bit more first.