Skip to content

Commit

Permalink
For macOS platform, fixes mouse tracking (entered, exited, moved), wh…
Browse files Browse the repository at this point in the history
…ich got lost since macOS 10.5 where NSTrackingArea was introduced.
  • Loading branch information
marceltaeumel committed Mar 25, 2022
1 parent c119f5b commit 68343d4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions platforms/iOS/vm/OSX/sqSqueakOSXCGView.m
Expand Up @@ -85,6 +85,12 @@ - (void)initialize {
dragCount = 0;
clippyIsEmpty = YES;
colorspace = CGColorSpaceCreateDeviceRGB();

// macOS 10.5 introduced NSTrackingArea for mouse tracking
NSTrackingArea *trackingArea = [[NSTrackingArea alloc] initWithRect: [self frame]
options: (NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved | NSTrackingActiveAlways | NSTrackingInVisibleRect)
owner: self userInfo: nil];
[self addTrackingArea: trackingArea];
}

- (void) initializeVariables {
Expand Down
6 changes: 6 additions & 0 deletions platforms/iOS/vm/OSX/sqSqueakOSXMetalView.m
Expand Up @@ -168,6 +168,12 @@ - (void)initialize {
colorspace = CGColorSpaceCreateDeviceRGB();
[self initializeSqueakColorMap];
[[NSNotificationCenter defaultCenter] addObserver:self selector: @selector(didEnterFullScreen:) name:@"NSWindowDidEnterFullScreenNotification" object:nil];

// macOS 10.5 introduced NSTrackingArea for mouse tracking
NSTrackingArea *trackingArea = [[NSTrackingArea alloc] initWithRect: [self frame]
options: (NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved | NSTrackingActiveAlways | NSTrackingInVisibleRect)
owner: self userInfo: nil];
[self addTrackingArea: trackingArea];
}

- (void) didEnterFullScreen: (NSNotification*) aNotification {
Expand Down
6 changes: 6 additions & 0 deletions platforms/iOS/vm/OSX/sqSqueakOSXOpenGLView.m
Expand Up @@ -207,6 +207,12 @@ - (void)initialize {
colorspace = CGColorSpaceCreateDeviceRGB();
[self initializeSqueakColorMap];
[[NSNotificationCenter defaultCenter] addObserver:self selector: @selector(didEnterFullScreen:) name:@"NSWindowDidEnterFullScreenNotification" object:nil];

// macOS 10.5 introduced NSTrackingArea for mouse tracking
NSTrackingArea *trackingArea = [[NSTrackingArea alloc] initWithRect: [self frame]
options: (NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved | NSTrackingActiveAlways | NSTrackingInVisibleRect)
owner: self userInfo: nil];
[self addTrackingArea: trackingArea];
}

- (void) didEnterFullScreen: (NSNotification*) aNotification {
Expand Down

0 comments on commit 68343d4

Please sign in to comment.