Skip to content

Commit

Permalink
Remember to update glow window size when DPI changes (#1441)
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk authored Apr 3, 2022
1 parent aa6a2bb commit 95efbbc
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
1 change: 1 addition & 0 deletions eframe/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ NOTE: [`egui_web`](../egui_web/CHANGELOG.md), [`egui-winit`](../egui-winit/CHANG
* Changed `App::update` to take `&mut Frame` instead of `&Frame`.
* `Frame` is no longer `Clone` or `Sync`.
* Add `glow` (OpenGL) context to `Frame` ([#1425](https://github.com/emilk/egui/pull/1425)).
* Fixed potential scale bug when DPI scaling changes (e.g. when dragging a window between different displays) ([#1441](https://github.com/emilk/egui/pull/1441)).


## 0.17.0 - 2022-02-22
Expand Down
1 change: 1 addition & 0 deletions egui_glow/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ All notable changes to the `egui_glow` integration will be noted in this file.
## Unreleased
* Improved logging on rendering failures.
* Add new `NativeOptions`: `vsync`, `multisampling`, `depth_buffer`, `stencil_buffer`.
* Fixed potential scale bug when DPI scaling changes (e.g. when dragging a window between different displays) ([#1441](https://github.com/emilk/egui/pull/1441)).


## 0.17.0 - 2022-02-22
Expand Down
10 changes: 8 additions & 2 deletions egui_glow/examples/pure_glow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,14 @@ fn main() {
*control_flow = glutin::event_loop::ControlFlow::Exit;
}

if let glutin::event::WindowEvent::Resized(physical_size) = event {
gl_window.resize(physical_size);
if let glutin::event::WindowEvent::Resized(physical_size) = &event {
gl_window.resize(*physical_size);
} else if let glutin::event::WindowEvent::ScaleFactorChanged {
new_inner_size,
..
} = &event
{
gl_window.resize(**new_inner_size);
}

egui_glow.on_event(&event);
Expand Down
10 changes: 8 additions & 2 deletions egui_glow/src/epi_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,14 @@ pub fn run(app_name: &str, native_options: &epi::NativeOptions, app_creator: epi
is_focused = new_focused;
}

if let winit::event::WindowEvent::Resized(physical_size) = event {
gl_window.resize(physical_size);
if let winit::event::WindowEvent::Resized(physical_size) = &event {
gl_window.resize(*physical_size);
} else if let glutin::event::WindowEvent::ScaleFactorChanged {
new_inner_size,
..
} = &event
{
gl_window.resize(**new_inner_size);
}

integration.on_event(app.as_mut(), &event);
Expand Down

0 comments on commit 95efbbc

Please sign in to comment.