From 003f9e5a731bd892bbd0da1fa7cb03fc2ae05412 Mon Sep 17 00:00:00 2001 From: monsta Date: Wed, 23 Aug 2017 16:52:46 +0300 Subject: applet: make keyboard work in popup fixes https://github.com/mate-desktop/mate-media/issues/94 --- mate-volume-control/gvc-stream-status-icon.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/mate-volume-control/gvc-stream-status-icon.c b/mate-volume-control/gvc-stream-status-icon.c index e103a37..f287fbf 100644 --- a/mate-volume-control/gvc-stream-status-icon.c +++ b/mate-volume-control/gvc-stream-status-icon.c @@ -142,9 +142,12 @@ popup_dock (GvcStreamStatusIcon *icon, guint time) do { GdkDeviceManager *manager = gdk_display_get_device_manager (display); + GdkDevice *pointer = gdk_device_manager_get_client_pointer (manager); + GdkDevice *keyboard = gdk_device_get_associated_device (pointer); + GdkWindow *window = gtk_widget_get_window (icon->priv->dock); - if (gdk_device_grab (gdk_device_manager_get_client_pointer (manager), - gtk_widget_get_window (icon->priv->dock), + if (gdk_device_grab (pointer, + window, GDK_OWNERSHIP_NONE, TRUE, GDK_BUTTON_PRESS_MASK | @@ -155,6 +158,20 @@ popup_dock (GvcStreamStatusIcon *icon, guint time) time) != GDK_GRAB_SUCCESS) { gtk_grab_remove (icon->priv->dock); gtk_widget_hide (icon->priv->dock); + break; + } + + if (gdk_device_grab (keyboard, + window, + GDK_OWNERSHIP_NONE, + TRUE, + GDK_KEY_PRESS_MASK | + GDK_KEY_RELEASE_MASK, + NULL, + time) != GDK_GRAB_SUCCESS) { + gdk_device_ungrab (pointer, time); + gtk_grab_remove (icon->priv->dock); + gtk_widget_hide (icon->priv->dock); } } while (0); -- cgit v1.2.1