Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix behaviour of window resizing on Windows. #23497

Merged
merged 1 commit into from Jun 4, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -622,6 +622,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
}

self.send_window_size(WindowSizeType::Resize);
self.composite_if_necessary(CompositingReason::Resize);
}

pub fn on_mouse_window_event_class(&mut self, mouse_window_event: MouseWindowEvent) {
@@ -1525,4 +1526,6 @@ pub enum CompositingReason {
NewWebRenderFrame,
/// WebRender has processed a scroll event and has generated a new frame.
NewWebRenderScrollFrame,
/// The window has been resized and will need to be synchronously repainted.
Resize,
}
@@ -19,6 +19,15 @@ impl GlContext {
GlContext::None => unreachable!(),
}
}
pub fn resize(&mut self, size: glutin::dpi::PhysicalSize) {
if let GlContext::NotCurrent(_) = self {
self.make_current();
}
match self {
GlContext::Current(c) => c.resize(size),
_ => unreachable!(),
}
}
pub fn make_current(&mut self) {
*self = match std::mem::replace(self, GlContext::None) {
GlContext::Current(c) => {
@@ -441,7 +441,8 @@ impl WindowPortsMethods for Window {
self.event_queue.borrow_mut().push(WindowEvent::Quit);
},
glutin::WindowEvent::Resized(size) => {
self.gl_context.borrow_mut().window().set_inner_size(size);
let physical_size = size.to_physical(self.device_hidpi_factor().get() as f64);
self.gl_context.borrow_mut().resize(physical_size);
// window.set_inner_size() takes DeviceIndependentPixel.
let (width, height) = size.into();
let new_size = TypedSize2D::new(width, height);
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.