diff --git a/crates/gpui/src/platform.rs b/crates/gpui/src/platform.rs index 45de306ad2..7bd1b29443 100644 --- a/crates/gpui/src/platform.rs +++ b/crates/gpui/src/platform.rs @@ -706,7 +706,6 @@ pub(crate) struct WindowParams { pub display_id: Option, - #[cfg_attr(target_os = "linux", allow(dead_code))] pub window_min_size: Option>, } diff --git a/crates/gpui/src/platform/linux/wayland/window.rs b/crates/gpui/src/platform/linux/wayland/window.rs index 9ec5e9e2c0..2efbd1a2ec 100644 --- a/crates/gpui/src/platform/linux/wayland/window.rs +++ b/crates/gpui/src/platform/linux/wayland/window.rs @@ -264,7 +264,10 @@ impl WaylandWindow { .wm_base .get_xdg_surface(&surface, &globals.qh, surface.id()); let toplevel = xdg_surface.get_toplevel(&globals.qh, surface.id()); - toplevel.set_min_size(50, 50); + + if let Some(size) = params.window_min_size { + toplevel.set_min_size(size.width.0 as i32, size.height.0 as i32); + } if let Some(fractional_scale_manager) = globals.fractional_scale_manager.as_ref() { fractional_scale_manager.get_fractional_scale(&surface, &globals.qh, surface.id()); diff --git a/crates/gpui/src/platform/linux/x11/window.rs b/crates/gpui/src/platform/linux/x11/window.rs index 9e4908627e..b6c775db4e 100644 --- a/crates/gpui/src/platform/linux/x11/window.rs +++ b/crates/gpui/src/platform/linux/x11/window.rs @@ -14,6 +14,7 @@ use raw_window_handle as rwh; use util::{maybe, ResultExt}; use x11rb::{ connection::Connection, + properties::WmSizeHints, protocol::{ sync, xinput::{self, ConnectionExt as _}, @@ -371,6 +372,14 @@ impl X11WindowState { visual.depth, x_window, visual_set.root, bounds.origin.x.0 + 2, bounds.origin.y.0, bounds.size.width.0, bounds.size.height.0) })?; + if let Some(size) = params.window_min_size { + let mut size_hints = WmSizeHints::new(); + size_hints.min_size = Some((size.width.0 as i32, size.height.0 as i32)); + size_hints + .set_normal_hints(xcb_connection, x_window) + .unwrap(); + } + let reply = xcb_connection .get_geometry(x_window) .unwrap()