Skip to content

Commit

Permalink
macOS resize fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexApps99 committed Sep 22, 2021
1 parent 4841eb0 commit 08f30b2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 19 deletions.
11 changes: 2 additions & 9 deletions egui_glium/examples/pure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,8 @@ fn main() {
*control_flow = glutin::event_loop::ControlFlow::Exit;
}

if let glutin::event::WindowEvent::Resized(glutin::dpi::PhysicalSize {
width: width_in_pixels,
height: height_in_pixels,
}) = event
{
unsafe {
use glow::HasContext;
gl.viewport(0, 0, width_in_pixels as i32, height_in_pixels as i32);
}
if let glutin::event::WindowEvent::Resized(physical_size) = event {
display.resize(physical_size);
}

egui.on_event(&event);
Expand Down
12 changes: 2 additions & 10 deletions egui_glium/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,16 +289,8 @@ pub fn run(mut app: Box<dyn epi::App>, native_options: epi::NativeOptions) {
running = false;
}

if let glutin::event::WindowEvent::Resized(glutin::dpi::PhysicalSize {
width: width_in_pixels,
height: height_in_pixels,
}) = event
{
println!("{}x{}", width_in_pixels, height_in_pixels);
unsafe {
use glow::HasContext;
gl.viewport(0, 0, width_in_pixels as i32, height_in_pixels as i32);
}
if let glutin::event::WindowEvent::Resized(physical_size) = event {
gl_window.resize(physical_size);
}

if let glutin::event::WindowEvent::Focused(new_focused) = event {
Expand Down
2 changes: 2 additions & 0 deletions egui_glium/src/painter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,8 @@ impl Painter {
let width_in_points = width_in_pixels as f32 / pixels_per_point;
let height_in_points = height_in_pixels as f32 / pixels_per_point;

gl.viewport(0, 0, width_in_pixels as i32, height_in_pixels as i32);

gl.use_program(Some(self.program));

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

0 comments on commit 08f30b2

Please sign in to comment.