Skip to content

Commit 9901ad4

Browse files
authored
eframe: Mouse passthrough option (#2080)
1 parent 53ff837 commit 9901ad4

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

crates/eframe/src/epi.rs

+5
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,10 @@ pub struct NativeOptions {
270270
/// You should avoid having a [`egui::CentralPanel`], or make sure its frame is also transparent.
271271
pub transparent: bool,
272272

273+
/// On desktop: mouse clicks pass through the window, used for non-interactable overlays
274+
/// Generally you would use this in conjunction with always_on_top
275+
pub mouse_passthrough: bool,
276+
273277
/// Turn on vertical syncing, limiting the FPS to the display refresh rate.
274278
///
275279
/// The default is `true`.
@@ -389,6 +393,7 @@ impl Default for NativeOptions {
389393
max_window_size: None,
390394
resizable: true,
391395
transparent: false,
396+
mouse_passthrough: false,
392397
vsync: true,
393398
multisampling: 0,
394399
depth_buffer: 0,

crates/eframe/src/native/run.rs

+3
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,9 @@ mod glow_integration {
383383
integration.egui_ctx.set_visuals(theme.egui_visuals());
384384

385385
gl_window.window().set_ime_allowed(true);
386+
if self.native_options.mouse_passthrough {
387+
gl_window.window().set_cursor_hittest(false).unwrap();
388+
}
386389

387390
{
388391
let event_loop_proxy = self.repaint_proxy.clone();

0 commit comments

Comments
 (0)