timed-revealer: listen to the "grab-notify" signal

The "grab-notify" signal lets us know when our widget becomes
shadowed by a Gtk+ grab on another widget, or when it becomes unshadowed
due to a grab being removed.

That's exactly the case we face when dealing with "usb-redirection" and
"close" items of the fullscreen toolbar. And, currently, when these
widgets get closed the timed-revealer stays there forever. From now on
let's take advantage of the "grab-notify" signal and schedule a timeout
for the revealer when these widgets' windows get closed.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
This commit is contained in:
Fabiano Fidêncio 2016-06-29 15:27:16 +02:00
parent 8a32e0bfee
commit 3775e095a5

View File

@ -74,6 +74,15 @@ virt_viewer_timed_revealer_schedule_unreveal_timeout(VirtViewerTimedRevealer *se
self);
}
static void
virt_viewer_timed_revealer_grab_notify(VirtViewerTimedRevealer *self,
gboolean was_grabbed,
gpointer user_data G_GNUC_UNUSED)
{
if (was_grabbed)
virt_viewer_timed_revealer_schedule_unreveal_timeout(self, 1000);
}
static gboolean
virt_viewer_timed_revealer_enter_leave_notify(VirtViewerTimedRevealer *self,
GdkEventCrossing *event,
@ -173,6 +182,10 @@ virt_viewer_timed_revealer_new(GtkWidget *toolbar)
gtk_widget_set_valign(GTK_WIDGET(self), GTK_ALIGN_START);
gtk_widget_show_all(GTK_WIDGET(self));
g_signal_connect(self,
"grab-notify",
G_CALLBACK(virt_viewer_timed_revealer_grab_notify),
NULL);
g_signal_connect(self,
"enter-notify-event",
G_CALLBACK(virt_viewer_timed_revealer_enter_leave_notify),