refactor: make get_popup_toplevel() PopupKind agnostic

- for preparation to make unconstrain_popup() PopupKind agnostic.
This commit is contained in:
KENZ 2026-04-24 05:35:41 +09:00 committed by Jacob Kauffmann
parent b5a1a6d317
commit 977d4c2dca
5 changed files with 11 additions and 8 deletions

View file

@ -197,7 +197,7 @@ impl PointerFocusTarget {
PointerFocusTarget::WlSurface {
toplevel: Some(PointerFocusToplevel::Popup(PopupKind::Xdg(popup))),
..
} => get_popup_toplevel(popup)
} => get_popup_toplevel(&PopupKind::Xdg(popup.clone()))
.and_then(|s| shell.element_for_surface(&s).map(|mapped| (mapped, s)))
.and_then(|(m, s)| {
m.windows()
@ -243,7 +243,7 @@ impl KeyboardFocusTarget {
match self {
KeyboardFocusTarget::Element(mapped) => mapped.wl_surface(),
KeyboardFocusTarget::Popup(PopupKind::Xdg(xdg)) => {
get_popup_toplevel(xdg).map(Cow::Owned)
get_popup_toplevel(&PopupKind::Xdg(xdg.clone())).map(Cow::Owned)
}
_ => None,
}

View file

@ -1278,7 +1278,7 @@ impl FloatingLayout {
let Some(focused) = (match target {
KeyboardFocusTarget::Popup(popup) => {
let Some(toplevel_surface) = (match popup {
PopupKind::Xdg(xdg) => get_popup_toplevel(&xdg),
PopupKind::Xdg(_) => get_popup_toplevel(&popup),
PopupKind::InputMethod(_) => unreachable!(),
}) else {
return MoveResult::None;

View file

@ -2848,7 +2848,7 @@ impl TilingLayout {
// if the focus is currently on a popup, treat it's toplevel as the target
if let KeyboardFocusTarget::Popup(popup) = target {
let toplevel_surface = match popup {
PopupKind::Xdg(xdg) => get_popup_toplevel(&xdg),
PopupKind::Xdg(_) => get_popup_toplevel(&popup),
PopupKind::InputMethod(_) => unreachable!(),
}?;
let root_id = tree.root_node_id()?;

View file

@ -3883,7 +3883,7 @@ impl Shell {
let Some(focused) = (match target {
KeyboardFocusTarget::Popup(popup) => {
let Some(toplevel_surface) = (match popup {
PopupKind::Xdg(xdg) => get_popup_toplevel(&xdg),
PopupKind::Xdg(_) => get_popup_toplevel(&popup),
PopupKind::InputMethod(_) => unreachable!(),
}) else {
return FocusResult::None;