[Bf-blender-cvs] [2b6c633b63b] master: GHOST/Wayland: set the minimum window size with libdecor

Campbell Barton noreply at git.blender.org
Mon Jun 27 08:14:50 CEST 2022


Commit: 2b6c633b63b1ed075af1f988f677b7b7cf9445b1
Author: Campbell Barton
Date:   Mon Jun 27 16:09:23 2022 +1000
Branches: master
https://developer.blender.org/rB2b6c633b63b1ed075af1f988f677b7b7cf9445b1

GHOST/Wayland: set the minimum window size with libdecor

===================================================================

M	intern/ghost/intern/GHOST_WindowWayland.cpp

===================================================================

diff --git a/intern/ghost/intern/GHOST_WindowWayland.cpp b/intern/ghost/intern/GHOST_WindowWayland.cpp
index bd11476b2e2..acccd168f44 100644
--- a/intern/ghost/intern/GHOST_WindowWayland.cpp
+++ b/intern/ghost/intern/GHOST_WindowWayland.cpp
@@ -406,27 +406,29 @@ GHOST_WindowWayland::GHOST_WindowWayland(GHOST_SystemWayland *system,
 
   w->egl_window = wl_egl_window_create(w->wl_surface, int(w->size[0]), int(w->size[1]));
 
+  /* NOTE: The limit is in points (not pixels) so Hi-DPI will limit to larger number of pixels.
+   * This has the advantage that the size limit is the same when moving the window between monitors
+   * with different scales set. If it was important to limit in pixels it could be re-calculated
+   * when the `w->scale` changed. */
+  const int32_t size_min[2] = {320, 240};
+
 #ifdef WITH_GHOST_WAYLAND_LIBDECOR
   /* create window decorations */
   w->decor_frame = libdecor_decorate(
       m_system->decor_context(), w->wl_surface, &libdecor_frame_iface, w);
   libdecor_frame_map(w->decor_frame);
 
+  libdecor_frame_set_min_content_size(w->decor_frame, size_min[0], size_min[1]);
+
   if (parentWindow) {
     libdecor_frame_set_parent(
         w->decor_frame, dynamic_cast<const GHOST_WindowWayland *>(parentWindow)->w->decor_frame);
   }
-
 #else
-
   w->xdg_surface = xdg_wm_base_get_xdg_surface(m_system->xdg_shell(), w->wl_surface);
   w->xdg_toplevel = xdg_surface_get_toplevel(w->xdg_surface);
 
-  /* NOTE: The limit is in points (not pixels) so Hi-DPI will limit to larger number of pixels.
-   * This has the advantage that the size limit is the same when moving the window between monitors
-   * with different scales set. If it was important to limit in pixels it could be re-calculated
-   * when the `w->scale` changed. */
-  xdg_toplevel_set_min_size(w->xdg_toplevel, 320, 240);
+  xdg_toplevel_set_min_size(w->xdg_toplevel, size_min[0], size_min[1]);
 
   if (m_system->xdg_decoration_manager()) {
     w->xdg_toplevel_decoration = zxdg_decoration_manager_v1_get_toplevel_decoration(



More information about the Bf-blender-cvs mailing list