egui-winit: don't call set_cursor each frame on any platform
On some platforms (WSL?) the setting of the cursor can also fail, leading to warnings being logged by winit each frame. Not good.
This commit is contained in:
parent
930ef2db38
commit
059e6f719d
1 changed files with 2 additions and 2 deletions
|
@ -654,8 +654,8 @@ impl State {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_cursor_icon(&mut self, window: &winit::window::Window, cursor_icon: egui::CursorIcon) {
|
fn set_cursor_icon(&mut self, window: &winit::window::Window, cursor_icon: egui::CursorIcon) {
|
||||||
// prevent flickering near frame boundary when Windows OS tries to control cursor icon for window resizing
|
// Prevent flickering near frame boundary when Windows OS tries to control cursor icon for window resizing.
|
||||||
#[cfg(windows)]
|
// On other platforms: just early-out to save CPU.
|
||||||
if self.current_cursor_icon == cursor_icon {
|
if self.current_cursor_icon == cursor_icon {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue