Add 'mousehide' option support

This commit is contained in:
Bjorn Winckler
2008-06-07 15:35:25 +02:00
parent 321fdf61aa
commit 0ea7546c7c
3 changed files with 27 additions and 8 deletions
+13 -4
View File
@@ -67,6 +67,7 @@ enum {
- (void)updateAtsuStyles;
- (void)dispatchKeyEvent:(NSEvent *)event;
- (void)sendKeyDown:(const char *)chars length:(int)len modifiers:(int)flags;
- (void)hideMouseCursor;
- (MMWindowController *)windowController;
- (MMVimController *)vimController;
@end
@@ -333,8 +334,7 @@ enum {
}
}
// TODO: Support 'mousehide' (check p_mh)
[NSCursor setHiddenUntilMouseMoves:YES];
[self hideMouseCursor];
// NOTE: 'string' is either an NSString or an NSAttributedString. Since we
// do not support attributes, simply pass the corresponding NSString in the
@@ -901,14 +901,23 @@ enum {
[data appendBytes:&len length:sizeof(int)];
[data appendBytes:chars length:len];
// TODO: Support 'mousehide' (check p_mh)
[NSCursor setHiddenUntilMouseMoves:YES];
[self hideMouseCursor];
//NSLog(@"%s len=%d chars=0x%x", _cmd, len, chars[0]);
[[self vimController] sendMessage:KeyDownMsgID data:data];
}
}
- (void)hideMouseCursor
{
// Check 'mousehide' option
id mh = [[[self vimController] vimState] objectForKey:@"p_mh"];
if (mh && ![mh boolValue])
[NSCursor setHiddenUntilMouseMoves:NO];
else
[NSCursor setHiddenUntilMouseMoves:YES];
}
- (MMWindowController *)windowController
{
id windowController = [[self window] windowController];
+1
View File
@@ -1486,6 +1486,7 @@ static NSString *MMSymlinkWarningString =
NSDictionary *vimState = [NSDictionary dictionaryWithObjectsAndKeys:
[[NSFileManager defaultManager] currentDirectoryPath], @"pwd",
[NSNumber numberWithInt:p_mh], @"p_mh",
nil];
[self queueMessage:SetVimStateMsgID data:[vimState dictionaryAsData]];
+13 -4
View File
@@ -57,6 +57,7 @@ enum {
- (void)startDragTimerWithInterval:(NSTimeInterval)t;
- (void)dragTimerFired:(NSTimer *)timer;
- (void)sendKeyDown:(const char *)chars length:(int)len modifiers:(int)flags;
- (void)hideMouseCursor;
@end
@@ -566,8 +567,7 @@ enum {
}
}
// TODO: Support 'mousehide' (check p_mh)
[NSCursor setHiddenUntilMouseMoves:YES];
[self hideMouseCursor];
// NOTE: 'string' is either an NSString or an NSAttributedString. Since we
// do not support attributes, simply pass the corresponding NSString in the
@@ -1377,12 +1377,21 @@ enum {
[data appendBytes:&len length:sizeof(int)];
[data appendBytes:chars length:len];
// TODO: Support 'mousehide' (check p_mh)
[NSCursor setHiddenUntilMouseMoves:YES];
[self hideMouseCursor];
//NSLog(@"%s len=%d chars=0x%x", _cmd, len, chars[0]);
[[self vimController] sendMessage:KeyDownMsgID data:data];
}
}
- (void)hideMouseCursor
{
// Check 'mousehide' option
id mh = [[[self vimController] vimState] objectForKey:@"p_mh"];
if (mh && ![mh boolValue])
[NSCursor setHiddenUntilMouseMoves:NO];
else
[NSCursor setHiddenUntilMouseMoves:YES];
}
@end // MMTextView (Private)