Commit graph

34 commits

Author SHA1 Message Date
Ethan Lee 151f953815 wayland: Implement RaiseWindow with xdg-activation 2021-06-02 12:59:07 -07:00
Christian Rauch 424bbaec06 wayland: destroy frame callback when window is destroyed 2021-05-01 14:19:25 -04:00
Ryan C. Gordon c54c16d353
wayland: don't hang in SDL_GL_SwapBuffers if the compositor is ghosting us.
If you hide a window on Mutter, for example, the compositor never requests
new frames, which will cause Mesa to block forever in eglSwapBuffers to
satisfy the swap interval.

We now always set the swap interval to 0 and manage this ourselves, handing
the frame to Wayland when it requests a new one, and timing out at 10fps just
to keep apps moving if the compositor wants no frames at all.

My understanding is that other protocols are coming that might improve upon
this solution, but for now it solves the total hang.

Fixes #4335.
2021-04-30 13:20:35 -04:00
Ethan Lee 8e3ec34d34 wayland: Refactor toplevel mapping, implement HideWindow 2021-04-21 13:11:47 -04:00
Ethan Lee fcbfe33ce5 wayland: Implement SetWindowModalFor 2021-04-19 00:14:15 -04:00
David Edmundson f6a09ef1a9 wayland: Drop support for kwin specific decoration management
KWin has supported the shared and formalised zxdg_decoration since
Plasma 5.16 which came out mid 2019.

Whilst it made sense to support them both for a while, it should not be
needed for future SDL releases.
2021-04-07 13:54:07 -07:00
Ethan Lee 57a927e8d7 wayland: Explicitly set min/max size for xdg-shell 2021-02-28 19:37:31 -08:00
Cameron Gutman a0d3c6c63c Rename SetWindowGrab() to SetWindowMouseGrab() 2021-02-10 10:22:16 -05:00
Cameron Gutman e1f73e642b Refactor keyboard grab to be managed by the video core
This gives us flexibility to add others hints to control keyboard grab behavior
without having to touch all of the backends. It also allows us to possibly
expose keyboard grab separately from mouse grab for applications that want to
manage those independently.
2021-02-10 10:22:16 -05:00
Ethan Lee e787282ba8 Implement Wayland_SetWindowResizable 2021-01-24 00:51:26 -05:00
Cameron Gutman bd553ea868 Implement support for inhibiting the screensaver on Wayland
We support both the org.freedesktop.ScreenSaver D-Bus API (same as the X11
backend) and the Wayland idle_inhibit_unstable_v1 protocol.

Some Wayland compositors only support one or the other, so we need both to
for broad compatibility.
2021-01-24 00:51:25 -05:00
Cameron Gutman 19236b462a Implement support for minimizing windows on Wayland
This required a bit of extra code to deal with the transition from minimized
back to fullscreen
2021-01-24 00:51:25 -05:00
Cameron Gutman d789ba8332 Implement keyboard grab support for Wayland
Use zwp_keyboard_shortcuts_inhibit_manager_v1 to allow SDL applications
to capture system keyboard shortcuts like Alt+Tab when keyboard grab is
enabled via SDL_HINT_GRAB_KEYBOARD.
2021-01-24 00:51:24 -05:00
Sam Lantinga 9130f7c377 Updated copyright for 2021 2021-01-02 10:25:38 -08:00
Tudor Brindus 1a291ab118 wayland: add support for SDL_SetWindowGrab 2020-04-17 13:55:44 -04:00
Ryan C. Gordon a77a890d4a wayland: Don't delay pending surface resize handling on Vulkan.
OpenGL apparently needs to not do any drawing between wl_egl_window_resize
and eglSwapBuffers, but Vulkan apps don't use SDL to present, so they
never call into an equivalent of SDL_GL_SwapWindow where our Wayland code
was handling pending resize work.

Fixes Bugzilla #4722.
2020-02-14 00:58:36 -05:00
Sam Lantinga a8780c6a28 Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
Sebastian Krzyszkowiak 797b28133c wayland: HiDPI support 2019-06-12 00:55:05 +02:00
Sylvain Becker b8e5c561d8 Bug 4576: remove touch/mouse duplication for Wayland 2019-04-02 17:07:54 +02:00
Sam Lantinga 5e13087b0f Updated copyright for 2019 2019-01-04 22:01:14 -08:00
Ryan C. Gordon bd3ee07c83 wayland: Send SDL_TOUCH_MOUSEID mouse events for touches. 2018-12-05 16:49:38 -05:00
Sebastian Krzyszkowiak 5f98051457 wayland: ask xdg-decoration protocol extension to use server-side decorations if possible. 2018-11-04 21:08:40 +01:00
Sebastian Krzyszkowiak 48917e0e70 wayland: fix resizing and fullscreen toggling
For starters, we need to correctly respond to 0,0 configure after unsetting
fullscreen. Also, turns out that there should be no drawing calls at all
in between eglSwapBuffers and wl_egl_window_resize, as otherwise EGL can
already allocate a wrongly sized buffer for a next frame, so handle those
together.
2018-11-07 01:08:35 +01:00
Ryan C. Gordon a5ebd4d775 wayland: ask KDE protocol extension to use server-side decorations if possible. 2018-10-29 10:14:59 -04:00
Ryan C. Gordon c8ac909674 wayland: Implemented xdg-wm-base support.
This is just in parity with the existing zxdg-shell-unstable-v6 code. Making
the Wayland target robust (and uh, with title bars) is going to take a lot
of work on top of this.
2018-06-24 22:42:36 -07:00
Ryan C. Gordon 2df59062dc wayland: zxdg_shell_v6 needs a configure event before using a surface at all.
Fixes Bugzilla #4109.
Fixes Bugzilla #4119.
2018-04-15 17:42:09 -04:00
Ryan C. Gordon cd53220749 wayland: Add support for xdg-shell protocol (unstable v6).
This is meant to be the desktop-enhanced version of wl_shell. Right now we
just match what the existing wl_shell code does, but there are other areas of
functionality available to us now, that we can fill in later.

This uses the "unstable" API, since this is what ships in Ubuntu 17.10 (as
part of Wayland 1.10), but Wayland 1.12 promotes this to stable with extremely
minor changes. We will add support for the stable version when it makes sense
to do so.
2018-02-07 13:13:55 -05:00
Sam Lantinga e3cc5b2c6b Updated copyright for 2018 2018-01-03 10:03:25 -08:00
Sam Lantinga 0d011ec66d Renaming of guard header names to quiet -Wreserved-id-macro 2017-08-28 00:22:23 -07:00
Sam Lantinga 45b774e3f7 Updated copyright for 2017 2017-01-01 18:33:28 -08:00
Sam Lantinga eea76fc199 Fixed bug 3063 - Wayland: SDL resizes EGL surface to 0x0.
x414e54

Wayland will sometimes send empty resize events (0 width and 0 height) to the client. I have not worked out the exact conditions a client would receive these but I can assume it might be if the window is offscreen or not mapped yet.

This causes issues with some SDL clients as they receive the 0x0 event and unexpected resize event or might not request to resize back to the correct size.

As per the wl_shell Wayland spec configure events are only a suggestion and the client is free to ignore or pick a different size (this is how min/max and fixed aspect ratio is supped to be implemented).

A patch is attached but is just the first iteration and I will fix any issues such as checking for FULLSCREEN/MAXIMIZED or RESIZABLE flags unless someone else fixes this first.

I have update to take into account non resizable and fullscreen windows. Also adding in maximize/restore and title functions for Wayland.
2016-10-07 18:11:03 -07:00
Sam Lantinga f11a440999 wayland: Add support for relative mouse mode, by Jonas ?dahl <jadahl@gmail.com>
Generate the C protocol files from the protocol XML files installed by
wayland-protocols, and use them to implement support for relative pointer
motions and pointer locking.

Note that at the time, the protocol is unstable and may change in the future.
Any future breaking changes will, however, fail gracefully and result in no
regressions compared to before this patch.
2016-09-01 01:26:56 -07:00
Sam Lantinga 42065e785d Updated copyright to 2016 2016-01-02 10:10:34 -08:00
Philipp Wiesemann 0e45984fa0 Fixed crash if initialization of EGL failed but was tried again later.
The internal function SDL_EGL_LoadLibrary() did not delete and remove a mostly
uninitialized data structure if loading the library first failed. A later try to
use EGL then skipped initialization and assumed it was previously successful
because the data structure now already existed. This led to at least one crash
in the internal function SDL_EGL_ChooseConfig() because a NULL pointer was
dereferenced to make a call to eglBindAPI().
2015-06-21 17:33:46 +02:00