-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
bugSomething is brokenSomething is broken
Description
Describe the bug
When not visible (by sending the egui::ViewportCommand::Visible(false) command) a simple egui application will use ~16% CPU on my CPU while using 0% otherwise
To Reproduce
Steps to reproduce the behavior:
- Take the following egui application:
use eframe::egui;
fn main() -> Result<(), eframe::Error> {
let options = eframe::NativeOptions {
viewport: egui::ViewportBuilder::default().with_inner_size([320.0, 240.0]),
..Default::default()
};
eframe::run_simple_native("My egui App", options, move |ctx, _frame| {
egui::CentralPanel::default().show(ctx, |ui| {
ui.heading("My egui Application");
if ui.button("Make invisible").clicked() {
ctx.send_viewport_cmd(egui::ViewportCommand::Visible(false));
}
});
})
}- Run it
- Observe CPU usage while open, if the mouse cursor is not in the window or the window is minimized it will drop to 0
- Press the button to make the window invisible
- CPU usage will go up a lot
Expected behavior
CPU usage should stay low, similar to when it's minimized
Screenshots
Desktop
- OS: Windows 11 26H1 (28000.1340)
- Version: eframe 0.33.3, also tested on latest master (bfaf1b4)
Additional context
- Issue persists even if the window is made invisible with WindowsAndMessaging::ShowWindow
- CPU usage resumes to be lower when the window is visible again
- Most of the issue's wording is taken directly from Windows: High CPU Usage when minimized #3982 since the issue is very similar (but not quite the same issue)
- Issue seems to be present with both the wgpu and glow backends
Metadata
Metadata
Assignees
Labels
bugSomething is brokenSomething is broken

