diff --git a/crates/eframe/src/native/glow_integration.rs b/crates/eframe/src/native/glow_integration.rs index bfdee21d..67fcd714 100644 --- a/crates/eframe/src/native/glow_integration.rs +++ b/crates/eframe/src/native/glow_integration.rs @@ -1284,7 +1284,6 @@ 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( @@ -1292,7 +1291,6 @@ impl GlutinWindowContext { &mut viewport.info, std::mem::take(&mut viewport.deferred_commands), window, - is_viewport_focused, &mut viewport.actions_requested, ); diff --git a/crates/eframe/src/native/wgpu_integration.rs b/crates/eframe/src/native/wgpu_integration.rs index 28f149f0..5b9785fc 100644 --- a/crates/eframe/src/native/wgpu_integration.rs +++ b/crates/eframe/src/native/wgpu_integration.rs @@ -635,7 +635,7 @@ impl WgpuWinitRunning { viewports, painter, viewport_from_window, - focused_viewport, + .. } = &mut *shared_mut; let FullOutput { @@ -724,7 +724,6 @@ impl WgpuWinitRunning { viewports, painter, viewport_from_window, - *focused_viewport, ); // Prune dead viewports: @@ -996,7 +995,6 @@ fn render_immediate_viewport( viewports, painter, viewport_from_window, - focused_viewport, .. } = &mut *shared_mut; @@ -1036,7 +1034,6 @@ fn render_immediate_viewport( viewports, painter, viewport_from_window, - *focused_viewport, ); } @@ -1061,7 +1058,6 @@ fn handle_viewport_output( viewports: &mut ViewportIdMap, painter: &mut egui_wgpu::winit::Painter, viewport_from_window: &mut HashMap, - focused_viewport: Option, ) { for ( viewport_id, @@ -1083,7 +1079,6 @@ fn handle_viewport_output( if let Some(window) = viewport.window.as_ref() { let old_inner_size = window.inner_size(); - let is_viewport_focused = focused_viewport == Some(viewport_id); viewport.deferred_commands.append(&mut commands); egui_winit::process_viewport_commands( @@ -1091,7 +1086,6 @@ fn handle_viewport_output( &mut viewport.info, std::mem::take(&mut viewport.deferred_commands), window, - is_viewport_focused, &mut viewport.actions_requested, ); diff --git a/crates/egui-winit/src/lib.rs b/crates/egui-winit/src/lib.rs index 9a573598..420bad88 100644 --- a/crates/egui-winit/src/lib.rs +++ b/crates/egui-winit/src/lib.rs @@ -1284,18 +1284,10 @@ pub fn process_viewport_commands( info: &mut ViewportInfo, commands: impl IntoIterator, window: &Window, - is_viewport_focused: bool, actions_requested: &mut HashSet, ) { for command in commands { - process_viewport_command( - egui_ctx, - window, - command, - info, - is_viewport_focused, - actions_requested, - ); + process_viewport_command(egui_ctx, window, command, info, actions_requested); } } @@ -1304,7 +1296,6 @@ fn process_viewport_command( window: &Window, command: ViewportCommand, info: &mut ViewportInfo, - is_viewport_focused: bool, actions_requested: &mut HashSet, ) { crate::profile_function!(); @@ -1323,12 +1314,8 @@ fn process_viewport_command( // Need to be handled elsewhere } ViewportCommand::StartDrag => { - // If `is_viewport_focused` is not checked on x11 the input will be permanently taken until the app is killed! - - // TODO(emilk): check that the left mouse-button was pressed down recently, - // or we will have bugs on Windows. - // See https://github.com/emilk/egui/pull/1108 - if is_viewport_focused { + // If `.has_focus()` is not checked on x11 the input will be permanently taken until the app is killed! + if window.has_focus() { if let Err(err) = window.drag_window() { log::warn!("{command:?}: {err}"); } diff --git a/crates/egui_glow/src/winit.rs b/crates/egui_glow/src/winit.rs index 5f981ab6..a9bec5fd 100644 --- a/crates/egui_glow/src/winit.rs +++ b/crates/egui_glow/src/winit.rs @@ -85,7 +85,6 @@ impl EguiGlow { &mut self.viewport_info, commands, window, - true, &mut actions_requested, ); for action in actions_requested { diff --git a/examples/custom_window_frame/src/main.rs b/examples/custom_window_frame/src/main.rs index d3ce27e2..ef5cc2db 100644 --- a/examples/custom_window_frame/src/main.rs +++ b/examples/custom_window_frame/src/main.rs @@ -112,7 +112,7 @@ fn title_bar_ui(ui: &mut egui::Ui, title_bar_rect: eframe::epaint::Rect, title: .send_viewport_cmd(ViewportCommand::Maximized(!is_maximized)); } - if title_bar_response.dragged_by(PointerButton::Primary) { + if title_bar_response.drag_started_by(PointerButton::Primary) { ui.ctx().send_viewport_cmd(ViewportCommand::StartDrag); }