egui/crates/egui-winit
Skyler Lehmkuhl f5477e30e5 Add custom cursor images (OS-composited, no frame lag)
A cursor painted into the egui scene is composited with the frame, so it
always trails the pointer by a frame or more. This adds a path to hand a
cursor image to the windowing system instead, where the compositor draws
it with no lag.

- egui: PlatformOutput::cursor_image + Context::set_cursor_image().
  CursorImage carries an id alongside the pixels so backends can detect
  "same cursor as last frame" without hashing or comparing the buffer.
- egui-winit: handle_platform_output() stashes the image;
  State::apply_pending_cursor_image() builds the winit CustomCursor and
  applies it. The split is necessary because winit only creates custom
  cursors from an ActiveEventLoop, which handle_platform_output has no
  access to. Rebuilds only when the id changes, and suppresses
  set_cursor_icon while a custom cursor is active so the two don't fight.
- eframe (wgpu): run_ui_and_paint already had the ActiveEventLoop and
  simply wasn't passing it down; now it does, and applies the cursor.
- eframe (web): ignore the new field for now; the web backend could
  express it as a CSS `cursor: url(...)`.

Supported by winit on X11, Wayland, Windows, macOS and Web. The glow
backend compiles unchanged but does not apply cursor images yet.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-14 13:02:51 -04:00
..
src Add custom cursor images (OS-composited, no frame lag) 2026-07-14 13:02:51 -04:00
CHANGELOG.md Update changelogs and version for 0.33.2 2025-11-13 13:53:59 +01:00
Cargo.toml Add `taplo.toml` for toml formatting (#7618) 2025-10-09 15:38:00 +02:00
README.md Remove misleading safety-badges 2023-02-28 22:35:08 +01:00

README.md

egui-winit

Latest version Documentation MIT Apache

This crates provides bindings between egui and winit.

The library translates winit events to egui, handled copy/paste, updates the cursor, open links clicked in egui, etc.