diff --git a/src/app.rs b/src/app.rs index ea99b48..549adb3 100644 --- a/src/app.rs +++ b/src/app.rs @@ -816,6 +816,22 @@ pub trait App: 'static /// **Default**: `None` (let the compositor pick). fn window_size_hint( &self ) -> Option<( u32, u32 )> { None } + /// Whether the user may resize an xdg-shell window. + /// + /// When [`Self::window_size_hint`] is set, ltk pins + /// `min_size == max_size` before the first commit so the compositor's + /// first configure honours the requested size, and then releases + /// `max_size` from the first configure so the surface becomes + /// user-resizable. Returning `false` skips that release: the pin stays + /// in place for the lifetime of the toplevel, declaring a fixed-size + /// window that compositors must not resize or restore a remembered + /// geometry over. + /// + /// Ignored when [`Self::window_size_hint`] returns `None`. + /// + /// **Default**: `true`. + fn window_resizable( &self ) -> bool { true } + /// Request fullscreen on the toplevel before its first commit. /// /// When `true`, ltk calls `xdg_toplevel.set_fullscreen( None )` so diff --git a/src/event_loop/run.rs b/src/event_loop/run.rs index abe7d29..40bb30c 100644 --- a/src/event_loop/run.rs +++ b/src/event_loop/run.rs @@ -257,7 +257,7 @@ pub( crate ) fn try_run( app: A ) -> Result<(), RunError> let titlebar_title = force_window.map( |( t, _ )| t ).unwrap_or_default(); let pending_fullscreen = app.start_fullscreen(); - let pending_size_hint_unpin = !app.start_fullscreen() && app.window_size_hint().is_some(); + let pending_size_hint_unpin = !app.start_fullscreen() && app.window_size_hint().is_some() && app.window_resizable(); let mut data = AppData {