event_loop: honour App::window_size_hint() on the first configure

Previously only `set_min_size()` was called with the requested size, on the assumption that the compositor would adopt it as the initial dimension. In practice that doesn't hold: xdg-shell has no "preferred initial size" primitive and compositors are free to pick any size within `[min, max]` on the first configure. The window ended up opening at the 800x600 fallback instead of the size the application had asked for.
The fix pins `min == max` before the first commit, which forces the compositor to honour the requested size in its first configure, and then releases `max_size` from the configure handler via the `pending_size_hint_unpin` latch so the surface remains user-resizable afterwards. The 800x600 fallback now only applies when the application does not provide a hint.
This commit is contained in:
2026-05-10 23:16:17 +02:00
parent f3621b72c9
commit 703a1ed228
3 changed files with 17 additions and 13 deletions

View File

@@ -207,8 +207,14 @@ impl<A: App> WindowHandler for AppData<A>
window.set_fullscreen( None );
self.pending_fullscreen = false;
}
let w = configure.new_size.0.map( |v| v.get() ).unwrap_or( 800 );
let h = configure.new_size.1.map( |v| v.get() ).unwrap_or( 600 );
if self.pending_size_hint_unpin
{
window.set_max_size( None );
self.pending_size_hint_unpin = false;
}
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 );
self.on_configure( w, h );
self.app.on_resize( w, h );
}