From 8afb077865af7897d6a44b6435ba2ee5b4ff0702 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Fri, 14 Mar 2008 19:12:52 +0100 Subject: [PATCH] Ensure mouse cursor is set (again) The former patch did not work 100% and it also hogged CPU. This patch seems to work better and requires no extra CPU. --- src/MacVim/MMTextView.m | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/MacVim/MMTextView.m b/src/MacVim/MMTextView.m index 8a573243a5..6059781a71 100644 --- a/src/MacVim/MMTextView.m +++ b/src/MacVim/MMTextView.m @@ -934,11 +934,6 @@ enum { [data appendBytes:&row length:sizeof(int)]; [data appendBytes:&col length:sizeof(int)]; - // NSTextView wants to set the cursor to an IBeam every now and then. - // Not even Apple's TextLinks example application works, so we set - // "our" cursor on every mouse move. - [self setCursor]; - [[self vimController] sendMessage:MouseMovedMsgID data:data]; //NSLog(@"Moved %d %d\n", col, row); @@ -952,8 +947,14 @@ enum { // NOTE: This event is received even when the window is not key; thus we // have to take care not to enable mouse moved events unless our window is // key. - if ([[self window] isKeyWindow]) + if ([[self window] isKeyWindow]) { [[self window] setAcceptsMouseMovedEvents:YES]; + + // Ensure Vim gets to choose the mouse cursor when it enters over the + // text view, otherwise NSTextView will automatically set its I-Beam + // cursor. + [self setCursor]; + } } - (void)mouseExited:(NSEvent *)event