1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 05:10:03 -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

@@ -53,15 +53,18 @@ fn main() -> Result<(), eframe::Error> {
"Current rendering window: {}",
ctx.current_rendering_viewport()
));
if ui.button("Drag").is_pointer_button_down_on() {
ctx.viewport_command(id, egui::window::ViewportCommand::Drag)
}
},
);
});
let clone = window2_embedded.clone();
let embedded = *window2_embedded.read().unwrap();
egui::CollapsingHeader::new("Shout Test2").show(ui, |ui| {
egui::Window::new("Test2")
.embedded(embedded)
.show(ctx, move |ui, _, parent_id| {
egui::Window::new("Test2").embedded(embedded).show(
ctx,
move |ui, id, parent_id| {
if ui
.checkbox(&mut *clone.write().unwrap(), "Should embedd?")
.clicked()
@@ -73,7 +76,12 @@ fn main() -> Result<(), eframe::Error> {
"Current rendering window: {}",
ctx.current_rendering_viewport()
));
});
if ui.button("Drag").is_pointer_button_down_on() {
ctx.viewport_command(id, egui::window::ViewportCommand::Drag)
}
},
);
});
});
})