1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 13:20:05 -04:00

Now we can drag any viewport but only the viewport that is focused will be draged because if not on x11 the input will be taken until the application is killed

This commit is contained in:
Konkitoman
2023-07-25 11:53:10 +03:00
parent 93a7c018d7
commit 19d1fecb99
5 changed files with 56 additions and 7 deletions

View File

@@ -1043,6 +1043,7 @@ mod glow_integration {
textures_delta,
shapes,
mut viewports,
viewport_commands,
};
let control_flow;
@@ -1077,6 +1078,7 @@ mod glow_integration {
textures_delta,
shapes,
viewports,
viewport_commands,
} = integration.update(
app.as_mut(),
win.window.as_ref().unwrap(),
@@ -1235,6 +1237,27 @@ mod glow_integration {
active_viewports_ids.push(id);
}
/// TODO Make this more efficient
for (id, command) in viewport_commands {
for window in gl_window.windows.iter() {
if window.window_id == id {
if let Some(win) = &window.window {
match command {
egui::window::ViewportCommand::Drag => {
// if this is not checked on x11 the input will be permanently taken until the app is killed!
if let Some(focus) = self.is_focused {
if focus == id {
win.drag_window();
}
}
}
}
}
break;
}
}
}
gl_window
.windows
.retain(|w| active_viewports_ids.contains(&w.window_id));