diff options
author | Campbell Barton <campbell@blender.org> | 2022-06-27 09:09:23 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-06-27 09:09:23 +0300 |
commit | 2b6c633b63b1ed075af1f988f677b7b7cf9445b1 (patch) | |
tree | 3724d216b389d9ad1db41d132d93b2062089b191 /intern/ghost/intern/GHOST_WindowWayland.cpp | |
parent | 0e88c2fc59373974d0d259b651f6ddfe45fd0005 (diff) |
GHOST/Wayland: set the minimum window size with libdecor
Diffstat (limited to 'intern/ghost/intern/GHOST_WindowWayland.cpp')
-rw-r--r-- | intern/ghost/intern/GHOST_WindowWayland.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
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( |