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" 44 handle_ping_wl_shell_surface(
void *
data,
struct wl_shell_surface *shell_surface,
51 handle_configure_wl_shell_surface(
void *
data,
struct wl_shell_surface *shell_surface,
56 struct wl_region *region;
61 if (width == 0 || height == 0) {
67 if (window->
max_w > 0) {
72 if (window->
max_h > 0) {
81 if (width == window->
w && height == window->
h) {
87 WAYLAND_wl_egl_window_resize(wind->
egl_window, window->
w, window->
h, 0, 0);
97 handle_popup_done_wl_shell_surface(
void *data,
struct wl_shell_surface *shell_surface)
102 handle_ping_wl_shell_surface,
103 handle_configure_wl_shell_surface,
104 handle_popup_done_wl_shell_surface
111 handle_configure_zxdg_shell_surface(
void *data,
struct zxdg_surface_v6 *zxdg,
uint32_t serial)
115 struct wl_region *region;
116 WAYLAND_wl_egl_window_resize(wind->
egl_window, window->
w, window->
h, 0, 0);
127 handle_configure_zxdg_shell_surface
132 handle_configure_zxdg_toplevel(
void *data,
133 struct zxdg_toplevel_v6 *zxdg_toplevel_v6,
136 struct wl_array *states)
144 if (width == 0 || height == 0) {
150 if (window->
max_w > 0) {
155 if (window->
max_h > 0) {
164 if (width == window->
w && height == window->
h) {
173 handle_close_zxdg_toplevel(
void *data,
struct zxdg_toplevel_v6 *zxdg_toplevel_v6)
180 handle_configure_zxdg_toplevel,
181 handle_close_zxdg_toplevel
185 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 187 handle_onscreen_visibility(
void *data,
188 struct qt_extended_surface *qt_extended_surface,
int32_t visible)
193 handle_set_generic_property(
void *data,
194 struct qt_extended_surface *qt_extended_surface,
const char *
name,
195 struct wl_array *
value)
200 handle_close(
void *data,
struct qt_extended_surface *qt_extended_surface)
206 static const struct qt_extended_surface_listener extended_surface_listener = {
207 handle_onscreen_visibility,
208 handle_set_generic_property,
231 if (version < 2000006) {
282 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 284 QtExtendedSurface_OnHintChanged(
void *userdata,
const char *
name,
285 const char *oldValue,
const char *newValue)
287 struct qt_extended_surface *qt_extended_surface = userdata;
294 int32_t orientation = QT_EXTENDED_SURFACE_ORIENTATION_PRIMARYORIENTATION;
296 if (newValue !=
NULL) {
297 if (strcmp(newValue,
"portrait") == 0) {
298 orientation = QT_EXTENDED_SURFACE_ORIENTATION_PORTRAITORIENTATION;
299 }
else if (strcmp(newValue,
"landscape") == 0) {
300 orientation = QT_EXTENDED_SURFACE_ORIENTATION_LANDSCAPEORIENTATION;
301 }
else if (strcmp(newValue,
"inverted-portrait") == 0) {
302 orientation = QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDPORTRAITORIENTATION;
303 }
else if (strcmp(newValue,
"inverted-landscape") == 0) {
304 orientation = QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDLANDSCAPEORIENTATION;
308 qt_extended_surface_set_content_orientation(qt_extended_surface, orientation);
312 if (newValue !=
NULL) {
313 char *tmp = strdup(newValue);
314 char *saveptr =
NULL;
316 char *flag = strtok_r(tmp,
" ", &saveptr);
318 if (strcmp(flag,
"OverridesSystemGestures") == 0) {
319 flags |= QT_EXTENDED_SURFACE_WINDOWFLAG_OVERRIDESSYSTEMGESTURES;
320 }
else if (strcmp(flag,
"StaysOnTop") == 0) {
321 flags |= QT_EXTENDED_SURFACE_WINDOWFLAG_STAYSONTOP;
322 }
else if (strcmp(flag,
"BypassWindowManager") == 0) {
327 flag = strtok_r(
NULL,
" ", &saveptr);
333 qt_extended_surface_set_window_flags(qt_extended_surface, flags);
337 static void QtExtendedSurface_Subscribe(
struct qt_extended_surface *
surface,
const char *name)
342 static void QtExtendedSurface_Unsubscribe(
struct qt_extended_surface *
surface,
const char *name)
352 struct wl_output *output = (
struct wl_output *) _display->
driverdata;
353 SetFullscreen(
_this, window, fullscreen ? output :
NULL);
382 WAYLAND_wl_display_flush( viddata->
display );
389 struct wl_region *region;
391 data = calloc(1,
sizeof *data);
428 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 429 if (c->surface_extension) {
430 data->extended_surface = qt_surface_extension_get_extended_surface(
431 c->surface_extension, data->
surface);
439 window->
w, window->
h);
445 return SDL_SetError(
"failed to create a window surface");
460 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 461 if (data->extended_surface) {
462 qt_extended_surface_set_user_data(data->extended_surface, data);
463 qt_extended_surface_add_listener(data->extended_surface,
464 &extended_surface_listener, data);
478 WAYLAND_wl_display_flush(c->
display);
487 struct wl_region *region;
489 WAYLAND_wl_egl_window_resize(wind->
egl_window, window->
w, window->
h, 0, 0);
520 WAYLAND_wl_egl_window_destroy(wind->
egl_window);
535 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 536 if (wind->extended_surface) {
539 qt_extended_surface_destroy(wind->extended_surface);
545 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.
struct zxdg_toplevel_v6 * toplevel
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 void wl_surface_commit(struct wl_surface *wl_surface)
struct zxdg_surface_v6 * surface
static struct wl_region * wl_compositor_create_region(struct wl_compositor *wl_compositor)
struct wl_shell_surface * wl
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 zxdg_toplevel_v6_set_maximized(struct zxdg_toplevel_v6 *zxdg_toplevel_v6)
static void wl_shell_surface_set_toplevel(struct wl_shell_surface *wl_shell_surface)
static void zxdg_toplevel_v6_destroy(struct zxdg_toplevel_v6 *zxdg_toplevel_v6)
static int zxdg_toplevel_v6_add_listener(struct zxdg_toplevel_v6 *zxdg_toplevel_v6, const struct zxdg_toplevel_v6_listener *listener, void *data)
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 void zxdg_surface_v6_ack_configure(struct zxdg_surface_v6 *zxdg_surface_v6, uint32_t serial)
static void zxdg_surface_v6_destroy(struct zxdg_surface_v6 *zxdg_surface_v6)
static SDL_VideoDevice * _this
struct SDL_VideoData::@36 shell
void Wayland_SetWindowTitle(_THIS, SDL_Window *window)
void Wayland_DestroyWindow(_THIS, SDL_Window *window)
static void zxdg_toplevel_v6_set_title(struct zxdg_toplevel_v6 *zxdg_toplevel_v6, const char *title)
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 int zxdg_surface_v6_add_listener(struct zxdg_surface_v6 *zxdg_surface_v6, const struct zxdg_surface_v6_listener *listener, void *data)
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
union SDL_WindowData::@38 shell_surface
#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)
SDL_zxdg_shell_surface zxdg
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
union SDL_zxdg_shell_surface::@37 roleobj
#define SDL_DelHintCallback
static void zxdg_toplevel_v6_set_app_id(struct zxdg_toplevel_v6 *zxdg_toplevel_v6, const char *app_id)
static void wl_shell_surface_set_class(struct wl_shell_surface *wl_shell_surface, const char *class_)
static void zxdg_toplevel_v6_unset_fullscreen(struct zxdg_toplevel_v6 *zxdg_toplevel_v6)
union SDL_SysWMinfo::@18 info
static struct zxdg_surface_v6 * zxdg_shell_v6_get_xdg_surface(struct zxdg_shell_v6 *zxdg_shell_v6, struct wl_surface *surface)
struct zxdg_shell_v6 * zxdg
struct SDL_SysWMinfo::@18::@20 wl
static void zxdg_surface_v6_set_user_data(struct zxdg_surface_v6 *zxdg_surface_v6, void *user_data)
static struct zxdg_toplevel_v6 * zxdg_surface_v6_get_toplevel(struct zxdg_surface_v6 *zxdg_surface_v6)
static void zxdg_toplevel_v6_set_fullscreen(struct zxdg_toplevel_v6 *zxdg_toplevel_v6, struct wl_output *output)
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