mirror of
https://github.com/labwc/labwc.git
synced 2025-11-01 22:58:47 -04:00
desktop: allow re-focus between "globally active" views of the same PID
Commit7e72bf975fchanged behavior to not automatically focus xwayland views using the "Globally Active" input model (WM_HINTS.inputs = false but WM_TAKE_FOCUS listed in WM_PROTOCOLS). One undesired side effect of this change is that when a dialog is closed, the parent window is not re-focused if "Globally Active". This issue is seen for example with JDownloader. It can be solved taking a similar approach to what is done for unmanaged xwayland views: allow automatic re-focus between views sharing the same PID. Note that it's difficult to completely solve all of the focus issues with Globally Active views without proper WM_TAKE_FOCUS support. Implementing proper support is difficult since it requires wlroots changes and would also mean waiting for a message round-trip in desktop_focus_topmost_view(). Fixes (partially):7e72bf975f("view/xwayland: avoid focusing views that don't want focus")
This commit is contained in:
parent
dd7f563a50
commit
f6e3527767
3 changed files with 30 additions and 5 deletions
18
src/view.c
18
src/view.c
|
|
@ -154,16 +154,28 @@ view_wants_focus(struct view *view)
|
|||
}
|
||||
|
||||
bool
|
||||
view_is_focusable(struct view *view)
|
||||
view_is_focusable_from(struct view *view, struct wlr_surface *prev)
|
||||
{
|
||||
assert(view);
|
||||
if (!view->surface) {
|
||||
return false;
|
||||
}
|
||||
if (view_wants_focus(view) != VIEW_WANTS_FOCUS_ALWAYS) {
|
||||
if (!view->mapped && !view->minimized) {
|
||||
return false;
|
||||
}
|
||||
return (view->mapped || view->minimized);
|
||||
enum view_wants_focus wants_focus = view_wants_focus(view);
|
||||
/*
|
||||
* Consider "offer focus" (Globally Active) views as focusable
|
||||
* only if another surface from the same application already had
|
||||
* focus. The goal is to allow focusing a parent window when a
|
||||
* dialog/popup is closed, but still avoid focusing standalone
|
||||
* panels/toolbars/notifications. Note that we are basically
|
||||
* guessing whether Globally Active views want focus, and will
|
||||
* probably be wrong some of the time.
|
||||
*/
|
||||
return (wants_focus == VIEW_WANTS_FOCUS_ALWAYS
|
||||
|| (wants_focus == VIEW_WANTS_FOCUS_OFFER
|
||||
&& prev && view_is_related(view, prev)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue