From 255f56ad48c43f1d3c961df7d6aef721a74f4aab Mon Sep 17 00:00:00 2001 From: Seth Rider Date: Fri, 15 Mar 2024 15:44:55 +0000 Subject: [PATCH 1/9] add x11 window type settings to viewport builder --- crates/egui-winit/src/lib.rs | 16 ++++++++++++++++ crates/egui/src/viewport.rs | 27 +++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/crates/egui-winit/src/lib.rs b/crates/egui-winit/src/lib.rs index ac29a0b24047..345f8ab6bec5 100644 --- a/crates/egui-winit/src/lib.rs +++ b/crates/egui-winit/src/lib.rs @@ -1543,6 +1543,9 @@ pub fn create_winit_window_builder( // wayland: app_id: _app_id, + // x11 + window_type, + mouse_passthrough: _, // handled in `apply_viewport_builder_to_window` } = viewport_builder; @@ -1615,6 +1618,19 @@ pub fn create_winit_window_builder( window_builder = window_builder.with_name(app_id, ""); } + #[cfg(all(feature = "x11", target_os = "linux"))] + { + if let Some(window_type) = window_type { + use winit::platform::x11::WindowBuilderExtX11 as _; + use winit::platform::x11::XWindowType; + window_builder = window_builder.with_x11_window_type(vec![match window_type { + egui::WindowType::Normal => XWindowType::Normal, + egui::WindowType::Utility => XWindowType::Utility, + egui::WindowType::Dock => XWindowType::Dock, + }]); + } + } + #[cfg(target_os = "windows")] { use winit::platform::windows::WindowBuilderExtWindows as _; diff --git a/crates/egui/src/viewport.rs b/crates/egui/src/viewport.rs index 4e88eab4b395..97a74a94e52b 100644 --- a/crates/egui/src/viewport.rs +++ b/crates/egui/src/viewport.rs @@ -301,6 +301,9 @@ pub struct ViewportBuilder { pub window_level: Option, pub mouse_passthrough: Option, + + // X11 + pub window_type: Option, } impl ViewportBuilder { @@ -583,6 +586,15 @@ impl ViewportBuilder { self } + /// ### On X11 + /// On X11 this sets the window type + /// [`_NET_WM_WINDOW_TYPE`](https://specifications.freedesktop.org/wm-spec/wm-spec-1.5.html). + #[inline] + pub fn with_window_type(mut self, value: WindowType) -> Self { + self.window_type = Some(value); + self + } + /// Update this `ViewportBuilder` with a delta, /// returning a list of commands and a bool indicating if the window needs to be recreated. #[must_use] @@ -613,6 +625,7 @@ impl ViewportBuilder { window_level: new_window_level, mouse_passthrough: new_mouse_passthrough, taskbar: new_taskbar, + window_type: new_window_type, } = new_vp_builder; let mut commands = Vec::new(); @@ -786,6 +799,11 @@ impl ViewportBuilder { recreate_window = true; } + if new_window_type.is_some() && self.window_type != new_window_type { + self.window_type = new_window_type; + recreate_window = true; + } + (commands, recreate_window) } } @@ -799,6 +817,15 @@ pub enum WindowLevel { AlwaysOnTop, } +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] +pub enum WindowType { + #[default] + Normal, + Dock, + Utility, +} + #[derive(Clone, Copy, Default, Debug, PartialEq, Eq)] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub enum IMEPurpose { From 1fb1ec143a219316acc2b8a7f385687284f765c5 Mon Sep 17 00:00:00 2001 From: Seth Rider Date: Fri, 15 Mar 2024 16:25:00 +0000 Subject: [PATCH 2/9] actually lets map the whole enum --- crates/egui-winit/src/lib.rs | 11 ++++++++++ crates/egui/src/viewport.rs | 41 ++++++++++++++++++++++++++++++++---- 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/crates/egui-winit/src/lib.rs b/crates/egui-winit/src/lib.rs index 345f8ab6bec5..b6cee960ce0c 100644 --- a/crates/egui-winit/src/lib.rs +++ b/crates/egui-winit/src/lib.rs @@ -1627,6 +1627,17 @@ pub fn create_winit_window_builder( egui::WindowType::Normal => XWindowType::Normal, egui::WindowType::Utility => XWindowType::Utility, egui::WindowType::Dock => XWindowType::Dock, + egui::WindowType::Desktop => XWindowType::Desktop, + egui::WindowType::Toolbar => XWindowType::Toolbar, + egui::WindowType::Menu => XWindowType::Menu, + egui::WindowType::Splash => XWindowType::Splash, + egui::WindowType::Dialog => XWindowType::Dialog, + egui::WindowType::DropdownMenu => XWindowType::DropdownMenu, + egui::WindowType::PopupMenu => XWindowType::PopupMenu, + egui::WindowType::Tooltip => XWindowType::Tooltip, + egui::WindowType::Notification => XWindowType::Notification, + egui::WindowType::Combo => XWindowType::Combo, + egui::WindowType::Dnd => XWindowType::Dnd, }]); } } diff --git a/crates/egui/src/viewport.rs b/crates/egui/src/viewport.rs index 97a74a94e52b..3dc4a4a211bb 100644 --- a/crates/egui/src/viewport.rs +++ b/crates/egui/src/viewport.rs @@ -587,8 +587,8 @@ impl ViewportBuilder { } /// ### On X11 - /// On X11 this sets the window type - /// [`_NET_WM_WINDOW_TYPE`](https://specifications.freedesktop.org/wm-spec/wm-spec-1.5.html). + /// This sets the window type. + /// Maps directly to [`_NET_WM_WINDOW_TYPE`](https://specifications.freedesktop.org/wm-spec/wm-spec-1.5.html). #[inline] pub fn with_window_type(mut self, value: WindowType) -> Self { self.window_type = Some(value); @@ -820,10 +820,43 @@ pub enum WindowLevel { #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub enum WindowType { - #[default] - Normal, + /// A desktop feature. This can include a single window containing desktop icons with the same dimensions as the + /// screen, allowing the desktop environment to have full control of the desktop, without the need for proxying + /// root window clicks. + Desktop, + /// A dock or panel feature. Typically a Window Manager would keep such windows on top of all other windows. Dock, + /// Toolbar windows. "Torn off" from the main application. + Toolbar, + /// Pinnable menu windows. "Torn off" from the main application. + Menu, + /// A small persistent utility window, such as a palette or toolbox. Utility, + /// The window is a splash screen displayed as an application is starting up. + Splash, + /// This is a dialog window. + Dialog, + /// A dropdown menu that usually appears when the user clicks on an item in a menu bar. + /// This property is typically used on override-redirect windows. + DropdownMenu, + /// A popup menu that usually appears when the user right clicks on an object. + /// This property is typically used on override-redirect windows. + PopupMenu, + /// A tooltip window. Usually used to show additional information when hovering over an object with the cursor. + /// This property is typically used on override-redirect windows. + Tooltip, + /// The window is a notification. + /// This property is typically used on override-redirect windows. + Notification, + /// This should be used on the windows that are popped up by combo boxes. + /// This property is typically used on override-redirect windows. + Combo, + /// This indicates the the window is being dragged. + /// This property is typically used on override-redirect windows. + Dnd, + /// This is a normal, top-level window. + #[default] + Normal, } #[derive(Clone, Copy, Default, Debug, PartialEq, Eq)] From 9d23a2690c60e1ad1c38cd0c911d579eb56f6c5e Mon Sep 17 00:00:00 2001 From: Seth Rider Date: Sun, 17 Mar 2024 22:13:31 +0000 Subject: [PATCH 3/9] re export winit::platform::x11::XWindowType --- Cargo.lock | 1 + crates/egui-winit/src/lib.rs | 18 +------------- crates/egui/Cargo.toml | 2 ++ crates/egui/src/lib.rs | 2 ++ crates/egui/src/viewport.rs | 48 +++--------------------------------- 5 files changed, 10 insertions(+), 61 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 92948c4589fc..662afcfd371b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1239,6 +1239,7 @@ dependencies = [ "puffin", "ron", "serde", + "winit", ] [[package]] diff --git a/crates/egui-winit/src/lib.rs b/crates/egui-winit/src/lib.rs index b6cee960ce0c..99176691f983 100644 --- a/crates/egui-winit/src/lib.rs +++ b/crates/egui-winit/src/lib.rs @@ -1622,23 +1622,7 @@ pub fn create_winit_window_builder( { if let Some(window_type) = window_type { use winit::platform::x11::WindowBuilderExtX11 as _; - use winit::platform::x11::XWindowType; - window_builder = window_builder.with_x11_window_type(vec![match window_type { - egui::WindowType::Normal => XWindowType::Normal, - egui::WindowType::Utility => XWindowType::Utility, - egui::WindowType::Dock => XWindowType::Dock, - egui::WindowType::Desktop => XWindowType::Desktop, - egui::WindowType::Toolbar => XWindowType::Toolbar, - egui::WindowType::Menu => XWindowType::Menu, - egui::WindowType::Splash => XWindowType::Splash, - egui::WindowType::Dialog => XWindowType::Dialog, - egui::WindowType::DropdownMenu => XWindowType::DropdownMenu, - egui::WindowType::PopupMenu => XWindowType::PopupMenu, - egui::WindowType::Tooltip => XWindowType::Tooltip, - egui::WindowType::Notification => XWindowType::Notification, - egui::WindowType::Combo => XWindowType::Combo, - egui::WindowType::Dnd => XWindowType::Dnd, - }]); + window_builder = window_builder.with_x11_window_type(vec![window_type]); } } diff --git a/crates/egui/Cargo.toml b/crates/egui/Cargo.toml index 347dbeda7cba..1c9824d83198 100644 --- a/crates/egui/Cargo.toml +++ b/crates/egui/Cargo.toml @@ -98,3 +98,5 @@ log = { workspace = true, optional = true } puffin = { workspace = true, optional = true } ron = { version = "0.8", optional = true } serde = { version = "1", optional = true, features = ["derive", "rc"] } +winit = { workspace = true } + diff --git a/crates/egui/src/lib.rs b/crates/egui/src/lib.rs index 693280453879..10a9a9980dca 100644 --- a/crates/egui/src/lib.rs +++ b/crates/egui/src/lib.rs @@ -434,6 +434,8 @@ pub use epaint::{ Rounding, Shape, Stroke, TextureHandle, TextureId, }; +pub use winit::platform::x11::XWindowType; + pub mod text { pub use crate::text_selection::{CCursorRange, CursorRange}; pub use epaint::text::{ diff --git a/crates/egui/src/viewport.rs b/crates/egui/src/viewport.rs index 3dc4a4a211bb..0d14f53940ca 100644 --- a/crates/egui/src/viewport.rs +++ b/crates/egui/src/viewport.rs @@ -73,6 +73,8 @@ use epaint::{Pos2, Vec2}; use crate::{Context, Id}; +use crate::XWindowType; + // ---------------------------------------------------------------------------- /// The different types of viewports supported by egui. @@ -303,7 +305,7 @@ pub struct ViewportBuilder { pub mouse_passthrough: Option, // X11 - pub window_type: Option, + pub window_type: Option, } impl ViewportBuilder { @@ -590,7 +592,7 @@ impl ViewportBuilder { /// This sets the window type. /// Maps directly to [`_NET_WM_WINDOW_TYPE`](https://specifications.freedesktop.org/wm-spec/wm-spec-1.5.html). #[inline] - pub fn with_window_type(mut self, value: WindowType) -> Self { + pub fn with_window_type(mut self, value: XWindowType) -> Self { self.window_type = Some(value); self } @@ -817,48 +819,6 @@ pub enum WindowLevel { AlwaysOnTop, } -#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] -#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] -pub enum WindowType { - /// A desktop feature. This can include a single window containing desktop icons with the same dimensions as the - /// screen, allowing the desktop environment to have full control of the desktop, without the need for proxying - /// root window clicks. - Desktop, - /// A dock or panel feature. Typically a Window Manager would keep such windows on top of all other windows. - Dock, - /// Toolbar windows. "Torn off" from the main application. - Toolbar, - /// Pinnable menu windows. "Torn off" from the main application. - Menu, - /// A small persistent utility window, such as a palette or toolbox. - Utility, - /// The window is a splash screen displayed as an application is starting up. - Splash, - /// This is a dialog window. - Dialog, - /// A dropdown menu that usually appears when the user clicks on an item in a menu bar. - /// This property is typically used on override-redirect windows. - DropdownMenu, - /// A popup menu that usually appears when the user right clicks on an object. - /// This property is typically used on override-redirect windows. - PopupMenu, - /// A tooltip window. Usually used to show additional information when hovering over an object with the cursor. - /// This property is typically used on override-redirect windows. - Tooltip, - /// The window is a notification. - /// This property is typically used on override-redirect windows. - Notification, - /// This should be used on the windows that are popped up by combo boxes. - /// This property is typically used on override-redirect windows. - Combo, - /// This indicates the the window is being dragged. - /// This property is typically used on override-redirect windows. - Dnd, - /// This is a normal, top-level window. - #[default] - Normal, -} - #[derive(Clone, Copy, Default, Debug, PartialEq, Eq)] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub enum IMEPurpose { From 813e25f3f78d3db2761b6f2afc15862df9b1dd33 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Mon, 18 Mar 2024 09:46:04 +0100 Subject: [PATCH 4/9] Revert "re export winit::platform::x11::XWindowType" This reverts commit 9d23a2690c60e1ad1c38cd0c911d579eb56f6c5e. --- Cargo.lock | 1 - crates/egui-winit/src/lib.rs | 18 +++++++++++++- crates/egui/Cargo.toml | 2 -- crates/egui/src/lib.rs | 2 -- crates/egui/src/viewport.rs | 48 +++++++++++++++++++++++++++++++++--- 5 files changed, 61 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 662afcfd371b..92948c4589fc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1239,7 +1239,6 @@ dependencies = [ "puffin", "ron", "serde", - "winit", ] [[package]] diff --git a/crates/egui-winit/src/lib.rs b/crates/egui-winit/src/lib.rs index 99176691f983..b6cee960ce0c 100644 --- a/crates/egui-winit/src/lib.rs +++ b/crates/egui-winit/src/lib.rs @@ -1622,7 +1622,23 @@ pub fn create_winit_window_builder( { if let Some(window_type) = window_type { use winit::platform::x11::WindowBuilderExtX11 as _; - window_builder = window_builder.with_x11_window_type(vec![window_type]); + use winit::platform::x11::XWindowType; + window_builder = window_builder.with_x11_window_type(vec![match window_type { + egui::WindowType::Normal => XWindowType::Normal, + egui::WindowType::Utility => XWindowType::Utility, + egui::WindowType::Dock => XWindowType::Dock, + egui::WindowType::Desktop => XWindowType::Desktop, + egui::WindowType::Toolbar => XWindowType::Toolbar, + egui::WindowType::Menu => XWindowType::Menu, + egui::WindowType::Splash => XWindowType::Splash, + egui::WindowType::Dialog => XWindowType::Dialog, + egui::WindowType::DropdownMenu => XWindowType::DropdownMenu, + egui::WindowType::PopupMenu => XWindowType::PopupMenu, + egui::WindowType::Tooltip => XWindowType::Tooltip, + egui::WindowType::Notification => XWindowType::Notification, + egui::WindowType::Combo => XWindowType::Combo, + egui::WindowType::Dnd => XWindowType::Dnd, + }]); } } diff --git a/crates/egui/Cargo.toml b/crates/egui/Cargo.toml index 1c9824d83198..347dbeda7cba 100644 --- a/crates/egui/Cargo.toml +++ b/crates/egui/Cargo.toml @@ -98,5 +98,3 @@ log = { workspace = true, optional = true } puffin = { workspace = true, optional = true } ron = { version = "0.8", optional = true } serde = { version = "1", optional = true, features = ["derive", "rc"] } -winit = { workspace = true } - diff --git a/crates/egui/src/lib.rs b/crates/egui/src/lib.rs index 10a9a9980dca..693280453879 100644 --- a/crates/egui/src/lib.rs +++ b/crates/egui/src/lib.rs @@ -434,8 +434,6 @@ pub use epaint::{ Rounding, Shape, Stroke, TextureHandle, TextureId, }; -pub use winit::platform::x11::XWindowType; - pub mod text { pub use crate::text_selection::{CCursorRange, CursorRange}; pub use epaint::text::{ diff --git a/crates/egui/src/viewport.rs b/crates/egui/src/viewport.rs index 0d14f53940ca..3dc4a4a211bb 100644 --- a/crates/egui/src/viewport.rs +++ b/crates/egui/src/viewport.rs @@ -73,8 +73,6 @@ use epaint::{Pos2, Vec2}; use crate::{Context, Id}; -use crate::XWindowType; - // ---------------------------------------------------------------------------- /// The different types of viewports supported by egui. @@ -305,7 +303,7 @@ pub struct ViewportBuilder { pub mouse_passthrough: Option, // X11 - pub window_type: Option, + pub window_type: Option, } impl ViewportBuilder { @@ -592,7 +590,7 @@ impl ViewportBuilder { /// This sets the window type. /// Maps directly to [`_NET_WM_WINDOW_TYPE`](https://specifications.freedesktop.org/wm-spec/wm-spec-1.5.html). #[inline] - pub fn with_window_type(mut self, value: XWindowType) -> Self { + pub fn with_window_type(mut self, value: WindowType) -> Self { self.window_type = Some(value); self } @@ -819,6 +817,48 @@ pub enum WindowLevel { AlwaysOnTop, } +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] +pub enum WindowType { + /// A desktop feature. This can include a single window containing desktop icons with the same dimensions as the + /// screen, allowing the desktop environment to have full control of the desktop, without the need for proxying + /// root window clicks. + Desktop, + /// A dock or panel feature. Typically a Window Manager would keep such windows on top of all other windows. + Dock, + /// Toolbar windows. "Torn off" from the main application. + Toolbar, + /// Pinnable menu windows. "Torn off" from the main application. + Menu, + /// A small persistent utility window, such as a palette or toolbox. + Utility, + /// The window is a splash screen displayed as an application is starting up. + Splash, + /// This is a dialog window. + Dialog, + /// A dropdown menu that usually appears when the user clicks on an item in a menu bar. + /// This property is typically used on override-redirect windows. + DropdownMenu, + /// A popup menu that usually appears when the user right clicks on an object. + /// This property is typically used on override-redirect windows. + PopupMenu, + /// A tooltip window. Usually used to show additional information when hovering over an object with the cursor. + /// This property is typically used on override-redirect windows. + Tooltip, + /// The window is a notification. + /// This property is typically used on override-redirect windows. + Notification, + /// This should be used on the windows that are popped up by combo boxes. + /// This property is typically used on override-redirect windows. + Combo, + /// This indicates the the window is being dragged. + /// This property is typically used on override-redirect windows. + Dnd, + /// This is a normal, top-level window. + #[default] + Normal, +} + #[derive(Clone, Copy, Default, Debug, PartialEq, Eq)] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub enum IMEPurpose { From 28fa626814895892d93b6f41e08208a34f0eeead Mon Sep 17 00:00:00 2001 From: Seth Rider Date: Mon, 18 Mar 2024 10:59:06 +0000 Subject: [PATCH 5/9] rename egui::WindowType -> egui::X11WindowType --- crates/egui-winit/src/lib.rs | 28 ++++++++++++++-------------- crates/egui/src/viewport.rs | 6 +++--- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/crates/egui-winit/src/lib.rs b/crates/egui-winit/src/lib.rs index b6cee960ce0c..5846ec1e48a8 100644 --- a/crates/egui-winit/src/lib.rs +++ b/crates/egui-winit/src/lib.rs @@ -1624,20 +1624,20 @@ pub fn create_winit_window_builder( use winit::platform::x11::WindowBuilderExtX11 as _; use winit::platform::x11::XWindowType; window_builder = window_builder.with_x11_window_type(vec![match window_type { - egui::WindowType::Normal => XWindowType::Normal, - egui::WindowType::Utility => XWindowType::Utility, - egui::WindowType::Dock => XWindowType::Dock, - egui::WindowType::Desktop => XWindowType::Desktop, - egui::WindowType::Toolbar => XWindowType::Toolbar, - egui::WindowType::Menu => XWindowType::Menu, - egui::WindowType::Splash => XWindowType::Splash, - egui::WindowType::Dialog => XWindowType::Dialog, - egui::WindowType::DropdownMenu => XWindowType::DropdownMenu, - egui::WindowType::PopupMenu => XWindowType::PopupMenu, - egui::WindowType::Tooltip => XWindowType::Tooltip, - egui::WindowType::Notification => XWindowType::Notification, - egui::WindowType::Combo => XWindowType::Combo, - egui::WindowType::Dnd => XWindowType::Dnd, + egui::X11WindowType::Normal => XWindowType::Normal, + egui::X11WindowType::Utility => XWindowType::Utility, + egui::X11WindowType::Dock => XWindowType::Dock, + egui::X11WindowType::Desktop => XWindowType::Desktop, + egui::X11WindowType::Toolbar => XWindowType::Toolbar, + egui::X11WindowType::Menu => XWindowType::Menu, + egui::X11WindowType::Splash => XWindowType::Splash, + egui::X11WindowType::Dialog => XWindowType::Dialog, + egui::X11WindowType::DropdownMenu => XWindowType::DropdownMenu, + egui::X11WindowType::PopupMenu => XWindowType::PopupMenu, + egui::X11WindowType::Tooltip => XWindowType::Tooltip, + egui::X11WindowType::Notification => XWindowType::Notification, + egui::X11WindowType::Combo => XWindowType::Combo, + egui::X11WindowType::Dnd => XWindowType::Dnd, }]); } } diff --git a/crates/egui/src/viewport.rs b/crates/egui/src/viewport.rs index 3dc4a4a211bb..be3272bc6fb2 100644 --- a/crates/egui/src/viewport.rs +++ b/crates/egui/src/viewport.rs @@ -303,7 +303,7 @@ pub struct ViewportBuilder { pub mouse_passthrough: Option, // X11 - pub window_type: Option, + pub window_type: Option, } impl ViewportBuilder { @@ -590,7 +590,7 @@ impl ViewportBuilder { /// This sets the window type. /// Maps directly to [`_NET_WM_WINDOW_TYPE`](https://specifications.freedesktop.org/wm-spec/wm-spec-1.5.html). #[inline] - pub fn with_window_type(mut self, value: WindowType) -> Self { + pub fn with_window_type(mut self, value: X11WindowType) -> Self { self.window_type = Some(value); self } @@ -819,7 +819,7 @@ pub enum WindowLevel { #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] -pub enum WindowType { +pub enum X11WindowType { /// A desktop feature. This can include a single window containing desktop icons with the same dimensions as the /// screen, allowing the desktop environment to have full control of the desktop, without the need for proxying /// root window clicks. From 784bf316030e6da24ab8b80014fbca12ee9c94fe Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Wed, 20 Mar 2024 13:57:47 +0100 Subject: [PATCH 6/9] add some vertical spacing --- crates/egui/src/viewport.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crates/egui/src/viewport.rs b/crates/egui/src/viewport.rs index be3272bc6fb2..0c8373613eef 100644 --- a/crates/egui/src/viewport.rs +++ b/crates/egui/src/viewport.rs @@ -826,34 +826,46 @@ pub enum X11WindowType { Desktop, /// A dock or panel feature. Typically a Window Manager would keep such windows on top of all other windows. Dock, + /// Toolbar windows. "Torn off" from the main application. Toolbar, + /// Pinnable menu windows. "Torn off" from the main application. Menu, + /// A small persistent utility window, such as a palette or toolbox. Utility, + /// The window is a splash screen displayed as an application is starting up. Splash, + /// This is a dialog window. Dialog, + /// A dropdown menu that usually appears when the user clicks on an item in a menu bar. /// This property is typically used on override-redirect windows. DropdownMenu, + /// A popup menu that usually appears when the user right clicks on an object. /// This property is typically used on override-redirect windows. PopupMenu, + /// A tooltip window. Usually used to show additional information when hovering over an object with the cursor. /// This property is typically used on override-redirect windows. Tooltip, + /// The window is a notification. /// This property is typically used on override-redirect windows. Notification, + /// This should be used on the windows that are popped up by combo boxes. /// This property is typically used on override-redirect windows. Combo, + /// This indicates the the window is being dragged. /// This property is typically used on override-redirect windows. Dnd, + /// This is a normal, top-level window. #[default] Normal, From 57bfe1725eb8f3921ce2658521e011c653158759 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Wed, 20 Mar 2024 13:58:56 +0100 Subject: [PATCH 7/9] normal first --- crates/egui/src/viewport.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/crates/egui/src/viewport.rs b/crates/egui/src/viewport.rs index 0c8373613eef..6a54a68d6c91 100644 --- a/crates/egui/src/viewport.rs +++ b/crates/egui/src/viewport.rs @@ -819,7 +819,10 @@ pub enum WindowLevel { #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] -pub enum X11WindowType { + /// This is a normal, top-level window. + #[default] + Normal, + /// A desktop feature. This can include a single window containing desktop icons with the same dimensions as the /// screen, allowing the desktop environment to have full control of the desktop, without the need for proxying /// root window clicks. @@ -865,10 +868,6 @@ pub enum X11WindowType { /// This indicates the the window is being dragged. /// This property is typically used on override-redirect windows. Dnd, - - /// This is a normal, top-level window. - #[default] - Normal, } #[derive(Clone, Copy, Default, Debug, PartialEq, Eq)] From 5e319259d0b5e0fdc7cda1bea14a6e3e47baf229 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Thu, 21 Mar 2024 11:11:06 +0100 Subject: [PATCH 8/9] Fix a thing I messed up --- crates/egui/src/viewport.rs | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/crates/egui/src/viewport.rs b/crates/egui/src/viewport.rs index 6a54a68d6c91..aed8d35165ef 100644 --- a/crates/egui/src/viewport.rs +++ b/crates/egui/src/viewport.rs @@ -819,52 +819,54 @@ pub enum WindowLevel { #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] +pub enum X11WindowType { /// This is a normal, top-level window. #[default] Normal, - + /// A desktop feature. This can include a single window containing desktop icons with the same dimensions as the /// screen, allowing the desktop environment to have full control of the desktop, without the need for proxying /// root window clicks. Desktop, + /// A dock or panel feature. Typically a Window Manager would keep such windows on top of all other windows. Dock, - + /// Toolbar windows. "Torn off" from the main application. Toolbar, - + /// Pinnable menu windows. "Torn off" from the main application. Menu, - + /// A small persistent utility window, such as a palette or toolbox. Utility, - + /// The window is a splash screen displayed as an application is starting up. Splash, - + /// This is a dialog window. Dialog, - + /// A dropdown menu that usually appears when the user clicks on an item in a menu bar. /// This property is typically used on override-redirect windows. DropdownMenu, - + /// A popup menu that usually appears when the user right clicks on an object. /// This property is typically used on override-redirect windows. PopupMenu, - + /// A tooltip window. Usually used to show additional information when hovering over an object with the cursor. /// This property is typically used on override-redirect windows. Tooltip, - + /// The window is a notification. /// This property is typically used on override-redirect windows. Notification, - + /// This should be used on the windows that are popped up by combo boxes. /// This property is typically used on override-redirect windows. Combo, - + /// This indicates the the window is being dragged. /// This property is typically used on override-redirect windows. Dnd, From 1aa319281bd8f807b071b2a892ec9b46f555088e Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Thu, 21 Mar 2024 11:59:03 +0100 Subject: [PATCH 9/9] Fix warning about unused variable --- 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 5846ec1e48a8..6475530474c6 100644 --- a/crates/egui-winit/src/lib.rs +++ b/crates/egui-winit/src/lib.rs @@ -1544,7 +1544,7 @@ pub fn create_winit_window_builder( app_id: _app_id, // x11 - window_type, + window_type: _window_type, mouse_passthrough: _, // handled in `apply_viewport_builder_to_window` } = viewport_builder; @@ -1620,7 +1620,7 @@ pub fn create_winit_window_builder( #[cfg(all(feature = "x11", target_os = "linux"))] { - if let Some(window_type) = window_type { + if let Some(window_type) = _window_type { use winit::platform::x11::WindowBuilderExtX11 as _; use winit::platform::x11::XWindowType; window_builder = window_builder.with_x11_window_type(vec![match window_type {