src/video/wayland/SDL_waylandwindow.c
branchSDL-ryan-batching-renderer
changeset 12367 8256aaaafe54
parent 12033 bc702c5a7c3a
child 12381 dc9108cd4340
     1.1 --- a/src/video/wayland/SDL_waylandwindow.c	Tue Oct 23 01:34:03 2018 -0400
     1.2 +++ b/src/video/wayland/SDL_waylandwindow.c	Mon Oct 29 10:14:59 2018 -0400
     1.3 @@ -35,6 +35,7 @@
     1.4  
     1.5  #include "xdg-shell-client-protocol.h"
     1.6  #include "xdg-shell-unstable-v6-client-protocol.h"
     1.7 +#include "org-kde-kwin-server-decoration-manager-client-protocol.h"
     1.8  
     1.9  /* On modern desktops, we probably will use the xdg-shell protocol instead
    1.10     of wl_shell, but wl_shell might be useful on older Wayland installs that
    1.11 @@ -460,6 +461,17 @@
    1.12  }
    1.13  
    1.14  void
    1.15 +Wayland_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered)
    1.16 +{
    1.17 +    SDL_WindowData *wind = window->driverdata;
    1.18 +    const SDL_VideoData *viddata = (const SDL_VideoData *) _this->driverdata;
    1.19 +    if ((viddata->kwin_server_decoration_manager) && (wind->kwin_server_decoration)) {
    1.20 +        const enum org_kde_kwin_server_decoration_mode mode = bordered ? ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_SERVER : ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_NONE;
    1.21 +        org_kde_kwin_server_decoration_request_mode(wind->kwin_server_decoration, mode);
    1.22 +    }
    1.23 +}
    1.24 +
    1.25 +void
    1.26  Wayland_MaximizeWindow(_THIS, SDL_Window * window)
    1.27  {
    1.28      SDL_WindowData *wind = window->driverdata;
    1.29 @@ -570,6 +582,15 @@
    1.30      }
    1.31  #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
    1.32  
    1.33 +    if (c->kwin_server_decoration_manager) {
    1.34 +        data->kwin_server_decoration = org_kde_kwin_server_decoration_manager_create(c->kwin_server_decoration_manager, data->surface);
    1.35 +        if (data->kwin_server_decoration) {
    1.36 +            const SDL_bool bordered = (window->flags & SDL_WINDOW_BORDERLESS) == 0;
    1.37 +            const enum org_kde_kwin_server_decoration_mode mode = bordered ? ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_SERVER : ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_NONE;
    1.38 +            org_kde_kwin_server_decoration_request_mode(data->kwin_server_decoration, mode);
    1.39 +        }
    1.40 +    }
    1.41 +
    1.42      region = wl_compositor_create_region(c->compositor);
    1.43      wl_region_add(region, 0, 0, window->w, window->h);
    1.44      wl_surface_set_opaque_region(data->surface, region);
    1.45 @@ -644,6 +665,10 @@
    1.46          SDL_EGL_DestroySurface(_this, wind->egl_surface);
    1.47          WAYLAND_wl_egl_window_destroy(wind->egl_window);
    1.48  
    1.49 +        if (wind->kwin_server_decoration) {
    1.50 +            org_kde_kwin_server_decoration_release(wind->kwin_server_decoration);
    1.51 +        }
    1.52 +
    1.53          if (data->shell.xdg) {
    1.54              if (wind->shell_surface.xdg.roleobj.toplevel) {
    1.55                  xdg_toplevel_destroy(wind->shell_surface.xdg.roleobj.toplevel);