fix: correct popup detection logic to handle optional has_skip_taskbar value

This commit is contained in:
GoodbyeNJN 2026-01-24 16:48:07 +08:00 committed by Supreeeme
parent 0e93461aa6
commit 2f57480d21

View file

@ -693,7 +693,7 @@ impl XState {
) -> XResult<bool> { ) -> XResult<bool> {
let mut motif_popup = false; let mut motif_popup = false;
let mut wmhint_popup = false; let mut wmhint_popup = false;
let mut has_skip_taskbar = false; let mut has_skip_taskbar = None;
let attrs = self let attrs = self
.connection .connection
@ -711,7 +711,7 @@ impl XState {
); );
if let Some(states) = window_state.resolve()? { if let Some(states) = window_state.resolve()? {
has_skip_taskbar = states.contains(&self.atoms.skip_taskbar); has_skip_taskbar = Some(states.contains(&self.atoms.skip_taskbar));
} }
if let Some(hints) = motif_hints { if let Some(hints) = motif_hints {
// If MOTIF_WM_HINTS provides no decorations for client assume its a popup // If MOTIF_WM_HINTS provides no decorations for client assume its a popup
@ -761,9 +761,7 @@ impl XState {
match ty { match ty {
x if x == self.window_atoms.normal => is_popup = override_redirect || wmhint_popup, x if x == self.window_atoms.normal => is_popup = override_redirect || wmhint_popup,
x if x == self.window_atoms.dialog => is_popup = override_redirect, x if x == self.window_atoms.dialog => is_popup = override_redirect,
x if x == self.window_atoms.utility => { x if x == self.window_atoms.utility => is_popup = override_redirect || motif_popup,
is_popup = override_redirect || motif_popup;
}
x if [ x if [
self.window_atoms.menu, self.window_atoms.menu,
self.window_atoms.popup_menu, self.window_atoms.popup_menu,
@ -786,7 +784,9 @@ impl XState {
} }
if !known_window_type { if !known_window_type {
is_popup = has_skip_taskbar; if let Some(has_skip_taskbar) = has_skip_taskbar {
is_popup = has_skip_taskbar;
}
} }
Ok(is_popup) Ok(is_popup)