From 727edd95f6d95e2a3c9aac6422c399a18aebcf4c Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Thu, 13 Jun 2024 20:06:29 +0900 Subject: [PATCH 1/6] Update glow_integration.rs --- crates/eframe/src/native/glow_integration.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/crates/eframe/src/native/glow_integration.rs b/crates/eframe/src/native/glow_integration.rs index bfdee21d8d9..67fcd71471a 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, ); From 5daa386b23cd3ed1edb673175002dd575a01d48a Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Thu, 13 Jun 2024 20:10:38 +0900 Subject: [PATCH 2/6] Update lib.rs --- crates/egui-winit/src/lib.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/crates/egui-winit/src/lib.rs b/crates/egui-winit/src/lib.rs index 9a57359887b..f0fe0e9be36 100644 --- a/crates/egui-winit/src/lib.rs +++ b/crates/egui-winit/src/lib.rs @@ -1284,7 +1284,6 @@ 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 { @@ -1293,7 +1292,6 @@ pub fn process_viewport_commands( window, command, info, - is_viewport_focused, actions_requested, ); } @@ -1304,7 +1302,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 +1320,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}"); } From 0f6ee841d076a801cf33e5436e9be0287a62edd5 Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Thu, 13 Jun 2024 20:19:06 +0900 Subject: [PATCH 3/6] Update wgpu_integration.rs --- crates/eframe/src/native/wgpu_integration.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/crates/eframe/src/native/wgpu_integration.rs b/crates/eframe/src/native/wgpu_integration.rs index 28f149f0b3f..5b9785fc9f5 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, ); From 0c0b5ba7c2dc7759c228660d746366cffa665136 Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Thu, 13 Jun 2024 20:27:33 +0900 Subject: [PATCH 4/6] Update winit.rs --- crates/egui_glow/src/winit.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/egui_glow/src/winit.rs b/crates/egui_glow/src/winit.rs index 5f981ab66d9..a9bec5fd039 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 { From 325f682871df7e9ea5816339c9e1dc2eb8dda981 Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Thu, 13 Jun 2024 20:28:13 +0900 Subject: [PATCH 5/6] Update lib.rs --- crates/egui-winit/src/lib.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/crates/egui-winit/src/lib.rs b/crates/egui-winit/src/lib.rs index f0fe0e9be36..420bad88162 100644 --- a/crates/egui-winit/src/lib.rs +++ b/crates/egui-winit/src/lib.rs @@ -1287,13 +1287,7 @@ pub fn process_viewport_commands( actions_requested: &mut HashSet, ) { for command in commands { - process_viewport_command( - egui_ctx, - window, - command, - info, - actions_requested, - ); + process_viewport_command(egui_ctx, window, command, info, actions_requested); } } From 63b8ca840bc3f1dc0b1ab1600bb7e92a0fca62b4 Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Thu, 13 Jun 2024 20:29:56 +0900 Subject: [PATCH 6/6] Update main.rs --- examples/custom_window_frame/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/custom_window_frame/src/main.rs b/examples/custom_window_frame/src/main.rs index d3ce27e2b5b..ef5cc2dbb55 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); }