-
-
Notifications
You must be signed in to change notification settings - Fork 310
Open
Description
I have a custom macOS titlebar, and I want egui to not use any of the space in my virtual titlebar, e.g. the top 28 pixels of space.
How do I tell egui that the screen rect is actually 28pixels smaller?
I tried something like this, it did not work:
#[cfg(target_os = "macos")]
app.add_systems(
EguiPrimaryContextPass,
macos_titlebar.run_if(woot_app::fullscreen::is_windowed),
);
...
#[cfg(target_os = "macos")]
fn modify_screen_rect(mut contexts: EguiContexts) -> Result {
let ctx = contexts.ctx_mut()?;
// Modify the raw input to shrink the screen rect
ctx.input_mut(|i| {
let old_rect = i.screen_rect;
i.screen_rect = egui::Rect {
min: egui::Pos2 {
x: old_rect.min.x,
y: old_rect.min.y + MACOS_TITLEBAR_HEIGHT,
},
max: old_rect.max,
};
});
Ok(())
}Metadata
Metadata
Assignees
Labels
No labels