Skip to content

Commit 08f30b2

Browse files
committed
macOS resize fix
1 parent 4841eb0 commit 08f30b2

File tree

3 files changed

+6
-19
lines changed

3 files changed

+6
-19
lines changed

egui_glium/examples/pure.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,8 @@ fn main() {
105105
*control_flow = glutin::event_loop::ControlFlow::Exit;
106106
}
107107

108-
if let glutin::event::WindowEvent::Resized(glutin::dpi::PhysicalSize {
109-
width: width_in_pixels,
110-
height: height_in_pixels,
111-
}) = event
112-
{
113-
unsafe {
114-
use glow::HasContext;
115-
gl.viewport(0, 0, width_in_pixels as i32, height_in_pixels as i32);
116-
}
108+
if let glutin::event::WindowEvent::Resized(physical_size) = event {
109+
display.resize(physical_size);
117110
}
118111

119112
egui.on_event(&event);

egui_glium/src/backend.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -289,16 +289,8 @@ pub fn run(mut app: Box<dyn epi::App>, native_options: epi::NativeOptions) {
289289
running = false;
290290
}
291291

292-
if let glutin::event::WindowEvent::Resized(glutin::dpi::PhysicalSize {
293-
width: width_in_pixels,
294-
height: height_in_pixels,
295-
}) = event
296-
{
297-
println!("{}x{}", width_in_pixels, height_in_pixels);
298-
unsafe {
299-
use glow::HasContext;
300-
gl.viewport(0, 0, width_in_pixels as i32, height_in_pixels as i32);
301-
}
292+
if let glutin::event::WindowEvent::Resized(physical_size) = event {
293+
gl_window.resize(physical_size);
302294
}
303295

304296
if let glutin::event::WindowEvent::Focused(new_focused) = event {

egui_glium/src/painter.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,8 @@ impl Painter {
302302
let width_in_points = width_in_pixels as f32 / pixels_per_point;
303303
let height_in_points = height_in_pixels as f32 / pixels_per_point;
304304

305+
gl.viewport(0, 0, width_in_pixels as i32, height_in_pixels as i32);
306+
305307
gl.use_program(Some(self.program));
306308

307309
// The texture coordinates for text are so that both nearest and linear should work with the egui font texture.

0 commit comments

Comments
 (0)