gtkwindow: Pick a suitable widget to continue the implicit grab
authorCarlos Garnacho <carlosg@gnome.org>
Mon, 18 Sep 2023 17:42:41 +0000 (19:42 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 19 Sep 2023 20:32:27 +0000 (16:32 -0400)
commitabf22e3edda214dcf572cb9c2dfd13cccc2619c6
treef26a818eea96ffa352117227117af56eba5ae6b3
parentff0d7443ee1f24542e85a7d931aaa40df0b93057
gtkwindow: Pick a suitable widget to continue the implicit grab

When a widget in the GtkPointerFocus stack becomes insensitive, we've
so far broken the implicit grab entirely. This has the side effect of
breaking accounting of the active state on the widgets that are
ancestors of the widget that became insensitive.

The easiest, and most consistent thing to do (i.e. giving widgets
in the GtkPointerFocus stack certain level of isolation wrt state
changes in other widgets) is to transfer the implicit grab to the
topmost actor of the GtkPointerFocus stack that can keep handling
events.

This fixes the unbalanced accounting of active state on ancestors
of widgets becoming insensitive, and avoids thorny questions about
how to handle implicit active state with broken implicit grabs.
gtk/gtkwindow.c