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" 37 handle_ping(
void *
data,
struct wl_shell_surface *shell_surface,
44 handle_configure(
void *
data,
struct wl_shell_surface *shell_surface,
49 struct wl_region *region;
54 if (width == 0 || height == 0) {
60 if (window->
max_w > 0) {
65 if (window->
max_h > 0) {
74 if (width == window->
w && height == window->
h) {
80 WAYLAND_wl_egl_window_resize(wind->
egl_window, window->
w, window->
h, 0, 0);
90 handle_popup_done(
void *data,
struct wl_shell_surface *shell_surface)
100 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 102 handle_onscreen_visibility(
void *data,
103 struct qt_extended_surface *qt_extended_surface,
int32_t visible)
108 handle_set_generic_property(
void *data,
109 struct qt_extended_surface *qt_extended_surface,
const char *
name,
110 struct wl_array *
value)
115 handle_close(
void *data,
struct qt_extended_surface *qt_extended_surface)
121 static const struct qt_extended_surface_listener extended_surface_listener = {
122 handle_onscreen_visibility,
123 handle_set_generic_property,
146 if (version < 2000006) {
180 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 182 QtExtendedSurface_OnHintChanged(
void *userdata,
const char *
name,
183 const char *oldValue,
const char *newValue)
185 struct qt_extended_surface *qt_extended_surface = userdata;
192 int32_t orientation = QT_EXTENDED_SURFACE_ORIENTATION_PRIMARYORIENTATION;
194 if (newValue !=
NULL) {
195 if (strcmp(newValue,
"portrait") == 0) {
196 orientation = QT_EXTENDED_SURFACE_ORIENTATION_PORTRAITORIENTATION;
197 }
else if (strcmp(newValue,
"landscape") == 0) {
198 orientation = QT_EXTENDED_SURFACE_ORIENTATION_LANDSCAPEORIENTATION;
199 }
else if (strcmp(newValue,
"inverted-portrait") == 0) {
200 orientation = QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDPORTRAITORIENTATION;
201 }
else if (strcmp(newValue,
"inverted-landscape") == 0) {
202 orientation = QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDLANDSCAPEORIENTATION;
206 qt_extended_surface_set_content_orientation(qt_extended_surface, orientation);
210 if (newValue !=
NULL) {
211 char *tmp = strdup(newValue);
212 char *saveptr =
NULL;
214 char *flag = strtok_r(tmp,
" ", &saveptr);
216 if (strcmp(flag,
"OverridesSystemGestures") == 0) {
217 flags |= QT_EXTENDED_SURFACE_WINDOWFLAG_OVERRIDESSYSTEMGESTURES;
218 }
else if (strcmp(flag,
"StaysOnTop") == 0) {
219 flags |= QT_EXTENDED_SURFACE_WINDOWFLAG_STAYSONTOP;
220 }
else if (strcmp(flag,
"BypassWindowManager") == 0) {
225 flag = strtok_r(
NULL,
" ", &saveptr);
231 qt_extended_surface_set_window_flags(qt_extended_surface, flags);
235 static void QtExtendedSurface_Subscribe(
struct qt_extended_surface *
surface,
const char *name)
240 static void QtExtendedSurface_Unsubscribe(
struct qt_extended_surface *
surface,
const char *name)
286 struct wl_region *region;
288 data = calloc(1,
sizeof *data);
316 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 317 if (c->surface_extension) {
318 data->extended_surface = qt_surface_extension_get_extended_surface(
319 c->surface_extension, data->
surface);
327 window->
w, window->
h);
333 return SDL_SetError(
"failed to create a window surface");
339 &shell_surface_listener, data);
342 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 343 if (data->extended_surface) {
344 qt_extended_surface_set_user_data(data->extended_surface, data);
345 qt_extended_surface_add_listener(data->extended_surface,
346 &extended_surface_listener, data);
359 WAYLAND_wl_display_flush(c->
display);
368 struct wl_region *region;
370 WAYLAND_wl_egl_window_resize(wind->
egl_window, window->
w, window->
h, 0, 0);
396 WAYLAND_wl_egl_window_destroy(wind->
egl_window);
401 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 402 if (wind->extended_surface) {
405 qt_extended_surface_destroy(wind->extended_surface);
411 WAYLAND_wl_display_flush(data->
display);
#define SDL_HINT_QTWAYLAND_WINDOW_FLAGS
Flags to set on QtWayland windows to integrate with the native window manager.
void Wayland_SetWindowSize(_THIS, SDL_Window *window)
#define SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION
A variable describing the content orientation on QtWayland-based platforms.
static void wl_surface_set_user_data(struct wl_surface *wl_surface, void *user_data)
void Wayland_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *_display, SDL_bool fullscreen)
SDL_DisplayMode fullscreen_mode
static struct wl_region * wl_compositor_create_region(struct wl_compositor *wl_compositor)
static void wl_shell_surface_destroy(struct wl_shell_surface *wl_shell_surface)
int Wayland_SetWindowHitTest(SDL_Window *window, SDL_bool enabled)
static void wl_shell_surface_set_user_data(struct wl_shell_surface *wl_shell_surface, void *user_data)
struct wl_display * display
void Wayland_MaximizeWindow(_THIS, SDL_Window *window)
static void wl_shell_surface_set_toplevel(struct wl_shell_surface *wl_shell_surface)
void Wayland_ShowWindow(_THIS, SDL_Window *window)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
static void wl_shell_surface_set_fullscreen(struct wl_shell_surface *wl_shell_surface, uint32_t method, uint32_t framerate, struct wl_output *output)
static void wl_shell_surface_set_maximized(struct wl_shell_surface *wl_shell_surface, struct wl_output *output)
int Wayland_input_lock_pointer(struct SDL_WaylandInput *input)
#define SDL_WINDOWPOS_UNDEFINED
int SDL_SendWindowEvent(SDL_Window *window, Uint8 windowevent, int data1, int data2)
static void wl_region_add(struct wl_region *wl_region, int32_t x, int32_t y, int32_t width, int32_t height)
#define SDL_GL_LoadLibrary
static void wl_surface_destroy(struct wl_surface *wl_surface)
struct SDL_WaylandInput * input
int Wayland_CreateWindow(_THIS, SDL_Window *window)
static void wl_shell_surface_pong(struct wl_shell_surface *wl_shell_surface, uint32_t serial)
GLuint const GLchar * name
GLint GLint GLsizei width
static SDL_VideoDevice * _this
void Wayland_SetWindowTitle(_THIS, SDL_Window *window)
void Wayland_DestroyWindow(_THIS, SDL_Window *window)
struct wl_shell_surface * shell_surface
static void wl_region_destroy(struct wl_region *wl_region)
SDL_bool Wayland_GetWindowWMInfo(_THIS, SDL_Window *window, SDL_SysWMinfo *info)
SDL_VideoData * waylandData
GLsizei const GLfloat * value
static void wl_shell_surface_set_title(struct wl_shell_surface *wl_shell_surface, const char *title)
static struct wl_shell_surface * wl_shell_get_shell_surface(struct wl_shell *wl_shell, struct wl_surface *surface)
GLenum GLenum GLsizei const GLuint GLboolean enabled
#define SDL_OutOfMemory()
static void wl_surface_set_opaque_region(struct wl_surface *wl_surface, struct wl_region *region)
struct wl_compositor * compositor
GLint GLint GLsizei GLsizei height
void Wayland_RestoreWindow(_THIS, SDL_Window *window)
static struct wl_surface * wl_compositor_create_surface(struct wl_compositor *wl_compositor)
EGLSurface EGLNativeWindowType * window
The type used to identify a window.
#define SDL_AddHintCallback
#define SDL_DelHintCallback
static void wl_shell_surface_set_class(struct wl_shell_surface *wl_shell_surface, const char *class_)
union SDL_SysWMinfo::@18 info
struct SDL_SysWMinfo::@18::@20 wl
static int wl_shell_surface_add_listener(struct wl_shell_surface *wl_shell_surface, const struct wl_shell_surface_listener *listener, void *data)
struct wl_egl_window * egl_window