From 00b0d790cb64fd2812382892fa1e98817603c7c7 Mon Sep 17 00:00:00 2001 From: "Prudhvi Raj, Vasireddi" Date: Thu, 12 May 2016 16:27:48 +0900 Subject: [PATCH] Add 'xdg-shell' handling functionality wherever wl_shell is modified Change-Id: Ib980a3c402bc8e6b2f0c02efe319e71018fbb6af --- src/video/wayland/SDL_waylandevents.c | 8 ++++++- src/video/wayland/SDL_waylandwindow.c | 41 ++++++++++++++++++++++++++++------- 2 files changed, 40 insertions(+), 9 deletions(-) diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index 53b0ac9..0cd7d3d 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -149,6 +149,9 @@ ProcessHitTest(struct SDL_WaylandInput *input, uint32_t serial) }; switch (rc) { case SDL_HITTEST_DRAGGABLE: + if (window_data->xdgsurface) + xdg_surface_move(window_data->xdgsurface, input->seat, serial); + else if (window_data->shell_surface) wl_shell_surface_move(window_data->shell_surface, input->seat, serial); return SDL_TRUE; @@ -160,7 +163,10 @@ ProcessHitTest(struct SDL_WaylandInput *input, uint32_t serial) case SDL_HITTEST_RESIZE_BOTTOM: case SDL_HITTEST_RESIZE_BOTTOMLEFT: case SDL_HITTEST_RESIZE_LEFT: - wl_shell_surface_resize(window_data->shell_surface, input->seat, serial, directions[rc - SDL_HITTEST_RESIZE_TOPLEFT]); + if (window_data->xdgsurface) + xdg_surface_resize(window_data->xdgsurface, input->seat, serial, directions[rc - SDL_HITTEST_RESIZE_TOPLEFT]); + else if (window_data->shell_surface) + wl_shell_surface_resize(window_data->shell_surface, input->seat, serial, directions[rc - SDL_HITTEST_RESIZE_TOPLEFT]); return SDL_TRUE; default: return SDL_FALSE; diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index 3efea19..5f5ca7f 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/src/video/wayland/SDL_waylandwindow.c @@ -151,11 +151,21 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window) SDL_WindowData *wind = window->driverdata; if (window->flags & SDL_WINDOW_FULLSCREEN) - wl_shell_surface_set_fullscreen(wind->shell_surface, - WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, - 0, (struct wl_output *)window->fullscreen_mode.driverdata); + { + if (wind->xdgsurface) + xdg_surface_set_fullscreen(wind->xdgsurface, (struct wl_output *)window->fullscreen_mode.driverdata); + else if(wind->shell_surface) + wl_shell_surface_set_fullscreen(wind->shell_surface, + WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, + 0, (struct wl_output *)window->fullscreen_mode.driverdata); + } else - wl_shell_surface_set_toplevel(wind->shell_surface); + { + if (wind->xdgsurface) + xdg_surface_set_parent(wind->xdgsurface, NULL); + else if (wind->shell_surface) + wl_shell_surface_set_toplevel(wind->shell_surface); + } WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display ); } @@ -167,11 +177,22 @@ Wayland_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_WindowData *wind = window->driverdata; if (fullscreen) - wl_shell_surface_set_fullscreen(wind->shell_surface, - WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE, - 0, (struct wl_output *)_display->driverdata); + { + if (wind->xdgsurface) + xdg_surface_set_fullscreen(wind->xdgsurface, (struct wl_output *)_display->driverdata); + + if(wind->shell_surface) + wl_shell_surface_set_fullscreen(wind->shell_surface, + WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE, + 0, (struct wl_output *)_display->driverdata); + } else - wl_shell_surface_set_toplevel(wind->shell_surface); + { + if (wind->xdgsurface) + xdg_surface_unset_fullscreen(wind->xdgsurface); + else if (wind->shell_surface) + wl_shell_surface_set_toplevel(wind->shell_surface); + } WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display ); } @@ -288,6 +309,10 @@ void Wayland_DestroyWindow(_THIS, SDL_Window *window) SDL_EGL_DestroySurface(_this, wind->egl_surface); WAYLAND_wl_egl_window_destroy(wind->egl_window); + if (wind->xdgsurface) + xdg_surface_destroy(wind->xdgsurface); + wind->xdgsurface = NULL; + if (wind->shell_surface) wl_shell_surface_destroy(wind->shell_surface); -- 2.7.4