xwayland: always offer focus in Globally Active case

In 9e3785f8cd, a heuristic was added to assume that NORMAL and DIALOG
window types were always focusable. (This was before we had the "offer
focus" mechanism in place.)

However, we should still call wlr_xwayland_surface_offer_focus() for
these views, in case they actually don't want focus. (This is uncommon
but has recently been seen with WeChat popups, which have both NORMAL
and UTILITY type.)

To make this possible, refine view_wants_focus() to return either
LIKELY or UNLIKELY for Globally Active input windows. This decouples
the question of "should we try to focus this view" from the actual
mechanism used to do so.
This commit is contained in:
John Lindgren 2025-06-09 11:11:32 -04:00
parent 97ce4131bb
commit 8fb2ecefcb
4 changed files with 22 additions and 12 deletions

View file

@ -392,10 +392,14 @@ view_is_focusable(struct view *view)
if (!view->surface) {
return false;
}
if (view_wants_focus(view) != VIEW_WANTS_FOCUS_ALWAYS) {
switch (view_wants_focus(view)) {
case VIEW_WANTS_FOCUS_ALWAYS:
case VIEW_WANTS_FOCUS_LIKELY:
return (view->mapped || view->minimized);
default:
return false;
}
return (view->mapped || view->minimized);
}
void