View | Details | Raw Unified | Return to bug 244290 | Differences between
and this patch

Collapse All | Expand All

(-)Makefile (-1 / +1 lines)
Lines 3-9 Link Here
3
3
4
PORTNAME=	libxfce4menu
4
PORTNAME=	libxfce4menu
5
PORTVERSION=	4.16.0
5
PORTVERSION=	4.16.0
6
PORTREVISION=	1
6
PORTREVISION=	2
7
CATEGORIES=	x11 xfce
7
CATEGORIES=	x11 xfce
8
MASTER_SITES=	XFCE
8
MASTER_SITES=	XFCE
9
DISTNAME=	libxfce4ui-${DISTVERSIONFULL}
9
DISTNAME=	libxfce4ui-${DISTVERSIONFULL}
(-)files/patch-libxfce4kbd-private_xfce-shortcuts-grabber.c (-14 / +89 lines)
Lines 1-21 Link Here
1
--- libxfce4kbd-private/xfce-shortcuts-grabber.c.orig	2020-11-23 10:16:17 UTC
1
diff --git a/libxfce4kbd-private/xfce-shortcuts-grabber.c b/libxfce4kbd-private/xfce-shortcuts-grabber.c
2
index 60ddfd71bf1a4f23656e89db834aa2aeb217852a..9df45c3eeb33280f13a8d0d51cda03c1f5dce941 100644
3
--- libxfce4kbd-private/xfce-shortcuts-grabber.c
2
+++ libxfce4kbd-private/xfce-shortcuts-grabber.c
4
+++ libxfce4kbd-private/xfce-shortcuts-grabber.c
3
@@ -22,6 +22,8 @@
5
@@ -61,13 +61,14 @@ static void            xfce_shortcuts_grabber_grab             (XfceShortcutsGra
4
 #include <config.h>
6
                                                                 gboolean                   grab);
5
 #endif
7
 static GdkFilterReturn xfce_shortcuts_grabber_event_filter     (GdkXEvent                 *gdk_xevent,
8
                                                                 GdkEvent                  *event,
9
-                                                                XfceShortcutsGrabber      *grabber);
10
+                                                                gpointer                   data);
6
 
11
 
7
+#include <sys/param.h>
8
+
9
 #include <glib.h>
10
 #include <glib-object.h>
11
 
12
 
12
@@ -180,6 +182,9 @@ xfce_shortcuts_grabber_keys_changed (GdkKeymap        
13
 
13
 
14
   TRACE ("Keys changed, regrabbing");
14
 struct _XfceShortcutsGrabberPrivate
15
 {
16
   GHashTable *keys;
17
+  gint        xkbEventType, xkbStateGroup;
18
 };
15
 
19
 
16
+#ifdef __FreeBSD__
20
 typedef enum
17
+  xfce_shortcuts_grabber_ungrab_all (grabber);
21
@@ -141,20 +142,26 @@ static void
18
+#endif
22
 xfce_shortcuts_grabber_constructed (GObject *object)
19
   xfce_shortcuts_grabber_grab_all (grabber);
23
 {
24
   GdkDisplay *display;
25
+  Display    *xdisplay;
26
   GdkKeymap  *keymap;
27
 
28
   XfceShortcutsGrabber *grabber = XFCE_SHORTCUTS_GRABBER (object);
29
 
30
   display = gdk_display_get_default ();
31
+  xdisplay = GDK_DISPLAY_XDISPLAY (display);
32
   keymap = gdk_keymap_get_for_display (display);
33
   g_signal_connect (keymap, "keys-changed", G_CALLBACK (xfce_shortcuts_grabber_keys_changed),
34
                     grabber);
35
 
36
+  if (G_UNLIKELY (!XkbQueryExtension (xdisplay, 0, &grabber->priv->xkbEventType, 0, 0, 0)))
37
+    grabber->priv->xkbEventType = -1;
38
+  grabber->priv->xkbStateGroup = -1;
39
+
40
   /* Flush events before adding the event filter */
41
-  XAllowEvents (GDK_DISPLAY_XDISPLAY (display), AsyncBoth, CurrentTime);
42
+  XAllowEvents (xdisplay, AsyncBoth, CurrentTime);
43
 
44
   /* Add event filter */
45
-  gdk_window_add_filter (NULL, (GdkFilterFunc) xfce_shortcuts_grabber_event_filter, grabber);
46
+  gdk_window_add_filter (NULL, xfce_shortcuts_grabber_event_filter, grabber);
20
 }
47
 }
21
 
48
 
49
 
50
@@ -417,10 +424,11 @@ find_event_key (const gchar                *shortcut,
51
 
52
 
53
 static GdkFilterReturn
54
-xfce_shortcuts_grabber_event_filter (GdkXEvent            *gdk_xevent,
55
-                                     GdkEvent             *event,
56
-                                     XfceShortcutsGrabber *grabber)
57
+xfce_shortcuts_grabber_event_filter (GdkXEvent *gdk_xevent,
58
+                                     GdkEvent  *event,
59
+                                     gpointer   data)
60
 {
61
+  XfceShortcutsGrabber       *const grabber = data;
62
   struct EventKeyFindContext  context;
63
   GdkKeymap                  *keymap;
64
   GdkModifierType             consumed, modifiers;
65
@@ -434,6 +442,22 @@ xfce_shortcuts_grabber_event_filter (GdkXEvent            *gdk_xevent,
66
 
67
   xevent = (XEvent *) gdk_xevent;
68
 
69
+  if (xevent->type == grabber->priv->xkbEventType)
70
+    {
71
+      const XkbEvent *e = (const XkbEvent*) xevent;
72
+      TRACE ("xkb event: any.xkb_type=%d", e->any.xkb_type);
73
+      if (e->any.xkb_type == XkbStateNotify)
74
+        {
75
+          TRACE ("xkb event: any.xkb_type=XkbStateNotify, state.group=%d", e->state.group);
76
+          if (grabber->priv->xkbStateGroup != e->state.group)
77
+            {
78
+              grabber->priv->xkbStateGroup = e->state.group;
79
+              xfce_shortcuts_grabber_ungrab_all (grabber);
80
+              xfce_shortcuts_grabber_grab_all (grabber);
81
+            }
82
+        }
83
+    }
84
+
85
   if (xevent->type != KeyPress)
86
     return GDK_FILTER_CONTINUE;
87
 
88
@@ -450,7 +474,7 @@ xfce_shortcuts_grabber_event_filter (GdkXEvent            *gdk_xevent,
89
 
90
   gdk_keymap_translate_keyboard_state (keymap, xevent->xkey.keycode,
91
                                        modifiers,
92
-                                       XkbGroupForCoreState (xevent->xkey.state),
93
+                                       grabber->priv->xkbStateGroup,
94
                                        &keyval, NULL, NULL, &consumed);
95
 
96
   /* We want Alt + Print to be Alt + Print not SysReq. See bug #7897 */

Return to bug 244290