epi: drag native window (#728)

* feat: drag window

* Update epi/src/lib.rs

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>

* Update egui_demo_lib/src/backend_panel.rs

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>

* cargo fmt

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This commit is contained in:
zu1k
2021-09-28 17:34:58 +02:00
committed by GitHub
co-authored by Emil Ernerfeldt
parent 1b36863248
commit f6fb4d942a
4 changed files with 24 additions and 0 deletions
+11
View File
@@ -252,6 +252,14 @@ impl<'a> Frame<'a> {
self.0.output.decorated = Some(decorated);
}
/// When called, the native window will follow the
/// movement of the cursor while the primary mouse button is down.
///
/// Does not work on the web, and works badly on Mac.
pub fn drag_window(&mut self) {
self.0.output.drag_window = true;
}
/// If you need to request a repaint from another thread, clone this and send it to that other thread.
pub fn repaint_signal(&self) -> std::sync::Arc<dyn RepaintSignal> {
self.0.repaint_signal.clone()
@@ -410,5 +418,8 @@ pub mod backend {
/// Set to some bool to change window decorations
pub decorated: Option<bool>,
/// Set to true to drap window
pub drag_window: bool,
}
}