[gtk/fix-gen-demo-conf: 4/5] gtkwindow: Fix "shadowed" checks for GTK grabs
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/fix-gen-demo-conf: 4/5] gtkwindow: Fix "shadowed" checks for GTK grabs
- Date: Tue, 18 May 2021 03:17:22 +0000 (UTC)
commit 1e18aad656d1ab9fd4f4ad978f5024be710c00c6
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon May 17 23:57:17 2021 +0200
gtkwindow: Fix "shadowed" checks for GTK grabs
We iterate here from the target widget up the toplevel checking
for the previous and new grab, there's however 2 bugs here:
- The check for is_shadowed was different to the check for was_shadowed
- The loop started with the assumption that the widgets did not hold
a grab, just to change it if the grab widget was found. (or maybe
it's the other way around? it's unclear with the differing checks
for past/present state).
Make these checks consistent, and ensure we start with the right
assumption for the past/present grabbing state, and accounting that
new/old grab widgets may or may not be part of the pick stack.
gtk/gtkwindow.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 33e1379a25..5d6ba32897 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -6748,6 +6748,10 @@ gtk_window_propagate_grab_notify (GtkWindow *window,
while (target)
{
+ if (target == old_grab_widget)
+ was_grabbed = TRUE;
+ if (target == new_grab_widget)
+ is_grabbed = TRUE;
widgets = g_list_prepend (widgets, g_object_ref (target));
target = gtk_widget_get_parent (target);
}
@@ -6758,11 +6762,13 @@ gtk_window_propagate_grab_notify (GtkWindow *window,
{
gboolean was_shadowed, is_shadowed;
- was_grabbed |= (l->data == old_grab_widget);
- is_grabbed |= (l->data == new_grab_widget);
-
was_shadowed = old_grab_widget && !was_grabbed;
- is_shadowed = new_grab_widget && is_grabbed;
+ is_shadowed = new_grab_widget && !is_grabbed;
+
+ if (l->data == old_grab_widget)
+ was_grabbed = FALSE;
+ if (l->data == new_grab_widget)
+ is_grabbed = FALSE;
if (was_shadowed == is_shadowed)
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]