mirror of
https://github.com/storytold/egui.git
synced 2026-11-28 01:09:11 +01:00
eframe now remembers the window's last *normal* (not maximized, not fullscreen) size and position. After a relaunch, un-maximizing or leaving fullscreen goes back to that size instead of a window that is "maximized but not maximized". Other fixes: * A maximized or fullscreen window no longer paints its first frame small. * Leaving a restored fullscreen goes straight back to the normal size, in one step. * The window reopens on the correct monitor, also with monitors of different scale factors on macOS. The position is saved in pixels together with the scale factor, and converted on restore. * On macOS and Windows, the window is placed exactly after creation, then maximized or made fullscreen. * On Windows, a window restored maximized no longer flashes on screen (shown, hidden, then shown again) during startup. winit maximizes with `ShowWindow(SW_MAXIMIZE)`, which shows the still-hidden window before hiding it again. The new `egui_winit::set_maximized` cloaks a hidden window (`DWMWA_CLOAK`) while maximizing it, so it stays invisible but is already maximized for the first frame. This is a workaround until winit has rust-windowing/winit#4575 or rust-windowing/winit#4587. * On X11, a window saved maximized or fullscreen now restores as such. winit sends these as `_NET_WM_STATE` client messages, which window managers ignore while the window is still hidden (eframe keeps it hidden until the first frame is painted). The new `WindowSettings::after_first_show` re-applies them right after the window is shown. `before_first_show` replaces the macOS-only `enter_fullscreen_after_first_frame` / `enter_deferred_fullscreen`. The save format changed, so old saved window settings are ignored once (the window opens at its default size). Known limitations: * The normal geometry is sampled on save. If you resize, maximize before the next autosave, and quit while maximized, un-maximizing after a relaunch goes back to the size from before the resize. * On X11, a restored maximized window may show un-maximized for a frame before it maximizes. * On X11 with GNOME (mutter), un-maximizing a window that was restored maximized puts it in the top-left corner of its monitor, not at its saved position. The size is right. mutter places windows that get maximized right after mapping at the work area origin. * On Wayland, the position (and so the monitor) can't be restored, because Wayland doesn't let clients read or set window positions. Size and maximized/fullscreen state are restored. * On GNOME, a restored window that is close to the screen size gets auto-maximized by mutter (`org.gnome.mutter auto-maximize`). Tested on macOS, wayland, x11 (XWayland on GNOME, including two monitors) and Windows (wgpu and glow). * [x] I have followed the instructions in the PR template 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_019yMtdim1FPCsviY1FWfdTk --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
126 lines
4.4 KiB
TOML
126 lines
4.4 KiB
TOML
[package]
|
|
name = "egui-winit"
|
|
version.workspace = true
|
|
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
|
|
description = "Bindings for using egui with winit"
|
|
edition.workspace = true
|
|
rust-version.workspace = true
|
|
homepage = "https://github.com/emilk/egui/tree/main/crates/egui-winit"
|
|
license.workspace = true
|
|
readme = "README.md"
|
|
repository = "https://github.com/emilk/egui/tree/main/crates/egui-winit"
|
|
categories = ["gui", "game-development"]
|
|
keywords = ["winit", "egui", "gui", "gamedev"]
|
|
include = ["../../LICENSE-APACHE", "../../LICENSE-MIT", "**/*.rs", "Cargo.toml"]
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[package.metadata.docs.rs]
|
|
all-features = true
|
|
rustdoc-args = ["--generate-link-to-definition"]
|
|
|
|
[package.metadata.cargo-shear]
|
|
ignored = ["wayland-cursor"] # TODO(emilk): remove when we update winit
|
|
|
|
[features]
|
|
default = ["clipboard", "links", "wayland", "winit/default", "x11"]
|
|
|
|
## Enable platform accessibility API implementations through [AccessKit](https://accesskit.dev/).
|
|
accesskit = ["dep:accesskit_winit"]
|
|
|
|
# Allow crates to choose an android-activity backend via Winit
|
|
# - It's important that most applications should not have to depend on android-activity directly, and can
|
|
# rely on Winit to pull in a suitable version (unlike most Rust crates, any version conflicts won't link)
|
|
# - It's also important that we don't impose an android-activity backend by taking this choice away from applications.
|
|
## Enable the `game-activity` backend via Winit on Android
|
|
android-game-activity = ["winit/android-game-activity"]
|
|
## Enable the `native-activity` backend via Winit on Android
|
|
android-native-activity = ["winit/android-native-activity"]
|
|
|
|
## [`bytemuck`](https://docs.rs/bytemuck) enables you to cast [`egui::epaint::Vertex`], [`egui::Vec2`] etc to `&[u8]`.
|
|
bytemuck = ["egui/bytemuck", "dep:bytemuck"]
|
|
|
|
## Enable cut/copy/paste to OS clipboard.
|
|
## If disabled a clipboard will be simulated so you can still copy/paste within the egui app.
|
|
clipboard = ["arboard", "bytemuck", "smithay-clipboard"]
|
|
|
|
## Enable opening links in a browser when an egui hyperlink is clicked.
|
|
links = ["webbrowser"]
|
|
|
|
## Allow serialization of [`WindowSettings`] using [`serde`](https://docs.rs/serde).
|
|
serde = ["egui/serde", "dep:serde"]
|
|
|
|
## Enables Wayland support.
|
|
wayland = ["winit/wayland", "bytemuck", "arboard?/wayland-data-control"]
|
|
|
|
## Enables compiling for x11.
|
|
x11 = ["winit/x11", "winit/rwh_06", "bytemuck"]
|
|
|
|
[dependencies]
|
|
egui = { workspace = true, default-features = false }
|
|
|
|
log.workspace = true
|
|
profiling.workspace = true
|
|
raw-window-handle.workspace = true
|
|
web-time.workspace = true
|
|
winit = { workspace = true, default-features = false }
|
|
|
|
#! ### Optional dependencies
|
|
|
|
# feature accesskit
|
|
accesskit_winit = { workspace = true, optional = true }
|
|
|
|
bytemuck = { workspace = true, optional = true }
|
|
|
|
## Enable this when generating docs.
|
|
document-features = { workspace = true, optional = true }
|
|
|
|
serde = { workspace = true, optional = true }
|
|
webbrowser = { workspace = true, optional = true }
|
|
|
|
# TODO(emilk): remove these once we are on a winit with https://github.com/rust-windowing/winit/pull/4732
|
|
[target.'cfg(target_os = "macos")'.dependencies]
|
|
block2.workspace = true
|
|
objc2.workspace = true
|
|
objc2-app-kit = { workspace = true, default-features = false, features = [
|
|
"std",
|
|
"block2",
|
|
"NSEvent",
|
|
"NSResponder",
|
|
] }
|
|
|
|
[target.'cfg(target_os = "ios")'.dependencies]
|
|
objc2.workspace = true
|
|
objc2-foundation = { workspace = true, features = ["std", "NSThread"] }
|
|
objc2-ui-kit = { workspace = true, features = [
|
|
"std",
|
|
"objc2-core-foundation",
|
|
"UIApplication",
|
|
"UIGeometry",
|
|
"UIResponder",
|
|
"UIScene",
|
|
"UISceneDefinitions",
|
|
"UIView",
|
|
"UIWindow",
|
|
"UIWindowScene",
|
|
] }
|
|
|
|
[target.'cfg(target_os = "windows")'.dependencies]
|
|
windows-sys = { workspace = true, features = [
|
|
"Win32_Foundation",
|
|
"Win32_Graphics_Dwm",
|
|
"Win32_UI_WindowsAndMessaging",
|
|
] }
|
|
|
|
[target.'cfg(any(target_os="linux", target_os="dragonfly", target_os="freebsd", target_os="netbsd", target_os="openbsd"))'.dependencies]
|
|
smithay-clipboard = { workspace = true, optional = true }
|
|
|
|
# The wayland-cursor normally selected doesn't properly enable all the features it uses
|
|
# and thus doesn't compile as it is used in egui-winit. This is fixed upstream, so force
|
|
# a slightly newer version. Remove this when winit upgrades past this version.
|
|
wayland-cursor = { workspace = true, optional = true }
|
|
|
|
[target.'cfg(not(target_os = "android"))'.dependencies]
|
|
arboard = { workspace = true, optional = true, features = ["image-data"] }
|