Skip to main content

Crate dear_imgui_winit

Crate dear_imgui_winit 

Source
Expand description

Winit platform backend for Dear ImGui

This crate provides a platform backend for Dear ImGui that integrates with the winit windowing library. It handles window events, input processing, and platform-specific functionality including multi-viewport support.

§Features

  • Basic Platform Support: Window events, input handling, cursor management
  • Multi-Viewport Support: Create and manage multiple OS windows (requires multi-viewport feature)
  • DPI Awareness: Proper handling of high-DPI displays

§Example - Basic Usage

use dear_imgui_rs::Context;
use dear_imgui_winit::WinitPlatform;
use winit::event_loop::EventLoop;

let event_loop = EventLoop::new().unwrap();
let mut imgui_ctx = Context::create();
let mut platform = WinitPlatform::new(&mut imgui_ctx).expect("create Winit platform");

// Use in your event loop...

§Multi-Viewport Support

WinitPlatform owns native windows and event routing, while the selected renderer route owns the complete viewport-frame transaction. Use that route’s prepare(...) entry instead of calling Dear ImGui’s platform-window phases directly. See the repository’s multi_viewport_wgpu and multi_viewport_ash examples for complete integrations.

Structs§

WinitCaptureIntent
Dear ImGui’s capture intent at event-dispatch time, from the most recent UI frame.
WinitEventForwarding
Input streams actually updated while handling one native event.
WinitEventOutcome
Facts observed while routing one event, without conflating ownership and capture intent.
WinitEventTarget
Exact native registration selected by WindowId-first event routing.
WinitPlatform
Main platform backend for Dear ImGui with winit integration
WinitPointerCaptureReport
Complete native grab attempts, including failures preceding a successful fallback.
WinitPointerGrabFailure
WinitPointerReleaseReport
Pointer ownership ended. An error means native ungrab could not be confirmed.
WinitPointerRequest
WinitWindowCapabilities
Backend support for editor window policies on the observed native window system.
WinitWindowNativeState
Native observations. None means Winit cannot establish that fact on this platform.
WinitWindowSnapshot
Detached native facts about one currently owned Winit window registration.

Enums§

HiDpiMode
DPI scaling mode for the platform
WinitPlatformAction
Native platform action distinguished from Dear ImGui input forwarding.
WinitPlatformError
Failure to attach or operate the Winit platform backend.
WinitPointerGrabMode
WinitPointerGrabPreference
Native grab order. A fallback is attempted only when the preferred mode fails.
WinitPointerReleaseReason
WinitWindowLifecycleEvent
Exactly-once registration observations owned by a platform owner.
WinitWindowPolicySupport
Native policy availability, independent of whether a window manager honors every request.