diff --git a/src/platform_impl/linux/wayland/header.rs b/src/platform_impl/linux/wayland/header.rs index 2ad3e25af..a8c8c7805 100644 --- a/src/platform_impl/linux/wayland/header.rs +++ b/src/platform_impl/linux/wayland/header.rs @@ -7,7 +7,7 @@ use gtk::{ pub struct WlHeader; impl WlHeader { - pub fn setup(window: &ApplicationWindow, title: &str) { + pub fn setup(window: &ApplicationWindow, title: &str, min_width: i32) { let header = HeaderBar::builder() .show_close_button(true) .decoration_layout("menu:minimize,maximize,close") @@ -23,8 +23,8 @@ impl WlHeader { let event_box_clone = event_box.clone(); glib::idle_add_local(move || { let allocated_height = header_clone.allocated_height(); - event_box_clone.set_height_request(allocated_height); - header_clone.set_height_request(allocated_height); + event_box_clone.set_size_request(min_width, allocated_height); + header_clone.set_size_request(min_width, allocated_height); glib::ControlFlow::Break }); diff --git a/src/platform_impl/linux/window.rs b/src/platform_impl/linux/window.rs index 3af491c62..113934a18 100644 --- a/src/platform_impl/linux/window.rs +++ b/src/platform_impl/linux/window.rs @@ -89,9 +89,15 @@ impl Window { } let window = window_builder.build(); + let win_scale_factor = window.scale_factor(); + let min_inner_size = attributes + .inner_size_constraints + .min_size_physical::(win_scale_factor as f64); + let min_width = min_inner_size.width.max(1); + let min_height = min_inner_size.height.max(1); if is_wayland { - WlHeader::setup(&window, &attributes.title); + WlHeader::setup(&window, &attributes.title, min_width); } let window_id = WindowId(window.id()); @@ -101,7 +107,6 @@ impl Window { .insert(window_id); // Set Width/Height & Resizable - let win_scale_factor = window.scale_factor(); let (width, height) = attributes .inner_size .map(|size| size.to_logical::(win_scale_factor as f64).into()) @@ -109,7 +114,7 @@ impl Window { let window_clone = window.clone(); glib::idle_add_local(move || { - window_clone.set_default_size(1, 1); + window_clone.set_default_size(min_width, min_height); window_clone.resize(width, height); glib::ControlFlow::Break }); @@ -129,12 +134,9 @@ impl Window { // Set Min/Max Size util::set_size_constraints(&window, attributes.inner_size_constraints); - let min_inner_size = attributes - .inner_size_constraints - .min_size_physical::(win_scale_factor as f64); let default_vbox = if pl_attribs.default_vbox { let box_ = gtk::Box::new(gtk::Orientation::Vertical, 0); - box_.set_size_request(min_inner_size.width as i32, min_inner_size.height as i32); + box_.set_size_request(min_width, min_height); window.add(&box_); Some(box_) } else {