Removed Autotype damon

Added DDHotKey for Global Hotkey registration
This commit is contained in:
michael starke
2013-09-05 19:46:46 +02:00
parent add5074daa
commit fb88d8d498
6 changed files with 22 additions and 103 deletions

View File

@@ -16,14 +16,12 @@
#import "MPStripLineBreaksTransformer.h"
#import "MPServerDaemon.h"
#import "MPLockDaemon.h"
#import "MPAutotypeDaemon.h"
#import "MPDocumentWindowController.h"
@interface MPAppDelegate () {
@private
MPServerDaemon *serverDaemon;
MPLockDaemon *lockDaemon;
MPAutotypeDaemon *autotypeDaemon;
BOOL _restoredWindows;
BOOL _shouldOpenFile;
}

View File

@@ -1,16 +0,0 @@
//
// MPAutotypeDaemon.h
// MacPass
//
// Created by Michael Starke on 15.08.13.
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface MPAutotypeDaemon : NSObject
- (void)processEvent;
- (void)sendKeystrokes;
@end

View File

@@ -1,79 +0,0 @@
//
// MPAutotypeDaemon.m
// MacPass
//
// Created by Michael Starke on 15.08.13.
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
//
#import "MPAutotypeDaemon.h"
static CGEventRef eventCallback(CGEventTapProxy proxy,
CGEventType type,
CGEventRef event,
void *userInfo) {
MPAutotypeDaemon *daemon = (__bridge MPAutotypeDaemon *)userInfo;
[daemon processEvent];
CGEventFlags flags = CGEventGetFlags(event);
// Update this to use settings?
// Call into deamon via self pointer?
if(flags & kCGEventFlagMaskCommand && flags) {
NSLog(@"CMD +");
}
return event;
}
@interface MPAutotypeDaemon () {
CFMachPortRef _portRef;
}
@end
@implementation MPAutotypeDaemon
- (id)init {
self = [super init];
if(self) {
_portRef = CGEventTapCreate(kCGHIDEventTap,
kCGTailAppendEventTap,
kCGEventTapOptionListenOnly,
CGEventMaskBit(kCGEventKeyDown),
&eventCallback,
(__bridge void*)self);
CFRunLoopSourceRef source = CFMachPortCreateRunLoopSource(CFAllocatorGetDefault(), _portRef, 0);
CFRunLoopAddSource(CFRunLoopGetCurrent(), source, kCFRunLoopCommonModes);
CFRelease(source);
}
return self;
}
- (void)dealloc {
if(_portRef != NULL) {
CFRelease(_portRef);
}
}
- (void)processEvent {
/* TODO */
}
- (void)sendKeystrokes {
/* TODO */
CGEventSourceRef source = CGEventSourceCreate(kCGEventSourceStateCombinedSessionState);
CGEventRef keyDown = CGEventCreateKeyboardEvent(source, 0x12, TRUE);
CGEventSetFlags(keyDown, 0);
CGEventRef keyUp = CGEventCreateKeyboardEvent(source, 0x12, FALSE);
CGEventSetFlags(keyUp, 0);
CGEventPost(kCGAnnotatedSessionEventTap, keyDown);
CGEventPost(kCGAnnotatedSessionEventTap, keyUp);
CFRelease(keyUp);
CFRelease(keyDown);
CFRelease(source);
}
@end