From 059e6f719d1f3d77cce38ee756ffa3e467dcffb1 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Mon, 12 Dec 2022 10:26:14 +0100 Subject: [PATCH] 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. --- crates/egui-winit/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/egui-winit/src/lib.rs b/crates/egui-winit/src/lib.rs index fe802e19..ccdfc919 100644 --- a/crates/egui-winit/src/lib.rs +++ b/crates/egui-winit/src/lib.rs @@ -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; }