Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions src/platform/x11/event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ impl EventLoop {
}

fn handle_coalesced_resize_events(&mut self) -> Result<(), FatalError> {
let mut comes_from_parent = false;
if let Some(new_parent_size) = self.new_parent_size.take() {
if new_parent_size != self.window.get_size() {
// The parent was resized, which means we should resize ourselves too.
Expand All @@ -180,6 +181,7 @@ impl EventLoop {
// Makes the rest of this function run on the new parent size immediately (without waiting for a ConfigureNotify round-trip)
// Also overrides any new sizes we may have received this event loop iteration,it would probably be invalidated anyway
self.new_size = Some(new_parent_size);
comes_from_parent = true;
}
}
}
Expand All @@ -198,21 +200,24 @@ impl EventLoop {
warn!("Window Handler failed to resize: {}", e);
self.window.store_size(previous);
self.window.xcb_window.resize(previous.cast())?.check_warn();
} else {
// Host requests use resize_immediately, which stops the previous == new_size condition
// So if we're here, it's guaranteed not to be from a host request
return Ok(());
}

// Host requests use resize_immediately, which stops the previous == new_size condition
// So if we're here, it's guaranteed not to be from a host request

if !comes_from_parent {
if let Some(host) = self.main_thread.as_mut() {
host.send(HostCallback::Resized {
new_size,
previous: WindowSize::from_physical(previous.cast(), scale_factor),
})?;
}

// Immediately schedule a redraw, do not wait for an "expose" event
self.exposed = true;
}

// Immediately schedule a redraw, do not wait for an "expose" event
self.exposed = true;

Ok(())
}

Expand Down