src/video/wayland/SDL_waylandvideo.c
changeset 8082 5b83ad3f01ac
parent 8062 4fc5f66d63cc
child 8104 2e4f1bd21196
equal deleted inserted replaced
8081:402b8c313246 8082:5b83ad3f01ac
    28 #include "SDL_waylandvideo.h"
    28 #include "SDL_waylandvideo.h"
    29 #include "SDL_waylandevents_c.h"
    29 #include "SDL_waylandevents_c.h"
    30 #include "SDL_waylandwindow.h"
    30 #include "SDL_waylandwindow.h"
    31 #include "SDL_waylandopengles.h"
    31 #include "SDL_waylandopengles.h"
    32 #include "SDL_waylandmouse.h"
    32 #include "SDL_waylandmouse.h"
       
    33 #include "SDL_waylandtouch.h"
    33 
    34 
    34 #include <fcntl.h>
    35 #include <fcntl.h>
    35 #include <xkbcommon/xkbcommon.h>
    36 #include <xkbcommon/xkbcommon.h>
    36 
    37 
    37 #define WAYLANDVID_DRIVER_NAME "wayland"
    38 #define WAYLANDVID_DRIVER_NAME "wayland"
   199 }
   200 }
   200 
   201 
   201 static const struct wl_shm_listener shm_listener = {
   202 static const struct wl_shm_listener shm_listener = {
   202     shm_handle_format
   203     shm_handle_format
   203 };
   204 };
       
   205 
       
   206 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
       
   207 static void
       
   208 windowmanager_hints(void *data, struct qt_windowmanager *qt_windowmanager,
       
   209         int32_t show_is_fullscreen)
       
   210 {
       
   211 }
       
   212 
       
   213 static void
       
   214 windowmanager_quit(void *data, struct qt_windowmanager *qt_windowmanager)
       
   215 {
       
   216     SDL_SendQuit();
       
   217 }
       
   218 
       
   219 static const struct qt_windowmanager_listener windowmanager_listener = {
       
   220     windowmanager_hints,
       
   221     windowmanager_quit,
       
   222 };
       
   223 #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
   204 
   224 
   205 static void
   225 static void
   206 display_handle_global(void *data, struct wl_registry *registry, uint32_t id,
   226 display_handle_global(void *data, struct wl_registry *registry, uint32_t id,
   207 					const char *interface, uint32_t version)
   227 					const char *interface, uint32_t version)
   208 {
   228 {
   220     } else if (strcmp(interface, "wl_shm") == 0) {
   240     } else if (strcmp(interface, "wl_shm") == 0) {
   221         d->shm = wl_registry_bind(registry, id, &wl_shm_interface, 1);
   241         d->shm = wl_registry_bind(registry, id, &wl_shm_interface, 1);
   222         d->cursor_theme = wl_cursor_theme_load(NULL, 32, d->shm);
   242         d->cursor_theme = wl_cursor_theme_load(NULL, 32, d->shm);
   223         d->default_cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "left_ptr");
   243         d->default_cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "left_ptr");
   224         wl_shm_add_listener(d->shm, &shm_listener, d);
   244         wl_shm_add_listener(d->shm, &shm_listener, d);
       
   245     
       
   246 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
       
   247     } else if (strcmp(interface, "qt_touch_extension") == 0) {
       
   248         Wayland_touch_create(d, id);
       
   249     } else if (strcmp(interface, "qt_surface_extension") == 0) {
       
   250         d->surface_extension = wl_registry_bind(registry, id,
       
   251                 &qt_surface_extension_interface, 1);
       
   252     } else if (strcmp(interface, "qt_windowmanager") == 0) {
       
   253         d->windowmanager = wl_registry_bind(registry, id,
       
   254                 &qt_windowmanager_interface, 1);
       
   255         qt_windowmanager_add_listener(d->windowmanager, &windowmanager_listener, d);
       
   256 #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
   225     }
   257     }
   226 }
   258 }
   227 
   259 
   228 static const struct wl_registry_listener registry_listener = {
   260 static const struct wl_registry_listener registry_listener = {
   229 	display_handle_global
   261 	display_handle_global
   332 
   364 
   333     if (data->xkb_context) {
   365     if (data->xkb_context) {
   334         xkb_context_unref(data->xkb_context);
   366         xkb_context_unref(data->xkb_context);
   335         data->xkb_context = NULL;
   367         data->xkb_context = NULL;
   336     }
   368     }
       
   369 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
       
   370     if (data->windowmanager)
       
   371         qt_windowmanager_destroy(data->windowmanager);
       
   372 
       
   373     if (data->surface_extension)
       
   374         qt_surface_extension_destroy(data->surface_extension);
       
   375 
       
   376     Wayland_touch_destroy(data);
       
   377 #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
   337 
   378 
   338     if (data->shm)
   379     if (data->shm)
   339         wl_shm_destroy(data->shm);
   380         wl_shm_destroy(data->shm);
   340 
   381 
   341     if (data->cursor_theme)
   382     if (data->cursor_theme)