Skip to content
Snippets Groups Projects
Commit 14d45e33 authored by George Nachman's avatar George Nachman
Browse files

Adhoc build 3.0.20161102_101724

parent de3f4276
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -6359,7 +6359,7 @@
DevelopmentTeam = H7V7XYVQ7D;
};
874206460564169600CFC3F1 = {
DevelopmentTeam = H7V7XYVQ7D;
DevelopmentTeam = CMC4EL7UVS;
};
A6C7603F1B45C4CF00E3C992 = {
DevelopmentTeam = H7V7XYVQ7D;
Loading
Loading
@@ -8060,7 +8060,7 @@
CODE_SIGN_IDENTITY = "Mac Developer";
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = YES;
DEVELOPMENT_TEAM = H7V7XYVQ7D;
DEVELOPMENT_TEAM = CMC4EL7UVS;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)",
Loading
Loading
@@ -9206,7 +9206,7 @@
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = H7V7XYVQ7D;
DEVELOPMENT_TEAM = CMC4EL7UVS;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)",
Loading
Loading
@@ -9275,7 +9275,7 @@
CODE_SIGN_IDENTITY = "Mac Developer";
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = YES;
DEVELOPMENT_TEAM = H7V7XYVQ7D;
DEVELOPMENT_TEAM = CMC4EL7UVS;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)",
Loading
Loading
@@ -9340,7 +9340,7 @@
CLANG_WARN_INT_CONVERSION = YES;
CODE_SIGN_IDENTITY = "Mac Developer";
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = H7V7XYVQ7D;
DEVELOPMENT_TEAM = CMC4EL7UVS;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)",
Loading
Loading
Loading
Loading
@@ -69,6 +69,7 @@ NSString *const iTermEventTapEventTappedNotification = @"iTermEventTapEventTappe
#pragma mark - Accessors
 
- (void)setEnabled:(BOOL)enabled {
NSLog(@"iTermEventTap setEnabled:%@", @(enabled));
if (enabled && !self.isEnabled) {
[self startEventTap];
} else if (!enabled && self.isEnabled) {
Loading
Loading
@@ -101,6 +102,7 @@ static CGEventRef OnTappedEvent(CGEventTapProxy proxy,
CGEventType type,
CGEventRef event,
void *refcon) {
NSLog(@"Event tap running");
if (type == kCGEventTapDisabledByTimeout || type == kCGEventTapDisabledByUserInput) {
ELog(@"Event tap disabled (type is %@)", @(type));
if ([[iTermEventTap sharedInstance] isEnabled]) {
Loading
Loading
@@ -110,10 +112,12 @@ static CGEventRef OnTappedEvent(CGEventTapProxy proxy,
return NULL;
}
if (![[[iTermApplication sharedApplication] delegate] workspaceSessionActive]) {
NSLog(@"Workspace session not active");
return event;
}
if (![[iTermEventTap sharedInstance] userIsActive]) {
NSLog(@"User not active");
// Fast user switching has switched to another user, don't do any remapping.
DLog(@"** not doing any remapping for event %@", [NSEvent eventWithCGEvent:event]);
return event;
Loading
Loading
@@ -121,9 +125,11 @@ static CGEventRef OnTappedEvent(CGEventTapProxy proxy,
id<iTermEventTapRemappingDelegate> delegate = [[iTermEventTap sharedInstance] remappingDelegate];
if (delegate) {
NSLog(@"Calling delegate");
event = [delegate remappedEventFromEventTappedWithType:type event:event];
}
NSLog(@"Notifying observers");
[[iTermEventTap sharedInstance] postEventToObservers:event type:type];
 
return event;
Loading
Loading
@@ -168,6 +174,7 @@ static CGEventRef OnTappedEvent(CGEventTapProxy proxy,
}
 
- (void)stopEventTap {
NSLog(@"Stop event tap %@", [NSThread callStackSymbols]);
assert(self.isEnabled);
CFRunLoopRemoveSource(CFRunLoopGetCurrent(),
_runLoopEventSource,
Loading
Loading
@@ -178,6 +185,7 @@ static CGEventRef OnTappedEvent(CGEventTapProxy proxy,
}
 
- (BOOL)startEventTap {
NSLog(@"Start event tap");
assert(!self.isEnabled);
 
DLog(@"Register event tap.");
Loading
Loading
@@ -188,19 +196,20 @@ static CGEventRef OnTappedEvent(CGEventTapProxy proxy,
(CGEventTapCallBack)OnTappedEvent,
self);
if (!_eventTapMachPort) {
NSLog(@"CGEventTapCreate failed");
return NO;
}
 
DLog(@"Create runloop source");
NSLog(@"Create runloop source");
_runLoopEventSource = CFMachPortCreateRunLoopSource(NULL, _eventTapMachPort, 0);
if (_runLoopEventSource == NULL) {
ELog(@"CFMachPortCreateRunLoopSource failed.");
NSLog(@"CFMachPortCreateRunLoopSource failed.");
CFRelease(_eventTapMachPort);
_eventTapMachPort = NULL;
return NO;
}
 
DLog(@"Adding run loop source.");
NSLog(@"Adding run loop source.");
// Get the CFRunLoop primitive for the Carbon Main Event Loop, and add the new event souce
CFRunLoopAddSource(CFRunLoopGetCurrent(),
_runLoopEventSource,
Loading
Loading
Loading
Loading
@@ -989,6 +989,7 @@ exit:
{
// This function copied from cmd-key happy. See copyright notice at top.
CGEventFlags flags = CGEventGetFlags(cgEvent);
NSLog(@"Performing remapping. On input CGEventFlags=%@", @(flags));
const CGEventFlags origFlags = flags;
CGEventFlags andMask = -1;
CGEventFlags orMask = 0;
Loading
Loading
@@ -1031,6 +1032,7 @@ exit:
orMask |= [self _nxMaskForRightControlKey];
}
}
NSLog(@"On output CGEventFlags=%@", @((flags & andMask) | orMask));
 
CGEventSetFlags(cgEvent, (flags & andMask) | orMask);
return cgEvent;
Loading
Loading
Loading
Loading
@@ -69,9 +69,11 @@
#pragma mark - Private
 
- (void)beginRemappingModifiers {
NSLog(@"Begin remapping modifiers");
[[iTermEventTap sharedInstance] setRemappingDelegate:self];
if (![[iTermEventTap sharedInstance] isEnabled]) {
NSLog(@"The event tap is NOT enabled");
if (IsMavericksOrLater()) {
[self requestAccessibilityPermissionMavericks];
return;
Loading
Loading
@@ -99,6 +101,7 @@
}
 
- (void)requestAccessibilityPermissionMavericks {
NSLog(@"Requesting mavericks accessibility permission");
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
NSDictionary *options = @{ (NSString *)kAXTrustedCheckOptionPrompt: @YES };
Loading
Loading
@@ -122,11 +125,14 @@
#pragma mark - iTermEventTapRemappingDelegate
 
- (CGEventRef)remappedEventFromEventTappedWithType:(CGEventType)type event:(CGEventRef)event {
NSLog(@"Modifier remapper got an event");
if ([NSApp isActive]) {
NSLog(@"App is active, performing remapping");
// Remap modifier keys only while iTerm2 is active; otherwise you could just use the
// OS's remap feature.
return [self eventByRemappingEvent:event];
} else {
NSLog(@"App not active");
return event;
}
}
Loading
Loading
@@ -134,6 +140,7 @@
// Only called when the app is active.
- (CGEventRef)eventByRemappingEvent:(CGEventRef)event {
NSEvent *cocoaEvent = [NSEvent eventWithCGEvent:event];
NSLog(@"Remapping event %@", cocoaEvent);
iTermShortcutInputView *shortcutView = nil;
NSResponder *firstResponder = [[NSApp keyWindow] firstResponder];
if ([firstResponder isKindOfClass:[iTermShortcutInputView class]]) {
Loading
Loading
@@ -141,6 +148,7 @@
}
 
if (shortcutView.disableKeyRemapping) {
NSLog(@"Shortcut view is active so return nil");
// Send keystroke directly to preference panel when setting do-not-remap for a key; for
// system keys, NSApp sendEvent: is never called so this is the last chance.
[shortcutView handleShortcutEvent:cocoaEvent];
Loading
Loading
@@ -149,14 +157,17 @@
 
switch ([self boundActionForEvent:cocoaEvent]) {
case KEY_ACTION_REMAP_LOCALLY:
NSLog(@"Calling sendEvent:");
[iTermKeyBindingMgr remapModifiersInCGEvent:event];
[NSApp sendEvent:[NSEvent eventWithCGEvent:event]];
return nil;
 
case KEY_ACTION_DO_NOT_REMAP_MODIFIERS:
NSLog(@"Action is do not remap");
return event;
 
default:
NSLog(@"Remapping as usual");
[iTermKeyBindingMgr remapModifiersInCGEvent:event];
return event;
}
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment