summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormonsta <[email protected]>2017-08-23 16:52:46 +0300
committermonsta <[email protected]>2017-08-24 12:52:29 +0300
commit003f9e5a731bd892bbd0da1fa7cb03fc2ae05412 (patch)
tree1879bb243ea057af9ebe6f7ac4b943c31ac7acc2
parent543dfb8b220f6c5f17e82455b1ef7eda4b8eb0b2 (diff)
downloadmate-media-003f9e5a731bd892bbd0da1fa7cb03fc2ae05412.tar.bz2
mate-media-003f9e5a731bd892bbd0da1fa7cb03fc2ae05412.tar.xz
applet: make keyboard work in popup
fixes https://github.com/mate-desktop/mate-media/issues/94
-rw-r--r--mate-volume-control/gvc-stream-status-icon.c21
1 files 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);