On Wayland, fix min/max inner size setting

The size is only applied on the next `wl_surface::commit` thus we
must trigger the redraw.
This commit is contained in:
Kirill Chibisov
2024-02-01 00:11:31 +04:00
parent c9030f06c0
commit 3de08204d3
3 changed files with 17 additions and 5 deletions

View File

@@ -327,7 +327,9 @@ impl Window {
self.window_state
.lock()
.unwrap()
.set_min_inner_size(min_size)
.set_min_inner_size(min_size);
// NOTE: Requires commit to be applied.
self.request_redraw();
}
/// Set the maximum inner size for the window.
@@ -338,7 +340,9 @@ impl Window {
self.window_state
.lock()
.unwrap()
.set_max_inner_size(max_size)
.set_max_inner_size(max_size);
// NOTE: Requires commit to be applied.
self.request_redraw();
}
#[inline]
@@ -387,7 +391,10 @@ impl Window {
#[inline]
pub fn set_resizable(&self, resizable: bool) {
self.window_state.lock().unwrap().set_resizable(resizable);
if self.window_state.lock().unwrap().set_resizable(resizable) {
// NOTE: Requires commit to be applied.
self.request_redraw();
}
}
#[inline]

View File

@@ -498,10 +498,12 @@ impl WindowState {
}
/// Set the resizable state on the window.
///
/// Returns `true` when the state was applied.
#[inline]
pub fn set_resizable(&mut self, resizable: bool) {
pub fn set_resizable(&mut self, resizable: bool) -> bool {
if self.resizable == resizable {
return;
return false;
}
self.resizable = resizable;
@@ -517,6 +519,8 @@ impl WindowState {
if let Some(frame) = self.frame.as_mut() {
frame.set_resizable(resizable);
}
true
}
/// Whether the window is focused by any seat.