aboutsummaryrefslogtreecommitdiffhomepage
path: root/cocoa/ScintillaView.mm
diff options
context:
space:
mode:
Diffstat (limited to 'cocoa/ScintillaView.mm')
-rw-r--r--cocoa/ScintillaView.mm32
1 files changed, 22 insertions, 10 deletions
diff --git a/cocoa/ScintillaView.mm b/cocoa/ScintillaView.mm
index 2ca7ed6bc..020fddeae 100644
--- a/cocoa/ScintillaView.mm
+++ b/cocoa/ScintillaView.mm
@@ -165,7 +165,7 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor)
{
// Some initialization for our view.
mCurrentCursor = [[NSCursor arrowCursor] retain];
- mCurrentTrackingRect = 0;
+ trackingArea = nil;
mMarkedTextRange = NSMakeRange(NSNotFound, 0);
[self registerForDraggedTypes: [NSArray arrayWithObjects:
@@ -178,19 +178,31 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor)
//--------------------------------------------------------------------------------------------------
/**
- * When the view is resized we need to update our tracking rectangle and let the backend know.
+ * When the view is resized or scrolled we need to update our tracking area.
+ */
+- (void) updateTrackingAreas
+{
+ if (trackingArea)
+ [self removeTrackingArea:trackingArea];
+
+ int opts = (NSTrackingActiveAlways | NSTrackingInVisibleRect | NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved);
+ trackingArea = [[NSTrackingArea alloc] initWithRect:[self bounds]
+ options:opts
+ owner:self
+ userInfo:nil];
+ [self addTrackingArea: trackingArea];
+ [super updateTrackingAreas];
+}
+
+//--------------------------------------------------------------------------------------------------
+
+/**
+ * When the view is resized we need to let the backend know.
*/
- (void) setFrame: (NSRect) frame
{
[super setFrame: frame];
-
- // Make the content also a tracking rectangle for mouse events.
- if (mCurrentTrackingRect != 0)
- [self removeTrackingRect: mCurrentTrackingRect];
- mCurrentTrackingRect = [self addTrackingRect: [self bounds]
- owner: self
- userData: nil
- assumeInside: YES];
+
mOwner.backend->Resize();
}