Window handling library in pure Rust
APACHE-2.0 License
Published by kchibisov about 1 year ago
ndk
version to 0.8.0-beta.0
, ndk-sys to v0.5.0-beta.0
, android-activity
to 0.5.0-beta.1
.1.64
to 1.65
.raw-window-handle
in window
module.WINIT_UNIX_BACKEND
was removed in favor of standard WAYLAND_DISPLAY
and DISPLAY
variables.EventLoop::new
and EventLoopBuilder::build
now return Result<Self, EventLoopError>
visual_id
in returned raw-window-handle
.raw-window-handle
trait implementations instead:
platform::windows::HINSTANCE
.WindowExtWindows::hinstance
.WindowExtWindows::hwnd
.WindowExtIOS::ui_window
.WindowExtIOS::ui_view_controller
.WindowExtIOS::ui_view
.WindowExtMacOS::ns_window
.WindowExtMacOS::ns_view
.EventLoopWindowTargetExtWayland::wayland_display
.WindowExtWayland::wayland_surface
.WindowExtWayland::wayland_display
.WindowExtX11::xlib_window
.WindowExtX11::xlib_display
.WindowExtX11::xlib_screen_id
.WindowExtX11::xcb_connection
.Window.requestAnimationFrame()
to throttle RedrawRequested
events.RedrawRequested
events so redraws will align with compositor.Window::pre_present_notify
to notify winit before presenting to the windowing system.WindowBuilderExtWindows::with_class_name
to customize the internal class name.Event
and WindowEvent
.ScaleFactorChanged
now contains a writer instead of a reference to update inner size.ControlFlow::Poll
to ControlFlow::Poll
.ActivationTokenDone
event which could be requested with the new startup_notify
module, see its docs for more.WindowExtMacOS
and EventLoopWindowTargetExtMacOS
.Window::set_inner_size
to Window::request_inner_size
and indicate if the size was applied immediately.PartialOrd
and Ord
for Key
, KeyCode
, NativeKey
, and NativeKeyCode
.ElementState::is_pressed
.WindowEvent::Occluded
.padding
, border
, and margin
when getting or setting the canvas position.Window::set_(min|max)_inner_size()
.Window
methods using incorrect HTML attributes instead of CSS properties.WindowBuilder
methods doing nothing.Window::focus_window()
.Window::is_dark_mode()
, which was replaced with Window::theme()
.WindowBuilderExtWebSys::with_append()
to append the canvas element to the web page on creation.drag_resize_window
method support.run() ->!
has been replaced by run() -> Result<(), EventLoopError>
for returning errors without calling std::process::exit()
(#2767)EventLoopExtRunReturn
/ run_return
in favor of EventLoopExtPumpEvents
/ pump_events
and EventLoopExtRunOnDemand
/ run_ondemand
(#2767)RedrawRequested
is no longer guaranteed to be emitted after MainEventsCleared
, it is now platform-specific when the event is emitted after being requested via redraw_request()
.
RedrawRequested
is now driven by WM_PAINT
messages which are requested via redraw_request()
LoopDestroyed
renamed to LoopExiting
(#2900)RedrawEventsCleared
removed (#2900)MainEventsCleared
removed (#2900)AboutToWait
event which is emitted when the event loop is about to block and wait for new events (#2900)with_x11_visual
now takes the visual ID instead of the bare pointer.with_embedded_parent_window
function to the window builder to allow embedding a window into another window.Published by kchibisov over 1 year ago
spawn
.Window::set_ime_position
to Window::set_ime_cursor_area
adding a way to set exclusive zone.EventLoopBuilderExtAndroid::handle_volume_keys
to indicate that the application will handle the volume keys manually.DeviceEventFilter
to DeviceEvents
reversing the behavior of variants.EventLoopWindowTarget::set_device_event_filter
to listen_device_events
.EventLoopWindowTarget::listen_device_events
effect being reversed.modifiers
fields.KeyboardInput
with KeyEvent
and RawKeyEvent
.
WindowEvent::KeyboardInput
to contain a KeyEvent
.Event::Key
to contain a RawKeyEvent
.Event::ReceivedCharacter
. In its place, you should useKeyEvent.text
in combination with WindowEvent::Ime
.VirtualKeyCode
with the Key
enum.ScanCode
with the KeyCode
enum.ModifiersState::LOGO
to SUPER
and ModifiersState::CTRL
to CONTROL
.KeyCode
to refer to keys (roughly) by their physical location.NativeKeyCode
to represent raw KeyCode
s which Winit doesn'tKey
to represent the keys after they've been interpreted by theNativeKey
to represent raw Key
s which Winit doesn't understand.KeyLocation
to tell apart Key
s which usually "mean" the same thing,Window::reset_dead_keys
to enable application-controlled cancellationKeyEventExtModifierSupplement
to expose additional (and lessKeyCodeExtScancode
, which lets you convert between raw keycodes andKeyCode
.ModifiersChanged
now uses dedicated Modifiers
struct.ModifiersChanged
not being sent.CursorIcon
is now used from the cursor-icon
crate.CursorIcon::Hand
is now named CursorIcon::Pointer
.CursorIcon::Arrow
was removed.Window::outer_size
now accounts for client side decorations.Window::drag_resize_window
method.WINIT_WAYLAND_CSD_THEME
variable.PartialOrd
and Ord
on types in the dpi
module.1.60
to 1.64
.Window::request_redraw
not waking the event loop when called from outside the loop.Window:::set_fullscreen
doing nothing when called outside the event loop but duringbitflags
crate version to 2
, which changes the API on exposed types.instant
is now replaced by web_time
.windows-sys
version 0.48.0.EventLoopProxy
now implements Send
.Window
now implements Send
and Sync
.WindowExtWebSys::canvas()
now returns an Option
.beforeunload
event and map bfcache loading/unloading to Suspended
/Resumed
events.Window
.Window.requestIdleCallback()
for ControlFlow::Poll
when available.WindowEvent::Resized
.EventLoopWindowTarget::listen_device_events()
settings.DeviceEvent::MouseMotion
only being emitted for each canvas instead of the whole window.DeviceEvent::Motion
, DeviceEvent::MouseWheel
, DeviceEvent::Button
andDeviceEvent::Key
support.MouseButton
now supports Back
and Forward
variants, emitted from mouse eventsPublished by kchibisov over 1 year ago
Backspace
being emitted when clearing preedit with it.Published by kchibisov over 1 year ago
key_up
being ignored when Ime
is disabled.Published by kchibisov over 1 year ago
Window::set_ime_position
from another thread.Published by kchibisov over 1 year ago
Published by kchibisov over 1 year ago
HasRawDisplayHandle
for EventLoop
.Window::theme
.Published by kchibisov over 1 year ago
Published by kchibisov over 1 year ago
Ime::Commit
persisting for all input after interacting with Ime
.WindowExtMacOS::option_as_alt
and WindowExtMacOS::set_option_as_alt
.WindowBuilder::with_active
.Window::is_minimized
.register_xlib_error_hook
invocation bleeding into winit.Window::has_focus
.Window::set_minimized(false)
not working for windows minimized by Win + D
hotkey.WindowEvent::Cursor*
, WindowEvent::MouseInput
, or DeviceEvent::MouseMotion
like other platforms, but instead it fires WindowEvent::Touch
.WindowBuilder::with_parent
API in favor of WindowBuilder::with_parent_window
.WS_MAXIMIZE
window style when un-minimizing a maximized window.Window::drag_window
.Window::set_theme
.WindowExtWayland::wayland_set_csd_theme
and WindowBuilderExtX11::with_gtk_theme_variant
.Window::set_always_on_top
and related APIs in favor of Window::set_window_level
.MouseButton::Other
.WindowExtMacOS::is_document_edited
and WindowExtMacOS::set_document_edited
APIs.WindowBuilderExtIOS::with_root_view_class
; instead, you should use [[view layer] addSublayer: ...]
to add an instance of the desired layer class (e.g. CAEAGLLayer
or CAMetalLayer
). See vulkano-win
or wgpu
for examples of this.Window::set_content_protected
.EventLoopBuilderExtMacOS::with_activate_ignoring_other_apps
.WindowBuilder
not taking effect for windows created after the first one.Window::title
to query the current window title.Alt
.accepts_first_mouse
configurable.WindowBuilderExtUnix::with_resize_increments
to WindowBuilder
.Window::resize_increments
/Window::set_resize_increments
to update resize increments at runtime for X11/macOS.objc2
instead of objc
internally.1.57
to 1.60
.platform::unix
module into platform::x11
and platform::wayland
. The extension types are similarly renamed.platform::unix::WindowExtUnix::is_ready
.parking_lot
dependency.WindowEvent::TouchpadMagnify
and WindowEvent::TouchpadRotate
. Also add support for touchpad smart-magnification gesture with a new event WindowEvent::SmartMagnify
.WindowBuilderExtWebSys::with_prevent_default
setting (enabled by default), now additionally prevents scrolling of the webpage in mobile browsers, previously it only disabled scrolling on desktop.wayland-csd-adwaita
now uses ab_glyph
instead of crossfont
to render the title for decorations.wayland-csd-adwaita-crossfont
feature was added to use crossfont
instead of ab_glyph
for decorations.WindowExtX11::with_parent
to create child windows.WindowBuilder::with_theme
and Window::theme
to support per-window dark/light/system theme configuration on macos, windows and wayland.WindowEvent::ThemeChanged
.WindowBuilderExtWindows::with_theme
and WindowBuilderExtWayland::with_wayland_csd_theme
in favour of WindowBuilder::with_theme
.WindowExtWindows::theme
in favour of Window::theme
.doc_auto_cfg
when generating docs on docs.rs for feature labels.android-activity
crate as a glue layer instead of ndk-glue
. See README.md#Android for more details. (#2444)raw-window-handle
version 0.4
RedrawRequested
not emitted during resize.set_wait_timeout
function to ControlFlow
to allow waiting for a Duration
.xlib_xconnection()
function from the private interface.drag_resize_window
method.Window::set_transparent
to provide a hint about transparency of the window on Wayland and macOS.Window::set_ime_purpose
for setting the IME purpose, currently implemented on Wayland only.Published by kchibisov almost 2 years ago
Ime::Preedit
pointing to invalid bytes.Published by kchibisov about 2 years ago
ReceivedCharacter
events on system keybindings.Published by kchibisov about 2 years ago
WindowExtWindows::set_undecorated_shadow
and WindowBuilderExtWindows::with_undecorated_shadow
to draw the drop shadow behind a borderless window.Ime::Preedit
not being sent on IME reset.raw-window-handle
leading to compilation failures.Ime::Preedit
event will be sent before Ime::Commit
to help clearing preedit.Published by kchibisov about 2 years ago
Window
now (additionally) implements the old version (0.4
) of the HasRawWindowHandle
traitEventLoopWindowTarget::set_device_event_filter
.WindowEvent::RedrawRequested
being delayed by a frame.Published by kchibisov about 2 years ago
1.57.0
and now explicitly tested.Published by kchibisov about 2 years ago
ndk-glue
's NativeWindow
lock is now held between Event::Resumed
and Event::Suspended
.EventLoopExtWebSys
with a spawn
method to start the event loop without throwing an exception.WindowEvent::Occluded(bool)
, currently implemented on macOS and X11.docs.rs
for iOS and Android as well.WindowAttributes
struct, since all its functionality is accessible from WindowBuilder
.WindowBuilder::transparent
getter to check if the user set transparent
attribute.Event::LoopDestroyed
on CMD+Q.set_cursor_hittest
to let the window ignore mouse events.WindowExtWindows::set_skip_taskbar
and WindowBuilderExtWindows::with_skip_taskbar
.EventLoopBuilderExtWindows::with_msg_hook
.set_ime_position
after moving the window.Window::is_visible
.Window::is_resizable
.Window::is_decorated
.ControlFlow
was Wait
DeviceEvent::MouseMotion
.ndk
version to 0.6, ndk-sys to v0.3
, ndk-glue
to 0.6
.WINIT_LINK_COLORSYNC
environment variable.Exit
variant of ControlFlow
to ExitWithCode
, which holds a value to control the exit code after running. Add an Exit
constant which aliases to ExitWithCode(0)
instead to avoid major breakage. This shouldn't affect most existing programs.EventLoopBuilder
, which allows you to create and tweak the settings of an event loop before creating it.EventLoop::with_user_event
; use EventLoopBuilder::with_user_event
instead.EventLoopExtMacOS
with EventLoopBuilderExtMacOS
(which also has renamed methods).EventLoopExtWindows
with EventLoopBuilderExtWindows
(which also has renamed methods).EventLoopExtUnix
with EventLoopBuilderExtUnix
(which also has renamed methods).winit::platform::windows
have changed. All HANDLE
-like types e.g. HWND
and HMENU
were converted from winapi types or *mut c_void
to isize
. This was done to be consistent with the type definitions in windows-sys and to not expose internal dependencies.EventLoop::run_return
invocations.WindowBuilder::with_fullscreen
virtual_keycode
for KeyboardInput
events is now filled in where a suitable match is found.ControlFlow
to set its value.TouchPhase::Ended
always reporting the location of the first touch down, unless the compositorRedrawEventsCleared
even if there are no redraw events, consistent with other platforms.Window::with_app_id
and Window::with_class
with Window::with_name
on WindowBuilderExtUnix
.WindowBuilderExtUnix::with_wayland_csd_theme
to set color theme in builder.WindowExtUnix::wayland_set_csd_theme
to set color theme when creating a window.WINIT_WAYLAND_CSD_THEME
env variable was added, it can be used to set "dark"/"light" theme in apps that don't expose theme setting.wayland-csd-adwaita
feature that enables proper CSD with title rendering using FreeType system library.wayland-csd-adwaita-notitle
feature that enables CSD but without title rendering.Window::set_inner_size
after calling Window:set_resizable(false)
.WindowEvent::Ime
supported on desktop platforms.Window::set_ime_allowed
supported on desktop platforms.Window::set_ime_allowed
and new WindowEvent::Ime
events are handled.WindowEvent::Resized
is now emitted in frameDidChange
instead of windowDidResize
.EventLoopWindowTarget::set_device_event_filter
to set the filter level.Default
on EventLoop<()>
.Eq
for Fullscreen
, Theme
, and UserAttentionType
.Window::set_cursor_grab
now accepts CursorGrabMode
to control grabbing behavior.Window::set_cursor_position
.WindowBuilder::with_disallow_hidpi
, setting true or false by the user no matter the SO default value.EventLoopBuilder::build
will now panic when the EventLoop
is being created more than once.From<u64>
for WindowId
and From<WindowId>
for u64
.MonitorHandle::refresh_rate_millihertz
to get monitor's refresh rate.VideoMode::refresh_rate
with VideoMode::refresh_rate_millihertz
providing better precision.with_prevent_default
and with_focusable
to WindowBuilderExtWebSys
to control whether events should be propagated.raw-window-handle
to v0.5
and implement HasRawDisplayHandle
for Window
and EventLoopWindowTarget
.register_xlib_error_hook
into winit::platform::unix
to subscribe for errors comming from Xlib.ndk
and ndk-glue
dependencies to the recently released 0.7.0
.Resumed
event. Applications are recommended to lazily initialize graphics state and windows on first resume for portability.MouseScrollDelta
to match the direction of vertical scrolling. A positive X value now means moving the content to the right. The meaning of vertical scrolling stays the same: a positive Y value means moving the content down.ColorSync
framework on macOS 10.7, and in newer Rust versions.Published by kchibisov almost 3 years ago
raw-window-handle
to v0.4
. This is not a breaking change, we still implement HasRawWindowHandle
from v0.3
, see rust-windowing/raw-window-handle#74. Note that you might have to run cargo update -p raw-window-handle
after upgrading.mio
to 0.8.WindowExtAndroid::config
initially returning an empty Configuration
.Window::scale_factor
and MonitorHandle::scale_factor
initially always returning 1.0.Window::request_redraw
stdweb
backend.Window::focus_window
to bring the window to the front and set input focus.is_maximized
method on Window
.explorer.exe
.ReceivedCharacter
was not being emitted during some key repeat events.hand2
and hand1
for CursorIcon::Hand
.smithay-client-toolkit
to 0.15.1.request_user_attention
with xdg_activation_v1
.WindowEvent::ScaleFactorChanged
when the only monitor gets reconnected.wayland-dlopen
so users can opt out of using dlopen
to load system libraries.ndk
and ndk-glue
to 0.5.WaitUntil
.xdg_decoration
in kwin_wayland
Published by ArturKovacs over 3 years ago
WindowBuilderExtMacOS::with_activation_policy
with EventLoopExtMacOS::set_activation_policy
InputEvent::KeyEvent
is partially implemented providing the key scancode.is_maximized
method to Window
.WindowBuilderExtWindows::with_menu
to set a custom menu at window creation time.ndk
and ndk-glue
to 0.3: use predefined constants for event ident
.WindowEvent::ThemeChanged
not properly firing and fixed Window::theme
returning the wrong theme.DeviceEvent::MouseMotion
to listen for relative mouse movements.WindowBuilder::with_position
to allow setting the position of a Window
on creation. Supported on Windows, macOS and X11.Window::drag_window
. Implemented on Windows, macOS, X11 and Wayland.mio
to 0.7.WindowBuilderExtWindows::with_owner_window
to allow creating popup windows.WindowExtWindows::set_enable
to allow creating modal popup windows.RedrawRequested
events immediately while the window is being resized.Default
, Hash
, and Eq
for LogicalPosition
, PhysicalPosition
, LogicalSize
, and PhysicalSize
.enable_default_menu_creation
)MouseInput
event on a "first mouse click".mint
).Published by kchibisov almost 4 years ago
Window::set_ime_position
.WindowBuilderExtWindows
's is_dark_mode
to theme
.WindowBuilderExtWindows::with_theme
to set a preferred theme.WindowEvent::Focused
now works properly instead of always returning false.with_min_inner_size
in WindowBuilder
.WindowEvent::ReceivedCharacter
never being sent on key input.Window::request_redraw
not waking the event loop.desktop::EventLoopExtDesktop
to run_return::EventLoopExtRunReturn
.request_user_attention
method to Window
.WindowExt::request_user_attention
, use Window::request_user_attention
.WindowExt::set_urgent
, use Window::request_user_attention
.MouseButton::Other
now uses u16
.Published by kchibisov about 4 years ago
available_monitors
and primary_monitor
are now on EventLoopWindowTarget
rather than EventLoop
to list monitors event in the event loop.set_fullscreen_inner
.window.set_cursor_icon
no longer breaks HiDPI scalingWindowBuilderExtWindows::with_drag_and_drop(true)
.set_inner_size
from a callback.hide__other_applications
to EventLoopWindowTarget
via existing EventLoopWindowTargetExtMacOS
trait. hide_other_applications
will hide other applications by calling -[NSApplication hideOtherApplications: nil]
.run_return
.run_return
.MainEventsCleared
events during nested win32 event loops.set_ime_position
is now a no-op instead of a runtime crash.set_fullscreen
is now a no-op instead of a runtime crash.set_inner_size
is now a no-op instead of a runtime crash.ControlFlow::Poll
not polling the Android event queue.NSWindow.hasShadow
support.ControlFlow::Exit
not properly handled.WindowEvent::ScaleFactorChanged
event when window.devicePixelRatio
is changed.set_cursor_position
and set_cursor_grab
will now always return an error.PixelDelta
scroll events now return a PhysicalPosition
.-
key is mapped to the Minus
virtual key code, instead of Subtract
.current_monitor
now returns Option<MonitorHandle>
.primary_monitor
now returns Option<MonitorHandle>
.parking_lot
to 0.11ndk
, ndk-sys
and ndk-glue
to 0.2. Checkout the new ndk-glue main proc attribute.Add
, Multiply
, Divide
, Decimal
, and Subtract
with Numpad
.Asterisk
and Plus
virtual key codes.Event::LoopDestroyed
event is correctly emitted when leaving the page.WindowEvent::Destroyed
event now gets emitted when a Window
is dropped.Window
is dropped or when the event loop is destroyed.EventLoop::run
now gets dropped after the event loop is destroyed.Window
is no longer removed from the DOM when the Window
is dropped.WindowEvent::Resized
is now emitted when Window::set_inner_size
is called.Fullscreen
enum now uses Borderless(Option<MonitorHandle>)
instead of Borderless(MonitorHandle)
to allow picking the current monitor.WindowEvent::Moved
ignoring the scale factor.set_cursor_grab
.resizable
attribute not being applied properly on startup.XCURSOR_SIZE
is 0
.Theme
trait was reworked.set_ime_position
.