Cocoa: Fix issue with application sandboxing

Fixes #816.
Closes #882.
This commit is contained in:
Sergey Tikhomirov 2016-10-14 17:56:45 +03:00 committed by Camilla Löwy
parent be4eb6fb2b
commit 11a2413476
2 changed files with 5 additions and 13 deletions

View File

@ -247,9 +247,6 @@ static GLFWbool initializeTIS(void)
CFStringRef* kPropertyUnicodeKeyLayoutData = CFStringRef* kPropertyUnicodeKeyLayoutData =
CFBundleGetDataPointerForName(_glfw.ns.tis.bundle, CFBundleGetDataPointerForName(_glfw.ns.tis.bundle,
CFSTR("kTISPropertyUnicodeKeyLayoutData")); CFSTR("kTISPropertyUnicodeKeyLayoutData"));
CFStringRef* kNotifySelectedKeyboardInputSourceChanged =
CFBundleGetDataPointerForName(_glfw.ns.tis.bundle,
CFSTR("kTISNotifySelectedKeyboardInputSourceChanged"));
_glfw.ns.tis.CopyCurrentKeyboardLayoutInputSource = _glfw.ns.tis.CopyCurrentKeyboardLayoutInputSource =
CFBundleGetFunctionPointerForName(_glfw.ns.tis.bundle, CFBundleGetFunctionPointerForName(_glfw.ns.tis.bundle,
CFSTR("TISCopyCurrentKeyboardLayoutInputSource")); CFSTR("TISCopyCurrentKeyboardLayoutInputSource"));
@ -261,7 +258,6 @@ static GLFWbool initializeTIS(void)
CFSTR("LMGetKbdType")); CFSTR("LMGetKbdType"));
if (!kPropertyUnicodeKeyLayoutData || if (!kPropertyUnicodeKeyLayoutData ||
!kNotifySelectedKeyboardInputSourceChanged ||
!TISCopyCurrentKeyboardLayoutInputSource || !TISCopyCurrentKeyboardLayoutInputSource ||
!TISGetInputSourceProperty || !TISGetInputSourceProperty ||
!LMGetKbdType) !LMGetKbdType)
@ -273,8 +269,6 @@ static GLFWbool initializeTIS(void)
_glfw.ns.tis.kPropertyUnicodeKeyLayoutData = _glfw.ns.tis.kPropertyUnicodeKeyLayoutData =
*kPropertyUnicodeKeyLayoutData; *kPropertyUnicodeKeyLayoutData;
_glfw.ns.tis.kNotifySelectedKeyboardInputSourceChanged =
*kNotifySelectedKeyboardInputSourceChanged;
return updateUnicodeDataNS(); return updateUnicodeDataNS();
} }
@ -301,10 +295,10 @@ int _glfwPlatformInit(void)
_glfw.ns.autoreleasePool = [[NSAutoreleasePool alloc] init]; _glfw.ns.autoreleasePool = [[NSAutoreleasePool alloc] init];
_glfw.ns.listener = [[GLFWLayoutListener alloc] init]; _glfw.ns.listener = [[GLFWLayoutListener alloc] init];
[[NSDistributedNotificationCenter defaultCenter] [[NSNotificationCenter defaultCenter]
addObserver:_glfw.ns.listener addObserver:_glfw.ns.listener
selector:@selector(selectedKeyboardInputSourceChanged:) selector:@selector(selectedKeyboardInputSourceChanged:)
name:(__bridge NSString*)kTISNotifySelectedKeyboardInputSourceChanged name:NSTextInputContextKeyboardSelectionDidChangeNotification
object:nil]; object:nil];
#if defined(_GLFW_USE_CHDIR) #if defined(_GLFW_USE_CHDIR)
@ -355,11 +349,11 @@ void _glfwPlatformTerminate(void)
if (_glfw.ns.listener) if (_glfw.ns.listener)
{ {
[[NSDistributedNotificationCenter defaultCenter] [[NSNotificationCenter defaultCenter]
removeObserver:_glfw.ns.listener removeObserver:_glfw.ns.listener
name:(__bridge NSString*)kTISNotifySelectedKeyboardInputSourceChanged name:NSTextInputContextKeyboardSelectionDidChangeNotification
object:nil]; object:nil];
[[NSDistributedNotificationCenter defaultCenter] [[NSNotificationCenter defaultCenter]
removeObserver:_glfw.ns.listener]; removeObserver:_glfw.ns.listener];
[_glfw.ns.listener release]; [_glfw.ns.listener release];
_glfw.ns.listener = nil; _glfw.ns.listener = nil;

View File

@ -70,7 +70,6 @@ typedef VkResult (APIENTRY *PFN_vkCreateMacOSSurfaceMVK)(VkInstance,const VkMacO
// HIToolbox.framework pointer typedefs // HIToolbox.framework pointer typedefs
#define kTISPropertyUnicodeKeyLayoutData _glfw.ns.tis.kPropertyUnicodeKeyLayoutData #define kTISPropertyUnicodeKeyLayoutData _glfw.ns.tis.kPropertyUnicodeKeyLayoutData
#define kTISNotifySelectedKeyboardInputSourceChanged _glfw.ns.tis.kNotifySelectedKeyboardInputSourceChanged
typedef TISInputSourceRef (*PFN_TISCopyCurrentKeyboardLayoutInputSource)(void); typedef TISInputSourceRef (*PFN_TISCopyCurrentKeyboardLayoutInputSource)(void);
#define TISCopyCurrentKeyboardLayoutInputSource _glfw.ns.tis.CopyCurrentKeyboardLayoutInputSource #define TISCopyCurrentKeyboardLayoutInputSource _glfw.ns.tis.CopyCurrentKeyboardLayoutInputSource
typedef void* (*PFN_TISGetInputSourceProperty)(TISInputSourceRef,CFStringRef); typedef void* (*PFN_TISGetInputSourceProperty)(TISInputSourceRef,CFStringRef);
@ -125,7 +124,6 @@ typedef struct _GLFWlibraryNS
PFN_TISGetInputSourceProperty GetInputSourceProperty; PFN_TISGetInputSourceProperty GetInputSourceProperty;
PFN_LMGetKbdType GetKbdType; PFN_LMGetKbdType GetKbdType;
CFStringRef kPropertyUnicodeKeyLayoutData; CFStringRef kPropertyUnicodeKeyLayoutData;
CFStringRef kNotifySelectedKeyboardInputSourceChanged;
} tis; } tis;
} _GLFWlibraryNS; } _GLFWlibraryNS;