Skip to content

Commit

Permalink
Update glow_integration.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
rustbasic authored Jun 16, 2024
1 parent 676cf46 commit e349038
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions crates/eframe/src/native/glow_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -689,8 +689,6 @@ impl GlowWinitRunning {
return EventResult::Wait;
};

egui_winit.handle_platform_output(window, platform_output);

let clipped_primitives = integration.egui_ctx.tessellate(shapes, pixels_per_point);

{
Expand Down Expand Up @@ -775,6 +773,8 @@ impl GlowWinitRunning {
}
}

egui_winit.handle_platform_output(&window, platform_output);

glutin.handle_viewport_output(event_loop, &integration.egui_ctx, &viewport_output);

integration.report_frame_time(frame_timer.total_time_sec()); // don't count auto-save time as part of regular frame time
Expand Down Expand Up @@ -885,22 +885,24 @@ fn change_gl_context(
) {
crate::profile_function!();

let Some(p_current_gl_context) = current_gl_context.take() else {
return;
};

if !cfg!(target_os = "windows") {
// According to https://github.com/emilk/egui/issues/4289
// we cannot do this early-out on Windows.
// TODO(emilk): optimize context switching on Windows too.
// See https://github.com/emilk/egui/issues/4173

crate::profile_scope!("is_current");
if gl_surface.is_current(&p_current_gl_context) {
return; // Early-out to save a lot of time.
if let Some(current_gl_context) = current_gl_context {
crate::profile_scope!("is_current");
if gl_surface.is_current(current_gl_context) {
return; // Early-out to save a lot of time.
}
}
}

let Some(p_current_gl_context) = current_gl_context.take() else {
return;
};

crate::profile_scope!("make_not_current");
let Ok(not_current) = p_current_gl_context.make_not_current() else {
return;
Expand Down Expand Up @@ -1313,15 +1315,13 @@ impl GlutinWindowContext {
if let Some(window) = &viewport.window {
let old_inner_size = window.inner_size();

let is_viewport_focused = self.focused_viewport == Some(viewport_id);
viewport.deferred_commands.append(&mut commands);

egui_winit::process_viewport_commands(
egui_ctx,
&mut viewport.info,
std::mem::take(&mut viewport.deferred_commands),
window,
is_viewport_focused,
&mut viewport.actions_requested,
);

Expand Down

0 comments on commit e349038

Please sign in to comment.