From 206f3adf4f460cf9969c62c2d7f6ed7cc0e6029f Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sun, 5 Jun 2011 10:13:43 +1000 Subject: Respond to window deactivation by hiding caret. --- cocoa/ScintillaView.mm | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'cocoa/ScintillaView.mm') diff --git a/cocoa/ScintillaView.mm b/cocoa/ScintillaView.mm index 1748cc40d..85eb81a1c 100644 --- a/cocoa/ScintillaView.mm +++ b/cocoa/ScintillaView.mm @@ -794,6 +794,17 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa [self setGeneralProperty: SCI_INDICSETUNDER parameter: INPUT_INDICATOR value: 1]; [self setGeneralProperty: SCI_INDICSETSTYLE parameter: INPUT_INDICATOR value: INDIC_PLAIN]; [self setGeneralProperty: SCI_INDICSETALPHA parameter: INPUT_INDICATOR value: 100]; + + NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; + [center addObserver:self + selector:@selector(applicationDidResignActive:) + name:NSApplicationDidResignActiveNotification + object:nil]; + + [center addObserver:self + selector:@selector(applicationDidBecomeActive:) + name:NSApplicationDidBecomeActiveNotification + object:nil]; } return self; } @@ -809,6 +820,18 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa //-------------------------------------------------------------------------------------------------- +- (void) applicationDidResignActive: (NSNotification *)note { + mBackend->ActiveStateChanged(false); +} + +//-------------------------------------------------------------------------------------------------- + +- (void) applicationDidBecomeActive: (NSNotification *)note { + mBackend->ActiveStateChanged(true); +} + +//-------------------------------------------------------------------------------------------------- + - (void) viewDidMoveToWindow { [super viewDidMoveToWindow]; -- cgit v1.2.3