After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 647712 - meta_window_propagate_focus_appearance() in multi-generational families
meta_window_propagate_focus_appearance() in multi-generational families
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Owen Taylor
mutter-maint
Depends on:
Blocks: 646761
 
 
Reported: 2011-04-13 20:47 UTC by Owen Taylor
Modified: 2011-07-07 21:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
window: fix appears-focused propagation with attached grandchildren (5.37 KB, patch)
2011-04-14 14:48 UTC, Dan Winship
none Details | Review
reload_transient_for: avoid xtransient_for loops (5.53 KB, patch)
2011-07-07 20:51 UTC, Dan Winship
committed Details | Review
window: fix appears-focused propagation with attached grandchildren (5.32 KB, patch)
2011-07-07 20:51 UTC, Dan Winship
committed Details | Review

Description Owen Taylor 2011-04-13 20:47:55 UTC
In various places -

 meta_window_unmanage(), reload_transient_for()

we do something like:

  if (window->has_focus && window->xtransient_for != None)
    meta_window_propagate_focus_appearance (window, FALSE);

But this isn't right if we have parent/child/grand-child, it really should be:

 meta_window_appears_focused() && window->transient_for != None

I think.
Comment 1 Dan Winship 2011-04-14 14:48:14 UTC
Created attachment 185960 [details] [review]
window: fix appears-focused propagation with attached grandchildren

When detaching/attaching a dialog, we were only updating
appears-focused on the parent if the child itself was focused, but in
fact, we need to do it if the child has an attached child which is
focused too.

To simplify the case of detaching a focused subtree from its parent,
we change meta_window_propagate_focus_appearance() to use
@window->display->focus_window as the window to add/remove as the
attached_focus_window, and @window only as the starting point to
propagate from. That way we can propagate focus-removal up to
@window's (soon-to-be-ex-)ancestors without having to remove it from
its descendants as well.
Comment 2 Dan Winship 2011-05-16 10:39:45 UTC
poke
Comment 3 Dan Winship 2011-07-07 20:51:35 UTC
Created attachment 191493 [details] [review]
reload_transient_for: avoid xtransient_for loops

Don't set a window's xtransient_for if it would create a loop. Since
this is the only place we ever set xtransient_for, we can therefore
assume everywhere else that it does not loop.
Comment 4 Dan Winship 2011-07-07 20:51:42 UTC
Created attachment 191494 [details] [review]
window: fix appears-focused propagation with attached grandchildren

When detaching/attaching a dialog, we were only updating
appears-focused on the parent if the child itself was focused, but in
fact, we need to do it if the child has an attached child which is
focused too.

To simplify the case of detaching a focused subtree from its parent,
we change meta_window_propagate_focus_appearance() to use
@window->display->focus_window as the window to add/remove as the
attached_focus_window, and @window only as the starting point to
propagate from. That way we can propagate focus-removal up to
@window's (soon-to-be-ex-)ancestors without having to remove it from
its descendants as well.
Comment 5 Owen Taylor 2011-07-07 21:13:08 UTC
Review of attachment 191493 [details] [review]:

I can't find a loophole here - it's not completely obvious, because the MetaWindow pointed to be window->xtransient_for can change arbitrarily - we can have one window be removed, and another show up (which makes the "Invalid WM_TRANSIENT_FOR window 0x%lx specified" check rather dubious - we have to be able that case because it could become true at any time even if it wasn't initially.) But the only time window->xtransient_for changes to a different MetaWindow is when a new MetaWindow is mapped, and at that point, we'll reload the new MetaWindow's xtransient_for, and break any loops there.
Comment 6 Owen Taylor 2011-07-07 21:27:13 UTC
Review of attachment 191494 [details] [review]:

Looks good to me
Comment 7 Dan Winship 2011-07-07 21:48:50 UTC
Attachment 191493 [details] pushed as 6dc79ce - reload_transient_for: avoid xtransient_for loops
Attachment 191494 [details] pushed as 48cabd1 - window: fix appears-focused propagation with attached grandchildren