[PATCH] timed-revealer: listen to the "grab-notify" signal

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

 



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@xxxxxxxxxx>
---
 src/virt-viewer-timed-revealer.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/virt-viewer-timed-revealer.c b/src/virt-viewer-timed-revealer.c
index 7892436..3c48ab5 100644
--- a/src/virt-viewer-timed-revealer.c
+++ b/src/virt-viewer-timed-revealer.c
@@ -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,
@@ -174,6 +183,10 @@ virt_viewer_timed_revealer_new(GtkWidget *toolbar)
     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),
                      NULL);
-- 
2.7.4

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux