src/video/wayland/SDL_waylandwindow.c
changeset 10492 786e10ab72d8
parent 10304 ee83e0b4a36f
child 10614 63c2c6c8762c
     1.1 --- a/src/video/wayland/SDL_waylandwindow.c	Fri Oct 07 18:09:09 2016 -0700
     1.2 +++ b/src/video/wayland/SDL_waylandwindow.c	Fri Oct 07 18:11:03 2016 -0700
     1.3 @@ -47,6 +47,33 @@
     1.4      SDL_Window *window = wind->sdlwindow;
     1.5      struct wl_region *region;
     1.6  
     1.7 +    /* wl_shell_surface spec states that this is a suggestion.
     1.8 +       Ignore if less than or greater than max/min size. */
     1.9 +
    1.10 +    if (width == 0 || height == 0) {
    1.11 +        return;
    1.12 +    }
    1.13 +
    1.14 +    if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
    1.15 +        if ((window->flags & SDL_WINDOW_RESIZABLE)) {
    1.16 +            if (window->max_w > 0) {
    1.17 +                width = SDL_min(width, window->max_w);
    1.18 +            } 
    1.19 +            width = SDL_max(width, window->min_w);
    1.20 +
    1.21 +            if (window->max_h > 0) {
    1.22 +                height = SDL_min(height, window->max_h);
    1.23 +            }
    1.24 +            height = SDL_max(height, window->min_h);
    1.25 +        } else {
    1.26 +            return;
    1.27 +        }
    1.28 +    }
    1.29 +
    1.30 +    if (width == window->w && height == window->h) {
    1.31 +        return;
    1.32 +    }
    1.33 +
    1.34      window->w = width;
    1.35      window->h = height;
    1.36      WAYLAND_wl_egl_window_resize(wind->egl_window, window->w, window->h, 0, 0);
    1.37 @@ -146,6 +173,26 @@
    1.38      WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
    1.39  }
    1.40  
    1.41 +void
    1.42 +Wayland_RestoreWindow(_THIS, SDL_Window * window)
    1.43 +{
    1.44 +    SDL_WindowData *wind = window->driverdata;
    1.45 +
    1.46 +    wl_shell_surface_set_toplevel(wind->shell_surface);
    1.47 +
    1.48 +    WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
    1.49 +}
    1.50 +
    1.51 +void
    1.52 +Wayland_MaximizeWindow(_THIS, SDL_Window * window)
    1.53 +{
    1.54 +    SDL_WindowData *wind = window->driverdata;
    1.55 +
    1.56 +    wl_shell_surface_set_maximized(wind->shell_surface, NULL);
    1.57 +
    1.58 +    WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
    1.59 +}
    1.60 +
    1.61  int Wayland_CreateWindow(_THIS, SDL_Window *window)
    1.62  {
    1.63      SDL_WindowData *data;
    1.64 @@ -239,6 +286,17 @@
    1.65      wl_region_destroy(region);
    1.66  }
    1.67  
    1.68 +void Wayland_SetWindowTitle(_THIS, SDL_Window * window)
    1.69 +{
    1.70 +    SDL_WindowData *wind = window->driverdata;
    1.71 +    
    1.72 +    if (window->title != NULL) {
    1.73 +        wl_shell_surface_set_title(wind->shell_surface, window->title);
    1.74 +    }
    1.75 +
    1.76 +    WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
    1.77 +}
    1.78 +
    1.79  void Wayland_DestroyWindow(_THIS, SDL_Window *window)
    1.80  {
    1.81      SDL_VideoData *data = _this->driverdata;