diff options
-rw-r--r-- | DomeKey.xcodeproj/project.pbxproj | 6 | ||||
-rw-r--r-- | DomeKey/HeadphoneKey.h | 1 | ||||
-rw-r--r-- | DomeKey/KeyboardSimulator.h | 16 | ||||
-rw-r--r-- | DomeKey/KeyboardSimulator.m | 37 |
4 files changed, 0 insertions, 60 deletions
diff --git a/DomeKey.xcodeproj/project.pbxproj b/DomeKey.xcodeproj/project.pbxproj index fc25343..dbbb85a 100644 --- a/DomeKey.xcodeproj/project.pbxproj +++ b/DomeKey.xcodeproj/project.pbxproj @@ -14,7 +14,6 @@ D131C4D321663B6500801267 /* Mappings.m in Sources */ = {isa = PBXBuildFile; fileRef = D131C4D221663B6500801267 /* Mappings.m */; }; D160C2A12118EF9D007D1B50 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D160C2A02118EF9D007D1B50 /* main.m */; }; D18255B12180018C00ABC1E0 /* LicenseHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = D18255B02180018C00ABC1E0 /* LicenseHandler.m */; }; - D1E101FE2133FA0300B2CA29 /* KeyboardSimulator.m in Sources */ = {isa = PBXBuildFile; fileRef = D1E101FD2133FA0300B2CA29 /* KeyboardSimulator.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 */; }; @@ -84,8 +83,6 @@ D160C31521197983007D1B50 /* DDHidLib.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = DDHidLib.xcodeproj; path = lib/DDHidLib/DDHidLib.xcodeproj; sourceTree = "<group>"; }; D18255AF2180018C00ABC1E0 /* LicenseHandler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LicenseHandler.h; sourceTree = "<group>"; }; D18255B02180018C00ABC1E0 /* LicenseHandler.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LicenseHandler.m; sourceTree = "<group>"; }; - D1E101FC2133FA0300B2CA29 /* KeyboardSimulator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KeyboardSimulator.h; sourceTree = "<group>"; }; - D1E101FD2133FA0300B2CA29 /* KeyboardSimulator.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KeyboardSimulator.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>"; }; @@ -132,8 +129,6 @@ D131C4D121663B6500801267 /* Mappings.h */, D131C4D221663B6500801267 /* Mappings.m */, D110C9472122E2D80094F963 /* HeadphoneKey.m */, - D1E101FC2133FA0300B2CA29 /* KeyboardSimulator.h */, - D1E101FD2133FA0300B2CA29 /* KeyboardSimulator.m */, D160C2A02118EF9D007D1B50 /* main.m */, D11184602125206E00961687 /* AppDelegate.h */, D11184612125206E00961687 /* AppDelegate.m */, @@ -281,7 +276,6 @@ D1E1020821345E2300B2CA29 /* char_to_key_code.m in Sources */, D11184622125206E00961687 /* AppDelegate.m in Sources */, D18255B12180018C00ABC1E0 /* LicenseHandler.m in Sources */, - D1E101FE2133FA0300B2CA29 /* KeyboardSimulator.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/DomeKey/HeadphoneKey.h b/DomeKey/HeadphoneKey.h index f6533c3..0ef6fe7 100644 --- a/DomeKey/HeadphoneKey.h +++ b/DomeKey/HeadphoneKey.h @@ -11,7 +11,6 @@ #import <DDHidLib/DDHidAppleMikey.h> #import "dome_key_map.h" -#import "KeyboardSimulator.h" typedef enum KeyPress : BOOL { KeyPressDown = YES, diff --git a/DomeKey/KeyboardSimulator.h b/DomeKey/KeyboardSimulator.h deleted file mode 100644 index aca600c..0000000 --- a/DomeKey/KeyboardSimulator.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// KeyboardSimulator.h -// DomeKey -// -// Created by tw on 8/27/18. -// Copyright © 2018 tw. All rights reserved. -// - -#import <Foundation/Foundation.h> -#import "char_to_key_code.h" - -@interface KeyboardSimulator : NSObject - -+ (void)simpleKeyPressWithKey:(const char)aChar; - -@end diff --git a/DomeKey/KeyboardSimulator.m b/DomeKey/KeyboardSimulator.m deleted file mode 100644 index 6e9d38e..0000000 --- a/DomeKey/KeyboardSimulator.m +++ /dev/null @@ -1,37 +0,0 @@ -// -// KeyboardSimulator.m -// DomeKey -// -// Created by tw on 8/27/18. -// Copyright © 2018 tw. All rights reserved. -// - -#import "KeyboardSimulator.h" - -@implementation KeyboardSimulator - -+ (void)simpleKeyPressWithKey:(const char)aChar -{ - CGEventSourceRef source = CGEventSourceCreate( - kCGEventSourceStateHIDSystemState - ); - - NSNumber *key_number = charToKeyCode(aChar); - if (key_number == nil) { - NSLog(@"charToKeyCode returned nil"); - return; - } - CGKeyCode key_code = (CGKeyCode)[key_number intValue]; - - CGEventRef key_down = CGEventCreateKeyboardEvent(source, key_code, true); - CGEventRef key_up = CGEventCreateKeyboardEvent(source, key_code, false); - - CGEventPost(kCGHIDEventTap, key_down); - CGEventPost(kCGHIDEventTap, key_up); - - CFRelease(key_down); - CFRelease(key_up); - CFRelease(source); -} - -@end |