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"
51 handle_ping_wl_shell_surface(
void *
data,
struct wl_shell_surface *shell_surface,
58 handle_configure_wl_shell_surface(
void *
data,
struct wl_shell_surface *shell_surface,
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;
148 handle_configure_zxdg_shell_surface
153 handle_configure_zxdg_toplevel(
void *
data,
154 struct zxdg_toplevel_v6 *zxdg_toplevel_v6,
157 struct wl_array *states)
164 wl_array_for_each(
state, states) {
207 handle_close_zxdg_toplevel(
void *
data,
struct zxdg_toplevel_v6 *zxdg_toplevel_v6)
214 handle_configure_zxdg_toplevel,
215 handle_close_zxdg_toplevel
221 handle_configure_xdg_shell_surface(
void *
data,
struct xdg_surface *xdg,
uint32_t serial)
225 struct wl_region *region;
258 handle_configure_xdg_shell_surface
263 handle_configure_xdg_toplevel(
void *
data,
264 struct xdg_toplevel *xdg_toplevel,
267 struct wl_array *states)
274 wl_array_for_each(
state, states) {
317 handle_close_xdg_toplevel(
void *
data,
struct xdg_toplevel *xdg_toplevel)
324 handle_configure_xdg_toplevel,
325 handle_close_xdg_toplevel
331 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
333 handle_onscreen_visibility(
void *
data,
334 struct qt_extended_surface *qt_extended_surface,
int32_t visible)
339 handle_set_generic_property(
void *
data,
340 struct qt_extended_surface *qt_extended_surface,
const char *
name,
341 struct wl_array *
value)
346 handle_close(
void *
data,
struct qt_extended_surface *qt_extended_surface)
352 static const struct qt_extended_surface_listener extended_surface_listener = {
353 handle_onscreen_visibility,
354 handle_set_generic_property,
361 float old_factor =
window->scale_factor, new_factor = 0.0;
368 if (!
window->num_outputs) {
369 new_factor = old_factor;
376 for (
i = 0;
i <
window->num_outputs;
i++) {
378 if (factor > new_factor) {
383 if (new_factor != old_factor) {
387 window->resize.scale_factor = new_factor;
396 handle_surface_enter(
void *
data,
struct wl_surface *
surface,
397 struct wl_output *
output) {
402 update_scale_factor(
window);
406 handle_surface_leave(
void *
data,
struct wl_surface *
surface,
407 struct wl_output *
output) {
411 for (
i = 0;
i <
window->num_outputs;
i++) {
413 if (
i == (
window->num_outputs-1)) {
423 if (
window->num_outputs == 0) {
428 update_scale_factor(
window);
432 handle_surface_enter,
454 if (version < 2000006) {
460 info->
info.
wl.display =
data->waylandData->display;
462 info->
info.
wl.shell_surface =
data->shell_surface.wl;
507 struct wl_output *
output = (
struct wl_output *)
window->fullscreen_mode.driverdata;
511 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
513 QtExtendedSurface_OnHintChanged(
void *userdata,
const char *
name,
514 const char *oldValue,
const char *newValue)
516 struct qt_extended_surface *qt_extended_surface = userdata;
523 int32_t orientation = QT_EXTENDED_SURFACE_ORIENTATION_PRIMARYORIENTATION;
525 if (newValue !=
NULL) {
526 if (strcmp(newValue,
"portrait") == 0) {
527 orientation = QT_EXTENDED_SURFACE_ORIENTATION_PORTRAITORIENTATION;
528 }
else if (strcmp(newValue,
"landscape") == 0) {
529 orientation = QT_EXTENDED_SURFACE_ORIENTATION_LANDSCAPEORIENTATION;
530 }
else if (strcmp(newValue,
"inverted-portrait") == 0) {
531 orientation = QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDPORTRAITORIENTATION;
532 }
else if (strcmp(newValue,
"inverted-landscape") == 0) {
533 orientation = QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDLANDSCAPEORIENTATION;
537 qt_extended_surface_set_content_orientation(qt_extended_surface, orientation);
541 if (newValue !=
NULL) {
542 char *tmp =
strdup(newValue);
543 char *saveptr =
NULL;
545 char *flag = strtok_r(tmp,
" ", &saveptr);
547 if (strcmp(flag,
"OverridesSystemGestures") == 0) {
548 flags |= QT_EXTENDED_SURFACE_WINDOWFLAG_OVERRIDESSYSTEMGESTURES;
549 }
else if (strcmp(flag,
"StaysOnTop") == 0) {
550 flags |= QT_EXTENDED_SURFACE_WINDOWFLAG_STAYSONTOP;
551 }
else if (strcmp(flag,
"BypassWindowManager") == 0) {
556 flag = strtok_r(
NULL,
" ", &saveptr);
562 qt_extended_surface_set_window_flags(qt_extended_surface,
flags);
566 static void QtExtendedSurface_Subscribe(
struct qt_extended_surface *
surface,
const char *
name)
571 static void QtExtendedSurface_Unsubscribe(
struct qt_extended_surface *
surface,
const char *
name)
628 WAYLAND_wl_display_flush( viddata->
display );
646 struct wl_region *region;
669 data->waylandData =
c;
672 data->scale_factor = 1.0;
687 data->resize.scale_factor =
data->scale_factor;
690 data->num_outputs = 0;
702 }
else if (
c->shell.zxdg) {
713 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
714 if (
c->surface_extension) {
715 data->extended_surface = qt_surface_extension_get_extended_surface(
716 c->surface_extension,
data->surface);
724 data->egl_window = WAYLAND_wl_egl_window_create(
data->surface,
731 return SDL_SetError(
"failed to create an EGL window surface");
736 if (
data->shell_surface.xdg.surface) {
740 }
else if (
c->shell.zxdg) {
741 if (
data->shell_surface.zxdg.surface) {
746 if (
data->shell_surface.wl) {
752 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
753 if (
data->extended_surface) {
754 qt_extended_surface_set_user_data(
data->extended_surface,
data);
755 qt_extended_surface_add_listener(
data->extended_surface,
756 &extended_surface_listener,
data);
760 if (
c->decoration_manager &&
c->shell.xdg &&
data->shell_surface.xdg.surface) {
762 if (
data->server_decoration) {
767 }
else if (
c->kwin_server_decoration_manager) {
769 if (
data->kwin_server_decoration) {
781 if (
c->relative_mouse_mode) {
786 WAYLAND_wl_display_flush(
c->display);
791 if (
data->shell_surface.xdg.surface) {
792 while (!
data->shell_surface.xdg.initial_configure_seen) {
793 WAYLAND_wl_display_flush(
c->display);
794 WAYLAND_wl_display_dispatch(
c->display);
797 }
else if (
c->shell.zxdg) {
798 if (
data->shell_surface.zxdg.surface) {
799 while (!
data->shell_surface.zxdg.initial_configure_seen) {
800 WAYLAND_wl_display_flush(
c->display);
801 WAYLAND_wl_display_dispatch(
c->display);
815 if (
data->resize.pending) {
816 struct wl_region *region;
817 if (
data->scale_factor !=
data->resize.scale_factor) {
824 data->scale_factor =
data->resize.scale_factor;
826 if (
data->egl_window) {
827 WAYLAND_wl_egl_window_resize(
data->egl_window,
window->w *
data->scale_factor,
window->h *
data->scale_factor, 0, 0);
830 if (
data->resize.configure) {
831 if (
data->waylandData->shell.xdg) {
833 }
else if (
data->waylandData->shell.zxdg) {
852 struct wl_region *region;
894 WAYLAND_wl_egl_window_destroy(wind->
egl_window);
905 if (
data->shell.xdg) {
912 }
else if (
data->shell.zxdg) {
925 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
935 WAYLAND_wl_display_flush(
data->display);
#define SDL_DelHintCallback
#define SDL_GL_LoadLibrary
#define SDL_AddHintCallback
#define SDL_OutOfMemory()
#define SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION
A variable describing the content orientation on QtWayland-based platforms.
#define SDL_HINT_QTWAYLAND_WINDOW_FLAGS
Flags to set on QtWayland windows to integrate with the native window manager.
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLint GLint GLsizei width
GLint GLint GLsizei GLsizei height
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLenum GLenum GLenum GLenum GLenum scale
GLuint const GLchar * name
GLsizei const GLfloat * value
#define FULLSCREEN_VISIBLE(W)
SDL_VideoDevice * SDL_GetVideoDevice(void)
static SDL_VideoDevice * _this
#define SDL_WINDOWPOS_UNDEFINED
@ SDL_WINDOW_ALLOW_HIGHDPI
@ SDL_WINDOWEVENT_RESIZED
int Wayland_input_lock_pointer(struct SDL_WaylandInput *input)
int Wayland_input_confine_pointer(SDL_Window *window, struct SDL_WaylandInput *input)
int Wayland_input_unconfine_pointer(struct SDL_WaylandInput *input)
void Wayland_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *_display, SDL_bool fullscreen)
SDL_bool Wayland_GetWindowWMInfo(_THIS, SDL_Window *window, SDL_SysWMinfo *info)
void Wayland_RestoreWindow(_THIS, SDL_Window *window)
void Wayland_HandlePendingResize(SDL_Window *window)
void Wayland_SetWindowTitle(_THIS, SDL_Window *window)
int Wayland_SetWindowHitTest(SDL_Window *window, SDL_bool enabled)
void Wayland_ShowWindow(_THIS, SDL_Window *window)
int Wayland_CreateWindow(_THIS, SDL_Window *window)
void Wayland_SetWindowGrab(_THIS, SDL_Window *window, SDL_bool grabbed)
void Wayland_SetWindowSize(_THIS, SDL_Window *window)
void Wayland_DestroyWindow(_THIS, SDL_Window *window)
void Wayland_MaximizeWindow(_THIS, SDL_Window *window)
void Wayland_SetWindowBordered(_THIS, SDL_Window *window, SDL_bool bordered)
int SDL_SendWindowEvent(SDL_Window *window, Uint8 windowevent, int data1, int data2)
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
EGLSurface EGLNativeWindowType * window
static struct org_kde_kwin_server_decoration * org_kde_kwin_server_decoration_manager_create(struct org_kde_kwin_server_decoration_manager *org_kde_kwin_server_decoration_manager, struct wl_surface *surface)
org_kde_kwin_server_decoration_manager_mode
@ ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_NONE
@ ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_SERVER
static void org_kde_kwin_server_decoration_request_mode(struct org_kde_kwin_server_decoration *org_kde_kwin_server_decoration, uint32_t mode)
static void org_kde_kwin_server_decoration_release(struct org_kde_kwin_server_decoration *org_kde_kwin_server_decoration)
static struct wl_surface * wl_compositor_create_surface(struct wl_compositor *wl_compositor)
static struct wl_region * wl_compositor_create_region(struct wl_compositor *wl_compositor)
static void * wl_output_get_user_data(struct wl_output *wl_output)
static void wl_region_add(struct wl_region *wl_region, int32_t x, int32_t y, int32_t width, int32_t height)
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 void wl_shell_surface_pong(struct wl_shell_surface *wl_shell_surface, uint32_t serial)
static void wl_shell_surface_set_user_data(struct wl_shell_surface *wl_shell_surface, void *user_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_toplevel(struct wl_shell_surface *wl_shell_surface)
static int wl_shell_surface_add_listener(struct wl_shell_surface *wl_shell_surface, const struct wl_shell_surface_listener *listener, void *data)
static void wl_shell_surface_set_maximized(struct wl_shell_surface *wl_shell_surface, struct wl_output *output)
static void wl_shell_surface_destroy(struct wl_shell_surface *wl_shell_surface)
static void wl_shell_surface_set_title(struct wl_shell_surface *wl_shell_surface, const char *title)
@ WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT
static struct wl_shell_surface * wl_shell_get_shell_surface(struct wl_shell *wl_shell, struct wl_surface *surface)
static void wl_surface_set_opaque_region(struct wl_surface *wl_surface, struct wl_region *region)
static void wl_surface_set_buffer_scale(struct wl_surface *wl_surface, int32_t scale)
static void wl_surface_destroy(struct wl_surface *wl_surface)
static int wl_surface_add_listener(struct wl_surface *wl_surface, const struct wl_surface_listener *listener, void *data)
static void wl_surface_commit(struct wl_surface *wl_surface)
static int xdg_surface_add_listener(struct xdg_surface *xdg_surface, const struct xdg_surface_listener *listener, void *data)
static void xdg_surface_destroy(struct xdg_surface *xdg_surface)
static struct xdg_toplevel * xdg_surface_get_toplevel(struct xdg_surface *xdg_surface)
static void xdg_surface_set_user_data(struct xdg_surface *xdg_surface, void *user_data)
static void xdg_surface_ack_configure(struct xdg_surface *xdg_surface, uint32_t serial)
static void xdg_toplevel_set_title(struct xdg_toplevel *xdg_toplevel, const char *title)
static void xdg_toplevel_set_app_id(struct xdg_toplevel *xdg_toplevel, const char *app_id)
static void xdg_toplevel_set_fullscreen(struct xdg_toplevel *xdg_toplevel, struct wl_output *output)
static void xdg_toplevel_set_maximized(struct xdg_toplevel *xdg_toplevel)
static int xdg_toplevel_add_listener(struct xdg_toplevel *xdg_toplevel, const struct xdg_toplevel_listener *listener, void *data)
static void xdg_toplevel_destroy(struct xdg_toplevel *xdg_toplevel)
static void xdg_toplevel_unset_fullscreen(struct xdg_toplevel *xdg_toplevel)
@ XDG_TOPLEVEL_STATE_FULLSCREEN
static struct xdg_surface * xdg_wm_base_get_xdg_surface(struct xdg_wm_base *xdg_wm_base, struct wl_surface *surface)
static struct zxdg_toplevel_decoration_v1 * zxdg_decoration_manager_v1_get_toplevel_decoration(struct zxdg_decoration_manager_v1 *zxdg_decoration_manager_v1, struct xdg_toplevel *toplevel)
static struct zxdg_surface_v6 * zxdg_shell_v6_get_xdg_surface(struct zxdg_shell_v6 *zxdg_shell_v6, struct wl_surface *surface)
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 zxdg_surface_v6_set_user_data(struct zxdg_surface_v6 *zxdg_surface_v6, void *user_data)
static void zxdg_surface_v6_destroy(struct zxdg_surface_v6 *zxdg_surface_v6)
static void zxdg_surface_v6_ack_configure(struct zxdg_surface_v6 *zxdg_surface_v6, uint32_t serial)
static struct zxdg_toplevel_v6 * zxdg_surface_v6_get_toplevel(struct zxdg_surface_v6 *zxdg_surface_v6)
zxdg_toplevel_decoration_v1_mode
static void zxdg_toplevel_decoration_v1_set_mode(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1, uint32_t mode)
static void zxdg_toplevel_decoration_v1_destroy(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1)
@ ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE
@ ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE
static void zxdg_toplevel_v6_set_title(struct zxdg_toplevel_v6 *zxdg_toplevel_v6, const char *title)
static void zxdg_toplevel_v6_set_fullscreen(struct zxdg_toplevel_v6 *zxdg_toplevel_v6, struct wl_output *output)
static void zxdg_toplevel_v6_unset_fullscreen(struct zxdg_toplevel_v6 *zxdg_toplevel_v6)
static void zxdg_toplevel_v6_set_maximized(struct zxdg_toplevel_v6 *zxdg_toplevel_v6)
static void zxdg_toplevel_v6_set_app_id(struct zxdg_toplevel_v6 *zxdg_toplevel_v6, const char *app_id)
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)
@ ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro pixld1_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl else error unsupported endif endm macro pixld2_s mem_operand if mov asr add asl add asl mov asr sub UNIT_X add asl mov asr add asl add asl mov asr add UNIT_X add asl else pixld1_s mem_operand pixld1_s mem_operand endif endm macro pixld0_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl endif endm macro pixld_s_internal mem_operand if mem_operand pixld2_s mem_operand pixdeinterleave basereg elseif mem_operand elseif mem_operand elseif mem_operand elseif mem_operand pixld0_s mem_operand else pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else error unsupported mem_operand if bpp mem_operand endif endm macro vuzp8 reg2 vuzp d d ®2 endm macro vzip8 reg2 vzip d d ®2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld[DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld if[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro fetch_mask_pixblock pixld mask_basereg pixblock_size MASK endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp skip1(dst_w_bpp<=(lowbit *8)) &&((lowbit *8)<(pixblock_size *dst_w_bpp)) .if lowbit< 16 tst DST_R
union SDL_SysWMinfo::@10 info
struct SDL_SysWMinfo::@10::@12 wl
struct zxdg_shell_v6 * zxdg
struct SDL_VideoData::@442 shell
struct wl_compositor * compositor
struct zxdg_decoration_manager_v1 * decoration_manager
struct org_kde_kwin_server_decoration_manager * kwin_server_decoration_manager
struct wl_display * display
SDL_VideoDisplay * displays
struct wl_egl_window * egl_window
struct zxdg_toplevel_decoration_v1 * server_decoration
struct qt_extended_surface * extended_surface
SDL_VideoData * waylandData
SDL_xdg_shell_surface xdg
struct wl_shell_surface * wl
struct org_kde_kwin_server_decoration * kwin_server_decoration
struct SDL_WindowData::@446 resize
union SDL_WindowData::@445 shell_surface
SDL_zxdg_shell_surface zxdg
The type used to identify a window.
struct xdg_surface * surface
struct xdg_toplevel * toplevel
SDL_bool initial_configure_seen
union SDL_xdg_shell_surface::@444 roleobj
struct zxdg_toplevel_v6 * toplevel
SDL_bool initial_configure_seen
union SDL_zxdg_shell_surface::@443 roleobj
struct zxdg_surface_v6 * surface