mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-14 22:14:23 +00:00
linux: Respect window_min_size
property (#15314)
https://github.com/zed-industries/zed/pull/13126 added the `window_min_size` property for window creation, but it was only implemented for macOS. This PR implements the property on Linux as well. Release Notes: - N/A
This commit is contained in:
parent
3751f67730
commit
88653c4e3e
3 changed files with 13 additions and 2 deletions
|
@ -706,7 +706,6 @@ pub(crate) struct WindowParams {
|
|||
|
||||
pub display_id: Option<DisplayId>,
|
||||
|
||||
#[cfg_attr(target_os = "linux", allow(dead_code))]
|
||||
pub window_min_size: Option<Size<Pixels>>,
|
||||
}
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue