Fix HotKey Modifier hashing, which has always occupied the upper 16 bits of the value since as early as 2003.

CQTexperiment
Christopher Snowhill 2016-10-10 22:30:52 -07:00
parent 0c3d9755fc
commit 291e2ae676
1 changed files with 2 additions and 2 deletions

View File

@ -87,7 +87,7 @@ static BOOL isEqualHashFunction( NSHashTable * aTable, const void * aFirstHotKey
static NSString * describeHashFunction( NSHashTable * aTable, const void * aHotKeyEvent ); static NSString * describeHashFunction( NSHashTable * aTable, const void * aHotKeyEvent );
#endif #endif
static UInt32 _idForCharacterAndModifer( unichar aCharacter, NSUInteger aModFlags ) { return (UInt32)aCharacter | (UInt32)(aModFlags<<16); } static UInt32 _idForCharacterAndModifer( unichar aCharacter, NSUInteger aModFlags ) { return (UInt32)aCharacter | (UInt32)(aModFlags); }
#if 0 #if 0
static void _getCharacterAndModiferForId( UInt32 anId, unichar *aCharacter, NSUInteger *aModFlags ) static void _getCharacterAndModiferForId( UInt32 anId, unichar *aCharacter, NSUInteger *aModFlags )
@ -643,7 +643,7 @@ struct HotKeyMappingEntry
return [super isEqual:anObject] || ([anObject isKindOfClass:[self class]] == YES && [self keyCode] == [(NDHotKeyEvent*)anObject keyCode] && [self modifierFlags] == [anObject modifierFlags]); return [super isEqual:anObject] || ([anObject isKindOfClass:[self class]] == YES && [self keyCode] == [(NDHotKeyEvent*)anObject keyCode] && [self modifierFlags] == [anObject modifierFlags]);
} }
- (NSUInteger)hash { return (NSUInteger)self.keyCharacter | (self.modifierFlags<<16); } - (NSUInteger)hash { return (NSUInteger)self.keyCharacter | (self.modifierFlags); }
- (NSString *)description - (NSString *)description
{ {