Skip to content

Commit 60caba6

Browse files
committed
wip
1 parent 7e260d6 commit 60caba6

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

‎src/platform/x11/sizing.rs‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl SizingState {
3636
if let Some(new_parent_size) = self.new_parent_size.take() {
3737
if new_parent_size != shared.sizing_state.size() {
3838
// The parent was resized, which means we should resize ourselves too.
39-
if let Err(e) = shared.xcb_window.resize(new_parent_size.cast()) {
39+
if let Err(e) = shared.xcb_window.resize(new_parent_size.cast())?.check() {
4040
crate::warn!("Failed to resize window: {}", e);
4141
} else {
4242
// Makes the rest of this function run on the new parent size immediately (without waiting for a ConfigureNotify round-trip)
@@ -68,8 +68,13 @@ impl SizingState {
6868

6969
if !comes_from_parent {
7070
if let Err(()) = host_handle.request_resize(new_size) {
71-
let previous = WindowSize::from_physical(previous.cast(), scale_factor);
72-
todo!() // roll back
71+
let previous_size = WindowSize::from_physical(previous.cast(), scale_factor);
72+
if let Err(()) = handler.resize(previous_size) {
73+
// If both host and handler failed, then we're kinda stuck here
74+
return Ok(());
75+
}
76+
shared.sizing_state.store_size(previous);
77+
shared.xcb_window.resize(previous.cast())?.check_warn();
7378
}
7479
}
7580

0 commit comments

Comments
 (0)