Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorDamien Plisson <damien.plisson@yahoo.fr>2010-02-16 16:09:03 +0300
committerDamien Plisson <damien.plisson@yahoo.fr>2010-02-16 16:09:03 +0300
commit62e7e0ce77820829f796c245f1abe893043fafa2 (patch)
treefd34eeffb89ae37def96238518809e865e425843 /intern
parent046bf7a6a1c7cec01ec819796b67c510dadb5056 (diff)
Cocoa: bugfix [#21158] fix modifiers keys status upon gaining focus
10.6 new function to get modifiers flags status asynchronously returns erroneous value when application gets focus after a virtual desktop switch (Spaces). Use legacy method to retrieve the modifiers flags status sent with the last event. Works as at least the "focus gained" event is sent before this query. Bonus: should work also on pre-10.6!
Diffstat (limited to 'intern')
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.mm27
1 files changed, 1 insertions, 26 deletions
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index 0a5445b4811..15ea3730c6e 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -397,17 +397,6 @@ enum {
#endif
@end
-@interface NSEvent(SnowLeopardEvents)
-/* modifier keys currently down. This returns the state of devices combined
- with synthesized events at the moment, independent of which events
- have been delivered via the event stream. */
-#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
-+ (unsigned int)modifierFlags; //NSUInteger is defined only from 10.5
-#else
-+ (NSUInteger)modifierFlags;
-#endif
-@end
-
#endif
@@ -945,21 +934,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleApplicationBecomeActiveEvent()
}
else m_needDelayedApplicationBecomeActiveEventProcessing = false;
-#ifdef MAC_OS_X_VERSION_10_6
- modifiers = [NSEvent modifierFlags];
-#else
- //If build against an older SDK, check if running on 10.6 to use the correct function
- if ([NSEvent respondsToSelector:@selector(modifierFlags)]) {
- modifiers = [NSEvent modifierFlags];
- }
- else {
- //TODO: need to find a better workaround for the missing cocoa "getModifierFlag" function in 10.4/10.5
- modifiers = 0;
- }
-#endif
-
- /* Discard erroneous 10.6 modifiers values reported when switching back from spaces */
- if ((modifiers & NSDeviceIndependentModifierFlagsMask) == 0xb00000) modifiers = 0;
+ modifiers = [[[NSApplication sharedApplication] currentEvent] modifierFlags];
if ((modifiers & NSShiftKeyMask) != (m_modifierMask & NSShiftKeyMask)) {
pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & NSShiftKeyMask)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyLeftShift) );