[Wayland-bugs] [Bug 773210] [WAYLAND] random loss of focus on toplevel when mapping/unmapping grab-less xdg_popup

mutter (GNOME Bugzilla) bugzilla at gnome.org
Wed Oct 19 09:45:28 UTC 2016


https://bugzilla.gnome.org/show_bug.cgi?id=773210

--- Comment #1 from Olivier Fourdan <ofourdan at redhat.com> ---
  "STARTUP: The focus window W1 (lt-test-co) is an ancestor of the newly mapped
   window W5 which isn't being focused.  Unfocusing the ancestor."

This comes from meta_window_show() in src/core/window.c when showing the popup
window:

2230 static void
2231 meta_window_show (MetaWindow *window)
2232 {
       [...]
2255   /* Now, in some rare cases we should *not* put a new window on top.
2256    * These cases include certain types of windows showing for the first
2257    * time, and any window which would be covered because of another window
2258    * being set "above" ("always on top").
2259    *
2260    * FIXME: Although "place_on_top_on_map" and "takes_focus_on_map" are
2261    * generally based on the window type, there is a special case when the
2262    * focus window is a terminal for them both to be false; this should
2263    * probably rather be a term in the "if" condition below.
2264    */
2265 
2266   if ( focus_window != NULL && window->showing_for_first_time &&
2267       ( (!place_on_top_on_map && !takes_focus_on_map) ||
2268       window_would_be_covered (window) )
2269     ) {
2270       if (meta_window_is_ancestor_of_transient (focus_window, window))
2271         {
2272           guint32     timestamp;
2273 
2274           timestamp = meta_display_get_current_time_roundtrip
(window->display);
2275 
2276           /* This happens for error dialogs or alerts; these need to
remain on
2277            * top, but it would be confusing to have its ancestor remain
2278            * focused.
2279            */
2280           meta_topic (META_DEBUG_STARTUP,
2281                       "The focus window %s is an ancestor of the newly
mapped "
2282                       "window %s which isn't being focused.  Unfocusing
the "
2283                       "ancestor.\n",
2284                       focus_window->desc, window->desc);
2285 
2286           meta_display_focus_the_no_focus_window (window->display,
2287                                                   window->screen,
2288                                                   timestamp);
2289         }

The xdg_popup window is indeed on top, doesn;t take focus (as it's without
grab), it;s showing for the first time does cover the toplevel window, which
explains why we get into this code path.

But there is this other message as well:

  "STARTUP: window W5 focus prevented by other activity; 76886753 < 76886786"

Which comes from intervening_user_event_occurred() in src/core/window.c called
from window_state_on_map(), which is precisely what sets takes_focus to FALSE,
ths trigging the condition.

The problem is the xdg_popup should not take focus, which means we /should/ hit
this condition every time, i.e. focus should be lost every time...

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/wayland-bugs/attachments/20161019/6682c2da/attachment.html>


More information about the wayland-bugs mailing list