6bdd276d05
Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
118 lines
3.7 KiB
Diff
118 lines
3.7 KiB
Diff
diff --git a/gdk/quartz/gdkevents-quartz.c b/gdk/quartz/gdkevents-quartz.c
|
|
index f4ae401..d601ee3 100644
|
|
--- a/gdk/quartz/gdkevents-quartz.c
|
|
+++ b/gdk/quartz/gdkevents-quartz.c
|
|
@@ -680,6 +680,8 @@ _gdk_quartz_events_update_focus_window (GdkWindow *window,
|
|
* everything in the window is set to correct state.
|
|
*/
|
|
generate_motion_event (window);
|
|
+
|
|
+ _gdk_quartz_update_symbolic_hotkeys ();
|
|
}
|
|
}
|
|
|
|
diff --git a/gdk/quartz/gdkinput.c b/gdk/quartz/gdkinput.c
|
|
index 6f5f8ea..8d5698f 100644
|
|
--- a/gdk/quartz/gdkinput.c
|
|
+++ b/gdk/quartz/gdkinput.c
|
|
@@ -568,6 +568,8 @@ _gdk_input_exit (void)
|
|
g_free (tmp_list->data);
|
|
}
|
|
g_list_free (_gdk_input_windows);
|
|
+
|
|
+ _gdk_quartz_release_symbolic_hotkeys ();
|
|
}
|
|
|
|
gboolean
|
|
diff --git a/gdk/quartz/gdkkeys-quartz.c b/gdk/quartz/gdkkeys-quartz.c
|
|
index e81ea4d..746881b 100644
|
|
--- a/gdk/quartz/gdkkeys-quartz.c
|
|
+++ b/gdk/quartz/gdkkeys-quartz.c
|
|
@@ -55,6 +55,7 @@
|
|
#include <AppKit/NSEvent.h>
|
|
#include "gdk.h"
|
|
#include "gdkkeysyms.h"
|
|
+#include "gdkprivate-quartz.h"
|
|
|
|
#define NUM_KEYCODES 128
|
|
#define KEYVALS_PER_KEYCODE 4
|
|
@@ -65,6 +66,7 @@ static GdkKeymap *default_keymap = NULL;
|
|
* TThere is 1 keyval per modifier (Nothing, Shift, Alt, Shift+Alt);
|
|
*/
|
|
static guint *keyval_array = NULL;
|
|
+static CFArrayRef global_hotkeys = NULL;
|
|
|
|
static inline UniChar
|
|
macroman2ucs (unsigned char c)
|
|
@@ -806,6 +808,24 @@ gdk_keymap_map_virtual_modifiers (GdkKeymap *keymap,
|
|
return TRUE;
|
|
}
|
|
|
|
+void
|
|
+_gdk_quartz_update_symbolic_hotkeys ()
|
|
+{
|
|
+ _gdk_quartz_release_symbolic_hotkeys ();
|
|
+
|
|
+ CopySymbolicHotKeys (&global_hotkeys);
|
|
+}
|
|
+
|
|
+void
|
|
+_gdk_quartz_release_symbolic_hotkeys ()
|
|
+{
|
|
+ if (global_hotkeys != NULL)
|
|
+ {
|
|
+ CFRelease (global_hotkeys);
|
|
+ global_hotkeys = NULL;
|
|
+ }
|
|
+}
|
|
+
|
|
/* What sort of key event is this? Returns one of
|
|
* GDK_KEY_PRESS, GDK_KEY_RELEASE, GDK_NOTHING (should be ignored)
|
|
*/
|
|
@@ -814,20 +834,19 @@ _gdk_quartz_keys_event_type (NSEvent *event)
|
|
{
|
|
unsigned short keycode = [event keyCode];
|
|
unsigned int flags = [event modifierFlags];
|
|
- CFArrayRef global_keys = NULL;
|
|
unsigned int eventmods = (flags & NSCommandKeyMask ? cmdKey : 0) |
|
|
(flags & NSAlternateKeyMask ? optionKey : 0) |
|
|
(flags & NSControlKeyMask ? controlKey : 0) |
|
|
(flags & NSShiftKeyMask ? shiftKey : 0);
|
|
int i;
|
|
|
|
- if (CopySymbolicHotKeys (&global_keys) == noErr && global_keys != NULL)
|
|
+ if (global_hotkeys != NULL)
|
|
{
|
|
- CFIndex length = CFArrayGetCount (global_keys);
|
|
+ CFIndex length = CFArrayGetCount (global_hotkeys);
|
|
|
|
for (i = 0; i < length; i++)
|
|
{
|
|
- CFDictionaryRef key_info = CFArrayGetValueAtIndex (global_keys, i);
|
|
+ CFDictionaryRef key_info = CFArrayGetValueAtIndex (global_hotkeys, i);
|
|
|
|
CFNumberRef code = CFDictionaryGetValue (key_info, kHISymbolicHotKeyCode);
|
|
CFNumberRef mods = CFDictionaryGetValue (key_info, kHISymbolicHotKeyModifiers);
|
|
@@ -846,8 +865,6 @@ _gdk_quartz_keys_event_type (NSEvent *event)
|
|
}
|
|
}
|
|
|
|
- CFRelease (global_keys);
|
|
-
|
|
switch ([event type])
|
|
{
|
|
case NSKeyDown:
|
|
diff --git a/gdk/quartz/gdkprivate-quartz.h b/gdk/quartz/gdkprivate-quartz.h
|
|
index f8b382d..0b0f66b 100644
|
|
--- a/gdk/quartz/gdkprivate-quartz.h
|
|
+++ b/gdk/quartz/gdkprivate-quartz.h
|
|
@@ -200,6 +200,8 @@ GdkImage *_gdk_quartz_image_copy_to_image (GdkDrawable *drawable,
|
|
gint height);
|
|
|
|
/* Keys */
|
|
+void _gdk_quartz_update_symbolic_hotkeys ();
|
|
+void _gdk_quartz_release_symbolic_hotkeys ();
|
|
GdkEventType _gdk_quartz_keys_event_type (NSEvent *event);
|
|
gboolean _gdk_quartz_keys_is_modifier (guint keycode);
|
|
void _gdk_quartz_synthesize_null_key_event (GdkWindow *window);
|