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" 35 handle_ping(
void *
data,
struct wl_shell_surface *shell_surface,
38 wl_shell_surface_pong(shell_surface, serial);
42 handle_configure(
void *
data,
struct wl_shell_surface *shell_surface,
47 struct wl_region *region;
51 WAYLAND_wl_egl_window_resize(wind->
egl_window, window->
w, window->
h, 0, 0);
54 wl_region_add(region, 0, 0, window->
w, window->
h);
55 wl_surface_set_opaque_region(wind->
surface, region);
56 wl_region_destroy(region);
61 handle_popup_done(
void *
data,
struct wl_shell_surface *shell_surface)
65 static const struct wl_shell_surface_listener shell_surface_listener = {
71 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 73 handle_onscreen_visibility(
void *
data,
74 struct qt_extended_surface *qt_extended_surface,
int32_t visible)
79 handle_set_generic_property(
void *
data,
80 struct qt_extended_surface *qt_extended_surface,
const char *
name,
81 struct wl_array *
value)
86 handle_close(
void *
data,
struct qt_extended_surface *qt_extended_surface)
92 static const struct qt_extended_surface_listener extended_surface_listener = {
93 handle_onscreen_visibility,
94 handle_set_generic_property,
124 WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
140 WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE,
152 struct wl_region *region;
154 data =
calloc(1,
sizeof *data);
178 wl_surface_set_user_data(data->
surface, data);
181 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 182 if (c->surface_extension) {
183 data->extended_surface = qt_surface_extension_get_extended_surface(
184 c->surface_extension, data->
surface);
189 window->
w, window->
h);
195 return SDL_SetError(
"failed to create a window surface");
201 &shell_surface_listener, data);
204 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 205 if (data->extended_surface) {
206 qt_extended_surface_set_user_data(data->extended_surface, data);
207 qt_extended_surface_add_listener(data->extended_surface,
208 &extended_surface_listener, data);
212 region = wl_compositor_create_region(c->
compositor);
213 wl_region_add(region, 0, 0, window->
w, window->
h);
214 wl_surface_set_opaque_region(data->
surface, region);
215 wl_region_destroy(region);
217 WAYLAND_wl_display_flush(c->
display);
226 struct wl_region *region;
228 WAYLAND_wl_egl_window_resize(wind->
egl_window, window->
w, window->
h, 0, 0);
230 region =wl_compositor_create_region(data->
compositor);
231 wl_region_add(region, 0, 0, window->
w, window->
h);
232 wl_surface_set_opaque_region(wind->
surface, region);
233 wl_region_destroy(region);
243 WAYLAND_wl_egl_window_destroy(wind->
egl_window);
248 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 249 if (wind->extended_surface)
250 qt_extended_surface_destroy(wind->extended_surface);
252 wl_surface_destroy(wind->
surface);
255 WAYLAND_wl_display_flush(data->
display);
void Wayland_SetWindowSize(_THIS, SDL_Window *window)
void Wayland_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *_display, SDL_bool fullscreen)
SDL_DisplayMode fullscreen_mode
int Wayland_SetWindowHitTest(SDL_Window *window, SDL_bool enabled)
struct wl_display * display
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
void Wayland_ShowWindow(_THIS, SDL_Window *window)
GLint GLint GLsizei width
#define SDL_WINDOWPOS_UNDEFINED
GLuint const GLchar * name
int SDL_SendWindowEvent(SDL_Window *window, Uint8 windowevent, int data1, int data2)
#define SDL_GL_LoadLibrary
int Wayland_CreateWindow(_THIS, SDL_Window *window)
static SDL_VideoDevice * _this
GLint GLint GLsizei GLsizei height
void Wayland_DestroyWindow(_THIS, SDL_Window *window)
GLsizei const GLfloat * value
struct wl_shell_surface * shell_surface
SDL_bool Wayland_GetWindowWMInfo(_THIS, SDL_Window *window, SDL_SysWMinfo *info)
SDL_VideoData * waylandData
GLenum GLenum GLsizei const GLuint GLboolean enabled
#define SDL_OutOfMemory()
struct wl_compositor * compositor
The type used to identify a window.
union SDL_SysWMinfo::@18 info
struct wl_egl_window * egl_window