8000 Workaround top area not clickable on MacOS fullscreen by lucasmerlin · Pull Request #7281 · emilk/egui · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Workaround top area not clickable on MacOS fullscreen #7281

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lucasmerlin
Copy link
Collaborator
@lucasmerlin lucasmerlin commented Jul 1, 2025

Unfortunately this only works when the accesskit feature is disabled, since accesskit requires the window to be hidden on first frame.

To test: cargo run -p egui_demo_app --no-default-features --features glow should work and cargo run -p egui_demo_app should not work

@lucasmerlin lucasmerlin added bug Something is broken eframe Relates to epi and eframe labels Jul 1, 2025
Copy link
github-actions bot commented Jul 1, 2025

Preview available at https://egui-pr-preview.github.io/pr/7281-lucasfix-macos-fullscreen
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

// Fix the top window area not being clickable on macOS when in fullscreen on an external display
// See https://github.com/rust-windowing/winit/issues/4295, https://github.com/rerun-io/rerun/issues/10280
#[cfg(all(target_os = "macos", not(feature = "accesskit")))]
let viewport_builder = viewport_builder.with_visible(true);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this will cause a white flash on Windows again:

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't, unless my cfg statement is wrong 😬

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah 🤦

Copy link
Owner
@emilk emilk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's check that this actually fixes the Rerun issue before we merge this

Comment on lines 158 to +163
.with_visible(false); // Start hidden until we render the first frame to fix white flash on startup (https://github.com/emilk/egui/pull/3631)

// Fix the top window area not being clickable on macOS when in fullscreen on an external display
// See https://github.com/rust-windowing/winit/issues/4295, https://github.com/rerun-io/rerun/issues/10280
#[cfg(all(target_os = "macos", not(feature = "accesskit")))]
let winit_window_builder = winit_window_builder.with_visible(true);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to prefer the cfg! macro, because I find it leads to easier-to-read code:

// Fix the top window area not being clickable on macOS when in fullscreen on an external display
// See https://github.com/rust-windowing/winit/issues/4295, https://github.com/rerun-io/rerun/issues/10280
#[cfg(all(target_os = "macos", not(feature = "accesskit")))]
let viewport_builder = viewport_builder.with_visible(true);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can make a reusable function for this that better explain the if-and-why of it:

fn start_visible() {
	if cfg!(feature = "accesskit") {
	    true // accesskit requires this: $LINK
	 } else if cfg!(windows) {
	     true // Fixes white flash on startup (https://github.com/emilk/egui/pull/3631)
	 } else if cfg!(target_os = "macos") {
	      // Fix the top window area not being clickable on macOS when in fullscreen on an external display
	      // See https://github.com/rust-windowing/winit/issues/4295, https://github.com/rerun-io/rerun/issues/10280
	     false
	 } else {
	     true // no known preference one way or the other
	 }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken eframe Relates to epi and eframe
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0