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

App window is brought to foreground whenever Context::request_repaint is called #3620

Closed
Barugon opened this issue Nov 24, 2023 · 7 comments · Fixed by #3643
Closed

App window is brought to foreground whenever Context::request_repaint is called #3620

Barugon opened this issue Nov 24, 2023 · 7 comments · Fixed by #3643
Labels
bug Something is broken eframe Relates to epi and eframe native-linux Problem specific to Linux
Milestone

Comments

@Barugon
Copy link
Contributor

Barugon commented Nov 24, 2023

egui version 0.24.0

Describe the bug
In addition to what the title says, even without calling Context::request_repaint, the window remains on top when I switch to another app.

To Reproduce

  1. Build and runt the attached project. It will issue a Context::request_repaint every second.
  2. Switch to another app and note that this app's window will be moved to the foreground.

Even if Context::request_repaint is not deliberately called, moving your mouse over any exposed part of the window will bring it to the front.

Expected behavior
Context::request_repaint should not effect the desktop window order.

Desktop

  • Memory: 32.0 GiB
  • Processor: AMD Ryzen™ 9 3900X × 24
  • Graphics: AMD Radeon™ RX 6700 XT
  • OS Name: Fedora Linux 39 (Workstation Edition)
  • OS Type: 64-bit
  • GNOME Version: 45.1
  • Windowing System: Wayland
  • Kernel Version: Linux 6.5.12-300.fc39.x86_64

testy.zip

@Barugon Barugon added the bug Something is broken label Nov 24, 2023
@Barugon Barugon changed the title App window is focused whenever Context::request_repaint is called App window is brought to foreground whenever Context::request_repaint is called Nov 24, 2023
@emilk emilk added eframe Relates to epi and eframe native-linux Problem specific to Linux labels Nov 24, 2023
@emilk
Copy link
Owner

emilk commented Nov 24, 2023

Thanks for the report! I cannot reproduce on Mac, so I suspect this is a bug specific to Linux/Wayland.

Is this a new bug for 0.24?

Does it still happen if you use the "wgpu" feature of eframe?
If it is glow only, I wonder if it could be because of the make_current call 🤔

Does it only happen when waking from a background thread, or does it happen with Context::request_repaint_after too?

@sourcebox
Copy link

I can confirm that this bug is new in 0.24 and happens also on Linux without using Wayland. I use Context::request_repaint_after in my application.

@Barugon
Copy link
Contributor Author

Barugon commented Nov 24, 2023

Is this a new bug for 0.24?

Yes.

Does it still happen if you use the "wgpu" feature of eframe?

If I try to build with the "wgpu" feature then I get this error:

the package `wgpu` depends on `web-sys`, with features: `GpuComputePassTimestampWrite` but `web-sys` does not have these features.

[edit] I don't know why web-sys needs to be pulled in for a non-wasm project.

@emilk
Copy link
Owner

emilk commented Nov 27, 2023

Does it still happen if you use the "wgpu" feature of eframe?

If I try to build with the "wgpu" feature then I get this error:

the package `wgpu` depends on `web-sys`, with features: `GpuComputePassTimestampWrite` but `web-sys` does not have these features.

[edit] I don't know why web-sys needs to be pulled in for a non-wasm project.

Very weird, but should be fixed with RUSTFLAGS='--cfg=web_sys_unstable_apis'

@emilk emilk added this to the 0.24.1 milestone Nov 27, 2023
@ItsEthra
Copy link
Contributor

Can't reproduce on hyprland after applying fix for #3628, this might be a duplicate. Could you try disabling x11 feature and trying again?

emilk added a commit that referenced this issue Nov 27, 2023
Added by @konkitoman in #3172

I'm not sure what the hack is supposed to solve, but calling it
every frame is a bad idea, as @ItsEthra reported in
#3628 (comment)

* Closes #3620
* Closes #3628
@emilk
Copy link
Owner

emilk commented Nov 27, 2023

Potential fix: #3643

@Barugon
Copy link
Contributor Author

Barugon commented Nov 27, 2023

#3643 fixes the issue for me.

emilk added a commit that referenced this issue Nov 27, 2023
This was caused by a hack added by @konkitoman in
#3172

The solution was reported by @ItsEthra in
#3628 (comment)

* Closes #3620
* Closes #3628
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 native-linux Problem specific to Linux
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants