src/video/wayland/SDL_waylandvideo.c
changeset 8082 5b83ad3f01ac
parent 8062 4fc5f66d63cc
child 8104 2e4f1bd21196
     1.1 --- a/src/video/wayland/SDL_waylandvideo.c	Wed Dec 25 17:02:15 2013 +0100
     1.2 +++ b/src/video/wayland/SDL_waylandvideo.c	Fri Dec 27 09:29:39 2013 -0300
     1.3 @@ -30,6 +30,7 @@
     1.4  #include "SDL_waylandwindow.h"
     1.5  #include "SDL_waylandopengles.h"
     1.6  #include "SDL_waylandmouse.h"
     1.7 +#include "SDL_waylandtouch.h"
     1.8  
     1.9  #include <fcntl.h>
    1.10  #include <xkbcommon/xkbcommon.h>
    1.11 @@ -202,6 +203,25 @@
    1.12      shm_handle_format
    1.13  };
    1.14  
    1.15 +#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
    1.16 +static void
    1.17 +windowmanager_hints(void *data, struct qt_windowmanager *qt_windowmanager,
    1.18 +        int32_t show_is_fullscreen)
    1.19 +{
    1.20 +}
    1.21 +
    1.22 +static void
    1.23 +windowmanager_quit(void *data, struct qt_windowmanager *qt_windowmanager)
    1.24 +{
    1.25 +    SDL_SendQuit();
    1.26 +}
    1.27 +
    1.28 +static const struct qt_windowmanager_listener windowmanager_listener = {
    1.29 +    windowmanager_hints,
    1.30 +    windowmanager_quit,
    1.31 +};
    1.32 +#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
    1.33 +
    1.34  static void
    1.35  display_handle_global(void *data, struct wl_registry *registry, uint32_t id,
    1.36  					const char *interface, uint32_t version)
    1.37 @@ -222,6 +242,18 @@
    1.38          d->cursor_theme = wl_cursor_theme_load(NULL, 32, d->shm);
    1.39          d->default_cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "left_ptr");
    1.40          wl_shm_add_listener(d->shm, &shm_listener, d);
    1.41 +    
    1.42 +#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
    1.43 +    } else if (strcmp(interface, "qt_touch_extension") == 0) {
    1.44 +        Wayland_touch_create(d, id);
    1.45 +    } else if (strcmp(interface, "qt_surface_extension") == 0) {
    1.46 +        d->surface_extension = wl_registry_bind(registry, id,
    1.47 +                &qt_surface_extension_interface, 1);
    1.48 +    } else if (strcmp(interface, "qt_windowmanager") == 0) {
    1.49 +        d->windowmanager = wl_registry_bind(registry, id,
    1.50 +                &qt_windowmanager_interface, 1);
    1.51 +        qt_windowmanager_add_listener(d->windowmanager, &windowmanager_listener, d);
    1.52 +#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
    1.53      }
    1.54  }
    1.55  
    1.56 @@ -334,6 +366,15 @@
    1.57          xkb_context_unref(data->xkb_context);
    1.58          data->xkb_context = NULL;
    1.59      }
    1.60 +#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
    1.61 +    if (data->windowmanager)
    1.62 +        qt_windowmanager_destroy(data->windowmanager);
    1.63 +
    1.64 +    if (data->surface_extension)
    1.65 +        qt_surface_extension_destroy(data->surface_extension);
    1.66 +
    1.67 +    Wayland_touch_destroy(data);
    1.68 +#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
    1.69  
    1.70      if (data->shm)
    1.71          wl_shm_destroy(data->shm);