diff options
author | 2024-09-05 11:22:03 +0200 | |
---|---|---|
committer | 2024-09-05 11:22:03 +0200 | |
commit | b5cbb4a4e48f219cfaac2eb67e83f57859744b5b (patch) | |
tree | c7bc3b7d8e3b6fe1b04f5996e2f86606f7e3ade0 /runtime | |
parent | d1ceada11996a0137e8fb4377f1011af3f08d24f (diff) | |
parent | 64ec099a9b4490a424d35a4be37c564177e71edf (diff) | |
download | iced-b5cbb4a4e48f219cfaac2eb67e83f57859744b5b.tar.gz iced-b5cbb4a4e48f219cfaac2eb67e83f57859744b5b.tar.bz2 iced-b5cbb4a4e48f219cfaac2eb67e83f57859744b5b.zip |
Merge pull request #2284 from jquesada2016/mouse_passthrough
Add command for setting mouse passthrough
Diffstat (limited to '')
-rw-r--r-- | runtime/src/window.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/runtime/src/window.rs b/runtime/src/window.rs index ce6fd1b6..cdf3d80a 100644 --- a/runtime/src/window.rs +++ b/runtime/src/window.rs @@ -147,6 +147,18 @@ pub enum Action { /// Screenshot the viewport of the window. Screenshot(Id, oneshot::Sender<Screenshot>), + + /// Enables mouse passthrough for the given window. + /// + /// This disables mouse events for the window and passes mouse events + /// through to whatever window is underneath. + EnableMousePassthrough(Id), + + /// Disable mouse passthrough for the given window. + /// + /// This enables mouse events for the window and stops mouse events + /// from being passed to whatever is underneath. + DisableMousePassthrough(Id), } /// Subscribes to the frames of the window of the running application. @@ -406,3 +418,19 @@ pub fn screenshot(id: Id) -> Task<Screenshot> { crate::Action::Window(Action::Screenshot(id, channel)) }) } + +/// Enables mouse passthrough for the given window. +/// +/// This disables mouse events for the window and passes mouse events +/// through to whatever window is underneath. +pub fn enable_mouse_passthrough<Message>(id: Id) -> Task<Message> { + task::effect(crate::Action::Window(Action::EnableMousePassthrough(id))) +} + +/// Disable mouse passthrough for the given window. +/// +/// This enables mouse events for the window and stops mouse events +/// from being passed to whatever is underneath. +pub fn disable_mouse_passthrough<Message>(id: Id) -> Task<Message> { + task::effect(crate::Action::Window(Action::DisableMousePassthrough(id))) +} |