Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eframe: Mouse-passthrough option #2080

Merged
merged 1 commit into from
Oct 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions crates/eframe/src/epi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,10 @@ pub struct NativeOptions {
/// You should avoid having a [`egui::CentralPanel`], or make sure its frame is also transparent.
pub transparent: bool,

/// On desktop: mouse clicks pass through the window, used for non-interactable overlays
/// Generally you would use this in conjunction with always_on_top
pub mouse_passthrough: bool,

/// Turn on vertical syncing, limiting the FPS to the display refresh rate.
///
/// The default is `true`.
Expand Down Expand Up @@ -389,6 +393,7 @@ impl Default for NativeOptions {
max_window_size: None,
resizable: true,
transparent: false,
mouse_passthrough: false,
vsync: true,
multisampling: 0,
depth_buffer: 0,
Expand Down
3 changes: 3 additions & 0 deletions crates/eframe/src/native/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,9 @@ mod glow_integration {
integration.egui_ctx.set_visuals(theme.egui_visuals());

gl_window.window().set_ime_allowed(true);
if self.native_options.mouse_passthrough {
gl_window.window().set_cursor_hittest(false).unwrap();
}

{
let event_loop_proxy = self.repaint_proxy.clone();
Expand Down