diff --git a/src/event_loop/handlers.rs b/src/event_loop/handlers.rs index 3dca314..a3e5e84 100644 --- a/src/event_loop/handlers.rs +++ b/src/event_loop/handlers.rs @@ -19,7 +19,7 @@ use smithay_client_toolkit:: wlr_layer::{ LayerShellHandler, LayerSurface, LayerSurfaceConfigure }, xdg::XdgSurface, xdg::popup::{ Popup, PopupConfigure, PopupHandler }, - xdg::window::{ Window, WindowConfigure, WindowHandler }, + xdg::window::{ DecorationMode, Window, WindowConfigure, WindowHandler }, }, shm::{ Shm, ShmHandler }, session_lock::{ SessionLock, SessionLockHandler, SessionLockSurface, SessionLockSurfaceConfigure }, @@ -222,6 +222,14 @@ impl WindowHandler for AppData window.set_max_size( None ); self.pending_size_hint_unpin = false; } + let tb = if configure.decoration_mode == DecorationMode::Server { 0.0 } + else { self.main.titlebar_base }; + if self.main.titlebar_height != tb + { + self.main.titlebar_height = tb; + self.main.content_dirty = true; + self.view_dirty = true; + } let ( hint_w, hint_h ) = self.app.window_size_hint().unwrap_or( ( 800, 600 ) ); let w = configure.new_size.0.map( |v| v.get() ).unwrap_or( hint_w ); let h = configure.new_size.1.map( |v| v.get() ).unwrap_or( hint_h ); diff --git a/src/event_loop/surface.rs b/src/event_loop/surface.rs index 1e05c3b..0b41dbe 100644 --- a/src/event_loop/surface.rs +++ b/src/event_loop/surface.rs @@ -260,6 +260,9 @@ pub( crate ) struct SurfaceState pub touch_slots: HashMap, /// Height of the client-side title bar (0 for layer-shell surfaces). pub titlebar_height: f32, + /// Title bar height before decoration negotiation; restored when the + /// compositor hands decorations back to the client. + pub titlebar_base: f32, /// Title text shown in the client-side title bar. pub titlebar_title: String, /// Rect of the close button in the title bar (for hit testing). @@ -313,6 +316,7 @@ impl SurfaceState context_menu: None, gesture: GestureState::new(), titlebar_height, + titlebar_base: titlebar_height, titlebar_title, titlebar_close_rect: Rect::default(), scale_factor: 1,