Go to the documentation of this file.
22 #include "../../SDL_internal.h"
24 #if SDL_VIDEO_DRIVER_WAYLAND && SDL_VIDEO_OPENGL_EGL
26 #include "../SDL_sysvideo.h"
27 #include "../../events/SDL_windowevents_c.h"
28 #include "../SDL_egl_c.h"
45 handle_ping_wl_shell_surface(
void *
data,
struct wl_shell_surface *shell_surface,
52 handle_configure_wl_shell_surface(
void *
data,
struct wl_shell_surface *shell_surface,
57 struct wl_region *region;
94 handle_popup_done_wl_shell_surface(
void *
data,
struct wl_shell_surface *shell_surface)
99 handle_ping_wl_shell_surface,
100 handle_configure_wl_shell_surface,
101 handle_popup_done_wl_shell_surface
108 handle_configure_zxdg_shell_surface(
void *
data,
struct zxdg_surface_v6 *zxdg,
uint32_t serial)
112 struct wl_region *region;
126 handle_configure_zxdg_shell_surface
131 handle_configure_zxdg_toplevel(
void *
data,
132 struct zxdg_toplevel_v6 *zxdg_toplevel_v6,
135 struct wl_array *states)
169 handle_close_zxdg_toplevel(
void *
data,
struct zxdg_toplevel_v6 *zxdg_toplevel_v6)
176 handle_configure_zxdg_toplevel,
177 handle_close_zxdg_toplevel
183 handle_configure_xdg_shell_surface(
void *
data,
struct xdg_surface *xdg,
uint32_t serial)
187 struct wl_region *region;
201 handle_configure_xdg_shell_surface
206 handle_configure_xdg_toplevel(
void *
data,
207 struct xdg_toplevel *xdg_toplevel,
210 struct wl_array *states)
248 handle_close_xdg_toplevel(
void *
data,
struct xdg_toplevel *xdg_toplevel)
255 handle_configure_xdg_toplevel,
256 handle_close_xdg_toplevel
262 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
264 handle_onscreen_visibility(
void *
data,
265 struct qt_extended_surface *qt_extended_surface,
int32_t visible)
270 handle_set_generic_property(
void *
data,
271 struct qt_extended_surface *qt_extended_surface,
const char *
name,
272 struct wl_array *
value)
277 handle_close(
void *
data,
struct qt_extended_surface *qt_extended_surface)
283 static const struct qt_extended_surface_listener extended_surface_listener = {
284 handle_onscreen_visibility,
285 handle_set_generic_property,
308 if (version < 2000006) {
314 info->
info.
wl.display =
data->waylandData->display;
316 info->
info.
wl.shell_surface =
data->shell_surface.wl;
361 struct wl_output *
output = (
struct wl_output *)
window->fullscreen_mode.driverdata;
365 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
367 QtExtendedSurface_OnHintChanged(
void *userdata,
const char *
name,
368 const char *oldValue,
const char *newValue)
370 struct qt_extended_surface *qt_extended_surface = userdata;
377 int32_t orientation = QT_EXTENDED_SURFACE_ORIENTATION_PRIMARYORIENTATION;
379 if (newValue !=
NULL) {
380 if (strcmp(newValue,
"portrait") == 0) {
381 orientation = QT_EXTENDED_SURFACE_ORIENTATION_PORTRAITORIENTATION;
382 }
else if (strcmp(newValue,
"landscape") == 0) {
383 orientation = QT_EXTENDED_SURFACE_ORIENTATION_LANDSCAPEORIENTATION;
384 }
else if (strcmp(newValue,
"inverted-portrait") == 0) {
385 orientation = QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDPORTRAITORIENTATION;
386 }
else if (strcmp(newValue,
"inverted-landscape") == 0) {
387 orientation = QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDLANDSCAPEORIENTATION;
391 qt_extended_surface_set_content_orientation(qt_extended_surface, orientation);
395 if (newValue !=
NULL) {
396 char *tmp = strdup(newValue);
397 char *saveptr =
NULL;
399 char *flag = strtok_r(tmp,
" ", &saveptr);
401 if (strcmp(flag,
"OverridesSystemGestures") == 0) {
402 flags |= QT_EXTENDED_SURFACE_WINDOWFLAG_OVERRIDESSYSTEMGESTURES;
403 }
else if (strcmp(flag,
"StaysOnTop") == 0) {
404 flags |= QT_EXTENDED_SURFACE_WINDOWFLAG_STAYSONTOP;
405 }
else if (strcmp(flag,
"BypassWindowManager") == 0) {
410 flag = strtok_r(
NULL,
" ", &saveptr);
416 qt_extended_surface_set_window_flags(qt_extended_surface,
flags);
420 static void QtExtendedSurface_Subscribe(
struct qt_extended_surface *
surface,
const char *
name)
425 static void QtExtendedSurface_Unsubscribe(
struct qt_extended_surface *
surface,
const char *
name)
468 WAYLAND_wl_display_flush( viddata->
display );
475 struct wl_region *region;
496 data->waylandData =
c;
509 }
else if (
c->shell.zxdg) {
520 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
521 if (
c->surface_extension) {
522 data->extended_surface = qt_surface_extension_get_extended_surface(
523 c->surface_extension,
data->surface);
530 data->egl_window = WAYLAND_wl_egl_window_create(
data->surface,
537 return SDL_SetError(
"failed to create a window surface");
541 if (
data->shell_surface.xdg.surface) {
545 }
else if (
c->shell.zxdg) {
546 if (
data->shell_surface.zxdg.surface) {
551 if (
data->shell_surface.wl) {
557 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
558 if (
data->extended_surface) {
559 qt_extended_surface_set_user_data(
data->extended_surface,
data);
560 qt_extended_surface_add_listener(
data->extended_surface,
561 &extended_surface_listener,
data);
570 if (
c->relative_mouse_mode) {
575 WAYLAND_wl_display_flush(
c->display);
580 if (
data->shell_surface.xdg.surface) {
581 while (!
data->shell_surface.xdg.initial_configure_seen) {
582 WAYLAND_wl_display_flush(
c->display);
583 WAYLAND_wl_display_dispatch(
c->display);
586 }
else if (
c->shell.zxdg) {
587 if (
data->shell_surface.zxdg.surface) {
588 while (!
data->shell_surface.zxdg.initial_configure_seen) {
589 WAYLAND_wl_display_flush(
c->display);
590 WAYLAND_wl_display_dispatch(
c->display);
602 struct wl_region *region;
637 WAYLAND_wl_egl_window_destroy(wind->
egl_window);
639 if (
data->shell.xdg) {
646 }
else if (
data->shell.zxdg) {
659 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
660 if (wind->extended_surface) {
663 qt_extended_surface_destroy(wind->extended_surface);
669 WAYLAND_wl_display_flush(
data->display);
static void zxdg_toplevel_v6_unset_fullscreen(struct zxdg_toplevel_v6 *zxdg_toplevel_v6)
struct zxdg_toplevel_v6 * toplevel
#define SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION
A variable describing the content orientation on QtWayland-based platforms.
static struct wl_surface * wl_compositor_create_surface(struct wl_compositor *wl_compositor)
static struct wl_shell_surface * wl_shell_get_shell_surface(struct wl_shell *wl_shell, struct wl_surface *surface)
#define SDL_HINT_QTWAYLAND_WINDOW_FLAGS
Flags to set on QtWayland windows to integrate with the native window manager.
static void wl_surface_set_user_data(struct wl_surface *wl_surface, void *user_data)
struct zxdg_shell_v6 * zxdg
static void wl_surface_commit(struct wl_surface *wl_surface)
static void wl_surface_set_opaque_region(struct wl_surface *wl_surface, struct wl_region *region)
GLint GLint GLsizei width
union SDL_xdg_shell_surface::@37 roleobj
static void wl_shell_surface_pong(struct wl_shell_surface *wl_shell_surface, uint32_t serial)
static void zxdg_toplevel_v6_destroy(struct zxdg_toplevel_v6 *zxdg_toplevel_v6)
static int wl_shell_surface_add_listener(struct wl_shell_surface *wl_shell_surface, const struct wl_shell_surface_listener *listener, void *data)
static struct zxdg_toplevel_v6 * zxdg_surface_v6_get_toplevel(struct zxdg_surface_v6 *zxdg_surface_v6)
void Wayland_MaximizeWindow(_THIS, SDL_Window *window)
@ SDL_WINDOWEVENT_RESIZED
struct xdg_surface * surface
static void wl_region_add(struct wl_region *wl_region, int32_t x, int32_t y, int32_t width, int32_t height)
#define SDL_WINDOWPOS_UNDEFINED
static void xdg_toplevel_set_fullscreen(struct xdg_toplevel *xdg_toplevel, struct wl_output *output)
#define SDL_GL_LoadLibrary
struct zxdg_surface_v6 * surface
static void xdg_toplevel_set_app_id(struct xdg_toplevel *xdg_toplevel, const char *app_id)
static void zxdg_toplevel_v6_set_maximized(struct zxdg_toplevel_v6 *zxdg_toplevel_v6)
struct wl_shell_surface * wl
static void xdg_surface_destroy(struct xdg_surface *xdg_surface)
static void xdg_toplevel_unset_fullscreen(struct xdg_toplevel *xdg_toplevel)
struct wl_compositor * compositor
static void zxdg_surface_v6_ack_configure(struct zxdg_surface_v6 *zxdg_surface_v6, uint32_t serial)
static int xdg_toplevel_add_listener(struct xdg_toplevel *xdg_toplevel, const struct xdg_toplevel_listener *listener, void *data)
SDL_VideoData * waylandData
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
The type used to identify a window.
static int xdg_surface_add_listener(struct xdg_surface *xdg_surface, const struct xdg_surface_listener *listener, void *data)
static void xdg_toplevel_set_title(struct xdg_toplevel *xdg_toplevel, const char *title)
static int zxdg_toplevel_v6_add_listener(struct zxdg_toplevel_v6 *zxdg_toplevel_v6, const struct zxdg_toplevel_v6_listener *listener, void *data)
static void wl_region_destroy(struct wl_region *wl_region)
static void wl_shell_surface_set_class(struct wl_shell_surface *wl_shell_surface, const char *class_)
static struct wl_region * wl_compositor_create_region(struct wl_compositor *wl_compositor)
void Wayland_ShowWindow(_THIS, SDL_Window *window)
static void xdg_toplevel_destroy(struct xdg_toplevel *xdg_toplevel)
static void wl_shell_surface_destroy(struct wl_shell_surface *wl_shell_surface)
void Wayland_SetWindowTitle(_THIS, SDL_Window *window)
static SDL_VideoDevice * _this
static struct xdg_surface * xdg_wm_base_get_xdg_surface(struct xdg_wm_base *xdg_wm_base, struct wl_surface *surface)
static void wl_shell_surface_set_title(struct wl_shell_surface *wl_shell_surface, const char *title)
EGLSurface EGLNativeWindowType * window
union SDL_SysWMinfo::@18 info
static void xdg_surface_ack_configure(struct xdg_surface *xdg_surface, uint32_t serial)
GLint GLint GLsizei GLsizei height
GLuint const GLchar * name
void Wayland_RestoreWindow(_THIS, SDL_Window *window)
SDL_bool initial_configure_seen
static void zxdg_toplevel_v6_set_title(struct zxdg_toplevel_v6 *zxdg_toplevel_v6, const char *title)
static struct xdg_toplevel * xdg_surface_get_toplevel(struct xdg_surface *xdg_surface)
@ WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT
SDL_xdg_shell_surface xdg
SDL_bool Wayland_GetWindowWMInfo(_THIS, SDL_Window *window, SDL_SysWMinfo *info)
static void xdg_surface_set_user_data(struct xdg_surface *xdg_surface, void *user_data)
void Wayland_DestroyWindow(_THIS, SDL_Window *window)
static int zxdg_surface_v6_add_listener(struct zxdg_surface_v6 *zxdg_surface_v6, const struct zxdg_surface_v6_listener *listener, void *data)
static void wl_shell_surface_set_maximized(struct wl_shell_surface *wl_shell_surface, struct wl_output *output)
struct wl_egl_window * egl_window
#define SDL_OutOfMemory()
static void zxdg_surface_v6_set_user_data(struct zxdg_surface_v6 *zxdg_surface_v6, void *user_data)
SDL_bool initial_configure_seen
struct wl_display * display
static void wl_shell_surface_set_fullscreen(struct wl_shell_surface *wl_shell_surface, uint32_t method, uint32_t framerate, struct wl_output *output)
#define SDL_AddHintCallback
GLsizei const GLfloat * value
void Wayland_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *_display, SDL_bool fullscreen)
union SDL_WindowData::@38 shell_surface
SDL_zxdg_shell_surface zxdg
int SDL_SendWindowEvent(SDL_Window *window, Uint8 windowevent, int data1, int data2)
int Wayland_input_lock_pointer(struct SDL_WaylandInput *input)
struct xdg_toplevel * toplevel
int Wayland_SetWindowHitTest(SDL_Window *window, SDL_bool enabled)
GLenum GLenum GLsizei const GLuint GLboolean enabled
static struct zxdg_surface_v6 * zxdg_shell_v6_get_xdg_surface(struct zxdg_shell_v6 *zxdg_shell_v6, struct wl_surface *surface)
static void zxdg_toplevel_v6_set_app_id(struct zxdg_toplevel_v6 *zxdg_toplevel_v6, const char *app_id)
#define SDL_DelHintCallback
static void wl_surface_destroy(struct wl_surface *wl_surface)
static void xdg_toplevel_set_maximized(struct xdg_toplevel *xdg_toplevel)
union SDL_zxdg_shell_surface::@36 roleobj
static void wl_shell_surface_set_user_data(struct wl_shell_surface *wl_shell_surface, void *user_data)
struct SDL_VideoData::@35 shell
static void wl_shell_surface_set_toplevel(struct wl_shell_surface *wl_shell_surface)
static void zxdg_surface_v6_destroy(struct zxdg_surface_v6 *zxdg_surface_v6)
struct SDL_SysWMinfo::@18::@20 wl
static void zxdg_toplevel_v6_set_fullscreen(struct zxdg_toplevel_v6 *zxdg_toplevel_v6, struct wl_output *output)
int Wayland_CreateWindow(_THIS, SDL_Window *window)
void Wayland_SetWindowSize(_THIS, SDL_Window *window)