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;
62 if (width == 0 || height == 0) {
68 if (window->
max_w > 0) {
73 if (window->
max_h > 0) {
82 WAYLAND_wl_egl_window_resize(wind->
egl_window, width, height, 0, 0);
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;
116 WAYLAND_wl_egl_window_resize(wind->
egl_window, window->
w, window->
h, 0, 0);
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)
143 if (width == 0 || height == 0) {
149 if (window->
max_w > 0) {
154 if (window->
max_h > 0) {
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;
191 WAYLAND_wl_egl_window_resize(wind->
egl_window, window->
w, window->
h, 0, 0);
201 handle_configure_xdg_shell_surface
206 handle_configure_xdg_toplevel(
void *data,
207 struct xdg_toplevel *xdg_toplevel,
210 struct wl_array *states)
218 if (width == 0 || height == 0) {
224 if (window->
max_w > 0) {
229 if (window->
max_h > 0) {
238 if (width == window->
w && height == window->
h) {
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) {
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)
435 struct wl_output *output = (
struct wl_output *) _display->
driverdata;
436 SetFullscreen(
_this, window, fullscreen ? output :
NULL);
468 WAYLAND_wl_display_flush( viddata->
display );
475 struct wl_region *region;
477 data = calloc(1,
sizeof *data);
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);
531 window->
w, window->
h);
537 return SDL_SetError(
"failed to create a window surface");
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);
575 WAYLAND_wl_display_flush(c->
display);
582 WAYLAND_wl_display_flush(c->
display);
583 WAYLAND_wl_display_dispatch(c->
display);
589 WAYLAND_wl_display_flush(c->
display);
590 WAYLAND_wl_display_dispatch(c->
display);
602 struct wl_region *region;
604 WAYLAND_wl_egl_window_resize(wind->
egl_window, window->
w, window->
h, 0, 0);
637 WAYLAND_wl_egl_window_destroy(wind->
egl_window);
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);
#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)
static void xdg_toplevel_set_maximized(struct xdg_toplevel *xdg_toplevel)
#define SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION
A variable describing the content orientation on QtWayland-based platforms.
struct zxdg_toplevel_v6 * toplevel
static void xdg_surface_set_user_data(struct xdg_surface *xdg_surface, void *user_data)
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)
static void xdg_surface_ack_configure(struct xdg_surface *xdg_surface, uint32_t serial)
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)
SDL_bool initial_configure_seen
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)
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 local skip1(dst_w_bpp<=(lowbit *8)) &&((lowbit *8)<(pixblock_size *dst_w_bpp)) .if lowbit< 16 tst DST_R
SDL_bool initial_configure_seen
static void xdg_toplevel_destroy(struct xdg_toplevel *xdg_toplevel)
void Wayland_ShowWindow(_THIS, SDL_Window *window)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
union SDL_zxdg_shell_surface::@36 roleobj
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
static void xdg_toplevel_set_title(struct xdg_toplevel *xdg_toplevel, const char *title)
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 struct xdg_toplevel * xdg_surface_get_toplevel(struct xdg_surface *xdg_surface)
struct SDL_VideoData::@35 shell
static void zxdg_surface_v6_destroy(struct zxdg_surface_v6 *zxdg_surface_v6)
static void xdg_toplevel_set_fullscreen(struct xdg_toplevel *xdg_toplevel, struct wl_output *output)
static SDL_VideoDevice * _this
static void xdg_toplevel_set_app_id(struct xdg_toplevel *xdg_toplevel, const char *app_id)
SDL_xdg_shell_surface xdg
static void xdg_toplevel_unset_fullscreen(struct xdg_toplevel *xdg_toplevel)
void Wayland_SetWindowTitle(_THIS, SDL_Window *window)
void Wayland_DestroyWindow(_THIS, SDL_Window *window)
static int xdg_toplevel_add_listener(struct xdg_toplevel *xdg_toplevel, const struct xdg_toplevel_listener *listener, void *data)
static void zxdg_toplevel_v6_set_title(struct zxdg_toplevel_v6 *zxdg_toplevel_v6, const char *title)
struct xdg_toplevel * toplevel
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 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)
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.
struct xdg_surface * surface
#define SDL_AddHintCallback
#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)
union SDL_xdg_shell_surface::@37 roleobj
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 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