aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2018-11-05 04:47:47 +0100
committerTeddy Wing2018-11-05 04:47:47 +0100
commit2c4c9e9e750cfe8c78fc15e07a405cfeef46d5c8 (patch)
treed4f0f46639e19c68c95809a87cc1a100e05165a3
parentdb7b1896278cc4e0ff3e289b73d5e76d6ac9c8ee (diff)
downloadDomeKey-2c4c9e9e750cfe8c78fc15e07a405cfeef46d5c8.tar.bz2
Remove lib/char_to_key_code.*
We don't need these functions any more now that key simulation is handled by the Rust library. The files can be safely removed.
-rw-r--r--DomeKey.xcodeproj/project.pbxproj6
-rw-r--r--lib/char_to_key_code.h17
-rw-r--r--lib/char_to_key_code.m70
3 files changed, 0 insertions, 93 deletions
diff --git a/DomeKey.xcodeproj/project.pbxproj b/DomeKey.xcodeproj/project.pbxproj
index 3a36d4a..58ec3a0 100644
--- a/DomeKey.xcodeproj/project.pbxproj
+++ b/DomeKey.xcodeproj/project.pbxproj
@@ -16,7 +16,6 @@
D160C2A12118EF9D007D1B50 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D160C2A02118EF9D007D1B50 /* main.m */; };
D18255B12180018C00ABC1E0 /* LicenseHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = D18255B02180018C00ABC1E0 /* LicenseHandler.m */; };
D1C80CA021877E8200011088 /* Sounds.m in Sources */ = {isa = PBXBuildFile; fileRef = D1C80C9F21877E8200011088 /* Sounds.m */; };
- D1E1020821345E2300B2CA29 /* char_to_key_code.m in Sources */ = {isa = PBXBuildFile; fileRef = D1E1020721345E2200B2CA29 /* char_to_key_code.m */; };
D1E1020B21350BAD00B2CA29 /* libdome_key_map.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D1E1020A21350BAD00B2CA29 /* libdome_key_map.a */; };
D1EAA7A421803BB300A0AC35 /* XDG.m in Sources */ = {isa = PBXBuildFile; fileRef = D1EAA7A321803BB300A0AC35 /* XDG.m */; };
/* End PBXBuildFile section */
@@ -88,8 +87,6 @@
D18255B02180018C00ABC1E0 /* LicenseHandler.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LicenseHandler.m; sourceTree = "<group>"; };
D1C80C9E21877E8200011088 /* Sounds.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Sounds.h; sourceTree = "<group>"; };
D1C80C9F21877E8200011088 /* Sounds.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Sounds.m; sourceTree = "<group>"; };
- D1E1020721345E2200B2CA29 /* char_to_key_code.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = char_to_key_code.m; path = lib/char_to_key_code.m; sourceTree = SOURCE_ROOT; };
- D1E102092134611800B2CA29 /* char_to_key_code.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = char_to_key_code.h; path = lib/char_to_key_code.h; sourceTree = SOURCE_ROOT; };
D1E1020A21350BAD00B2CA29 /* libdome_key_map.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libdome_key_map.a; path = "lib/dome-key-map/target/debug/libdome_key_map.a"; sourceTree = "<group>"; };
D1E1020C21350D4100B2CA29 /* dome_key_map.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = dome_key_map.h; path = "lib/dome-key-map/dome_key_map.h"; sourceTree = SOURCE_ROOT; };
D1EAA7A221803BB300A0AC35 /* XDG.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XDG.h; sourceTree = "<group>"; };
@@ -173,8 +170,6 @@
children = (
D11CD067217FECD9001FCB97 /* AquaticPrime.c */,
D11CD06C217FECD9001FCB97 /* AquaticPrime.h */,
- D1E102092134611800B2CA29 /* char_to_key_code.h */,
- D1E1020721345E2200B2CA29 /* char_to_key_code.m */,
D1E1020C21350D4100B2CA29 /* dome_key_map.h */,
);
name = lib;
@@ -283,7 +278,6 @@
D110C9482122E2D80094F963 /* HeadphoneKey.m in Sources */,
D160C2A12118EF9D007D1B50 /* main.m in Sources */,
D11CD06D217FECD9001FCB97 /* AquaticPrime.c in Sources */,
- D1E1020821345E2300B2CA29 /* char_to_key_code.m in Sources */,
D11184622125206E00961687 /* AppDelegate.m in Sources */,
D18255B12180018C00ABC1E0 /* LicenseHandler.m in Sources */,
);
diff --git a/lib/char_to_key_code.h b/lib/char_to_key_code.h
deleted file mode 100644
index 40c0c10..0000000
--- a/lib/char_to_key_code.h
+++ /dev/null
@@ -1,17 +0,0 @@
-//
-// char_to_key_code.h
-// DomeKey
-//
-// Created by tw on 8/27/18.
-// Copyright © 2018 tw. All rights reserved.
-//
-
-#ifndef char_to_key_code_h
-#define char_to_key_code_h
-
-#import <Carbon/Carbon.h>
-
-NSString* keyCodeToString(CGKeyCode keyCode);
-NSNumber* charToKeyCode(const char c);
-
-#endif /* char_to_key_code_h */
diff --git a/lib/char_to_key_code.m b/lib/char_to_key_code.m
deleted file mode 100644
index ab4da15..0000000
--- a/lib/char_to_key_code.m
+++ /dev/null
@@ -1,70 +0,0 @@
-#import "char_to_key_code.h"
-
-// Théo Winterhalter
-// https://stackoverflow.com/users/1275975/th%c3%a9o-winterhalter
-// https://stackoverflow.com/questions/1918841/how-to-convert-ascii-character-to-cgkeycode/33584460#33584460
-
-NSString* keyCodeToString(CGKeyCode keyCode)
-{
- TISInputSourceRef currentKeyboard = TISCopyCurrentKeyboardInputSource();
- CFDataRef uchr =
- (CFDataRef)TISGetInputSourceProperty(currentKeyboard,
- kTISPropertyUnicodeKeyLayoutData);
- const UCKeyboardLayout *keyboardLayout =
- (const UCKeyboardLayout*)CFDataGetBytePtr(uchr);
-
- if(keyboardLayout)
- {
- UInt32 deadKeyState = 0;
- UniCharCount maxStringLength = 255;
- UniCharCount actualStringLength = 0;
- UniChar unicodeString[maxStringLength];
-
- OSStatus status = UCKeyTranslate(keyboardLayout,
- keyCode, kUCKeyActionDown, 0,
- LMGetKbdType(), 0,
- &deadKeyState,
- maxStringLength,
- &actualStringLength, unicodeString);
-
- if (actualStringLength == 0 && deadKeyState)
- {
- status = UCKeyTranslate(keyboardLayout,
- kVK_Space, kUCKeyActionDown, 0,
- LMGetKbdType(), 0,
- &deadKeyState,
- maxStringLength,
- &actualStringLength, unicodeString);
- }
- if(actualStringLength > 0 && status == noErr)
- return [[NSString stringWithCharacters:unicodeString
- length:(NSUInteger)actualStringLength] lowercaseString];
- }
-
- return nil;
-}
-
-NSNumber* charToKeyCode(const char c)
-{
- static NSMutableDictionary* dict = nil;
-
- if (dict == nil)
- {
- dict = [NSMutableDictionary dictionary];
-
- // For every keyCode
- int i;
- for (i = 0; i < 128; ++i)
- {
- NSString* str = keyCodeToString((CGKeyCode)i);
- if(str != nil && ![str isEqualToString:@""])
- {
- [dict setObject:[NSNumber numberWithInt:i] forKey:str];
- }
- }
- }
-
- NSString * keyChar = [NSString stringWithFormat:@"%c" , c];
-
- return [dict objectForKey:keyChar];
-}