diff --git a/src/platform_impl/linux/wayland/header.rs b/src/platform_impl/linux/wayland/header.rs index 451f44ada..2ad3e25af 100644 --- a/src/platform_impl/linux/wayland/header.rs +++ b/src/platform_impl/linux/wayland/header.rs @@ -1,4 +1,8 @@ -use gtk::{prelude::*, ApplicationWindow, EventBox, HeaderBar}; +use gtk::{ + glib::{self}, + prelude::*, + ApplicationWindow, EventBox, HeaderBar, +}; pub struct WlHeader; @@ -14,9 +18,17 @@ impl WlHeader { event_box.set_above_child(true); event_box.set_visible(true); event_box.set_can_focus(false); - event_box.set_height_request(40); - event_box.add(&header); + let header_clone = header.clone(); + 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); + glib::ControlFlow::Break + }); + + event_box.add(&header); window.set_titlebar(Some(&event_box)); Self::connect_resize_window(&header, window); } diff --git a/src/platform_impl/linux/window.rs b/src/platform_impl/linux/window.rs index 24adab9cb..3af491c62 100644 --- a/src/platform_impl/linux/window.rs +++ b/src/platform_impl/linux/window.rs @@ -107,8 +107,12 @@ impl Window { .map(|size| size.to_logical::(win_scale_factor as f64).into()) .unwrap_or((800, 600)); - window.set_default_size(1, 1); - window.resize(width, height); + let window_clone = window.clone(); + glib::idle_add_local(move || { + window_clone.set_default_size(1, 1); + window_clone.resize(width, height); + glib::ControlFlow::Break + }); if attributes.maximized { let maximize_process = util::WindowMaximizeProcess::new(window.clone(), attributes.resizable);