src/video/wayland/SDL_waylandwindow.c
changeset 8082 5b83ad3f01ac
parent 8062 4fc5f66d63cc
child 8104 2e4f1bd21196
     1.1 --- a/src/video/wayland/SDL_waylandwindow.c	Wed Dec 25 17:02:15 2013 +0100
     1.2 +++ b/src/video/wayland/SDL_waylandwindow.c	Fri Dec 27 09:29:39 2013 -0300
     1.3 @@ -26,6 +26,7 @@
     1.4  #include "../SDL_egl_c.h"
     1.5  #include "SDL_waylandwindow.h"
     1.6  #include "SDL_waylandvideo.h"
     1.7 +#include "SDL_waylandtouch.h"
     1.8  
     1.9  static void
    1.10  handle_ping(void *data, struct wl_shell_surface *shell_surface,
    1.11 @@ -51,6 +52,34 @@
    1.12      handle_popup_done
    1.13  };
    1.14  
    1.15 +#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
    1.16 +static void
    1.17 +handle_onscreen_visibility(void *data,
    1.18 +        struct qt_extended_surface *qt_extended_surface, int32_t visible)
    1.19 +{
    1.20 +}
    1.21 +
    1.22 +static void
    1.23 +handle_set_generic_property(void *data,
    1.24 +        struct qt_extended_surface *qt_extended_surface, const char *name,
    1.25 +        struct wl_array *value)
    1.26 +{
    1.27 +}
    1.28 +
    1.29 +static void
    1.30 +handle_close(void *data, struct qt_extended_surface *qt_extended_surface)
    1.31 +{
    1.32 +    SDL_WindowData *window = (SDL_WindowData *)data;
    1.33 +    SDL_SendWindowEvent(window->sdlwindow, SDL_WINDOWEVENT_CLOSE, 0, 0);
    1.34 +}
    1.35 +
    1.36 +static const struct qt_extended_surface_listener extended_surface_listener = {
    1.37 +    handle_onscreen_visibility,
    1.38 +    handle_set_generic_property,
    1.39 +    handle_close,
    1.40 +};
    1.41 +#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
    1.42 +
    1.43  SDL_bool
    1.44  Wayland_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
    1.45  {
    1.46 @@ -127,6 +156,12 @@
    1.47      wl_surface_set_user_data(data->surface, data);
    1.48      data->shell_surface = wl_shell_get_shell_surface(c->shell,
    1.49                                                       data->surface);
    1.50 +#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH    
    1.51 +    if (c->surface_extension) {
    1.52 +        data->extended_surface = qt_surface_extension_get_extended_surface(
    1.53 +                c->surface_extension, data->surface);
    1.54 +    }
    1.55 +#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
    1.56      data->egl_window = wl_egl_window_create(data->surface,
    1.57                                              window->w, window->h);
    1.58  
    1.59 @@ -144,6 +179,14 @@
    1.60                                        &shell_surface_listener, data);
    1.61      }
    1.62  
    1.63 +#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
    1.64 +    if (data->extended_surface) {
    1.65 +        qt_extended_surface_set_user_data(data->extended_surface, data);
    1.66 +        qt_extended_surface_add_listener(data->extended_surface,
    1.67 +                                         &extended_surface_listener, data);
    1.68 +    }
    1.69 +#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
    1.70 +
    1.71      region = wl_compositor_create_region(c->compositor);
    1.72      wl_region_add(region, 0, 0, window->w, window->h);
    1.73      wl_surface_set_opaque_region(data->surface, region);
    1.74 @@ -182,6 +225,10 @@
    1.75          if (wind->shell_surface)
    1.76              wl_shell_surface_destroy(wind->shell_surface);
    1.77  
    1.78 +#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
    1.79 +        if (wind->extended_surface)
    1.80 +            qt_extended_surface_destroy(wind->extended_surface);
    1.81 +#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
    1.82          wl_surface_destroy(wind->surface);
    1.83  
    1.84          SDL_free(wind);