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:
Emil Ernerfeldt 2022-12-12 10:26:14 +01:00
parent 930ef2db38
commit 059e6f719d

View file

@ -654,8 +654,8 @@ impl State {
}
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
#[cfg(windows)]
// Prevent flickering near frame boundary when Windows OS tries to control cursor icon for window resizing.
// On other platforms: just early-out to save CPU.
if self.current_cursor_icon == cursor_icon {
return;
}