[gtk/wip/carlosg/input-cleanups: 18/26] gtkvideo: Track child focus to determine whether controls should autohide



commit 2f8d5e2dcd61b16178c62a104a123ae50e0b497e
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Jun 24 15:35:16 2020 +0200

    gtkvideo: Track child focus to determine whether controls should autohide
    
    Move away from grab_notify, and use the set_child_focus() vfunc to track
    child widgets being set the keyboard focus. This is not 1:1, but seems
    good enough at the moment.

 gtk/gtkvideo.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkvideo.c b/gtk/gtkvideo.c
index b02e26128a..70e741fdc1 100644
--- a/gtk/gtkvideo.c
+++ b/gtk/gtkvideo.c
@@ -171,14 +171,14 @@ gtk_video_unmap (GtkWidget *widget)
 }
 
 static void
-gtk_video_grab_notify (GtkWidget *widget,
-                       gboolean   was_grabbed)
+gtk_video_set_focus_child (GtkWidget *widget,
+                           GtkWidget *child)
 {
   GtkVideo *self = GTK_VIDEO (widget);
 
-  self->grabbed = !was_grabbed;
+  self->grabbed = child != NULL;
 
-  GTK_WIDGET_CLASS (gtk_video_parent_class)->grab_notify (widget, was_grabbed);
+  GTK_WIDGET_CLASS (gtk_video_parent_class)->set_focus_child (widget, child);
 }
 
 static void
@@ -268,7 +268,7 @@ gtk_video_class_init (GtkVideoClass *klass)
   widget_class->unrealize = gtk_video_unrealize;
   widget_class->map = gtk_video_map;
   widget_class->unmap = gtk_video_unmap;
-  widget_class->grab_notify = gtk_video_grab_notify;
+  widget_class->set_focus_child = gtk_video_set_focus_child;
 
   gobject_class->dispose = gtk_video_dispose;
   gobject_class->get_property = gtk_video_get_property;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]