diff -up libxfce4ui-4.12.1/libxfce4kbd-private/xfce-shortcuts-grabber.c.z-libxfce4ui-multimedia-keys-press-fix libxfce4ui-4.12.1/libxfce4kbd-private/xfce-shortcuts-grabber.c --- libxfce4ui-4.12.1/libxfce4kbd-private/xfce-shortcuts-grabber.c.z-libxfce4ui-multimedia-keys-press-fix +++ libxfce4ui-4.12.1/libxfce4kbd-private/xfce-shortcuts-grabber.c @@ -68,6 +68,7 @@ static GdkFilterReturn xfce_shortcuts_gr struct _XfceShortcutsGrabberPrivate { GHashTable *keys; + GHashTable *pressed_keys; }; struct _XfceKey @@ -112,6 +113,7 @@ xfce_shortcuts_grabber_init (XfceShortcu { grabber->priv = XFCE_SHORTCUTS_GRABBER_GET_PRIVATE (grabber); grabber->priv->keys = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); + grabber->priv->pressed_keys = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, NULL); /* Workaround: Make sure modmap is up to date * There is possibly a bug in GTK+ where virtual modifiers are not @@ -136,6 +138,8 @@ xfce_shortcuts_grabber_constructed (GObj grabber); display = gdk_display_get_default (); + + XkbSetDetectableAutoRepeat(GDK_DISPLAY_XDISPLAY (display), TRUE, NULL); /* Flush events before adding the event filter */ XAllowEvents (GDK_DISPLAY_XDISPLAY (display), AsyncBoth, CurrentTime); @@ -153,6 +157,7 @@ xfce_shortcuts_grabber_finalize (GObject xfce_shortcuts_grabber_ungrab_all (grabber); g_hash_table_unref (grabber->priv->keys); + g_hash_table_unref (grabber->priv->pressed_keys); (*G_OBJECT_CLASS (xfce_shortcuts_grabber_parent_class)->finalize) (object); } @@ -409,9 +414,17 @@ xfce_shortcuts_grabber_event_filter (Gdk xevent = (XEvent *) gdk_xevent; + if (xevent->type == KeyRelease) + g_hash_table_remove (grabber->priv->pressed_keys, GINT_TO_POINTER (xevent->xkey.keycode)); + if (xevent->type != KeyPress) return GDK_FILTER_CONTINUE; + if (g_hash_table_contains (grabber->priv->pressed_keys, GINT_TO_POINTER (xevent->xkey.keycode))) + return GDK_FILTER_CONTINUE; + + g_hash_table_add (grabber->priv->pressed_keys, GINT_TO_POINTER (xevent->xkey.keycode)); + context.grabber = grabber; context.result = NULL; timestamp = xevent->xkey.time;