1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 22:30:03 -04:00

Allow specifying override_redirect x11 window attribute (#7830)

This commit is contained in:
Ivor Wanders
2026-01-05 07:16:00 -05:00
committed by GitHub
parent 6d416fab2e
commit 0566fb17a5
2 changed files with 22 additions and 2 deletions

View File

@@ -332,6 +332,7 @@ pub struct ViewportBuilder {
// X11
pub window_type: Option<X11WindowType>,
pub override_redirect: Option<bool>,
}
impl ViewportBuilder {
@@ -663,13 +664,22 @@ impl ViewportBuilder {
/// ### On X11
/// This sets the window type.
/// Maps directly to [`_NET_WM_WINDOW_TYPE`](https://specifications.freedesktop.org/wm-spec/wm-spec-1.5.html).
/// Maps directly to [`_NET_WM_WINDOW_TYPE`](https://specifications.freedesktop.org/wm/1.5/ar01s05.html#id-1.6.7).
#[inline]
pub fn with_window_type(mut self, value: X11WindowType) -> Self {
self.window_type = Some(value);
self
}
/// ### On X11
/// This sets the override-redirect flag. When this is set to true the window type should be specified.
/// Maps directly to [`Override-redirect windows`](https://specifications.freedesktop.org/wm/1.5/ar01s02.html#id-1.3.13).
#[inline]
pub fn with_override_redirect(mut self, value: bool) -> Self {
self.override_redirect = 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]
@@ -706,6 +716,7 @@ impl ViewportBuilder {
mouse_passthrough: new_mouse_passthrough,
taskbar: new_taskbar,
window_type: new_window_type,
override_redirect: new_override_redirect,
} = new_vp_builder;
let mut commands = Vec::new();
@@ -903,6 +914,11 @@ impl ViewportBuilder {
recreate_window = true;
}
if new_override_redirect.is_some() && self.override_redirect != new_override_redirect {
self.override_redirect = new_override_redirect;
recreate_window = true;
}
(commands, recreate_window)
}
}