summaryrefslogtreecommitdiffstats
path: root/Common/NativeApp/Apple/Source/Classes
diff options
context:
space:
mode:
Diffstat (limited to 'Common/NativeApp/Apple/Source/Classes')
-rw-r--r--Common/NativeApp/Apple/Source/Classes/OSX/ViewController.mm15
1 files changed, 12 insertions, 3 deletions
diff --git a/Common/NativeApp/Apple/Source/Classes/OSX/ViewController.mm b/Common/NativeApp/Apple/Source/Classes/OSX/ViewController.mm
index c8f9228..253f725 100644
--- a/Common/NativeApp/Apple/Source/Classes/OSX/ViewController.mm
+++ b/Common/NativeApp/Apple/Source/Classes/OSX/ViewController.mm
@@ -26,6 +26,18 @@
@implementation ViewController
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+
+ // Add a tracking area in order to receive mouse events whenever the mouse is within the bounds of our view
+ NSTrackingArea *trackingArea = [[NSTrackingArea alloc] initWithRect:NSZeroRect
+ options:NSTrackingMouseMoved | NSTrackingInVisibleRect | NSTrackingActiveAlways
+ owner:self
+ userInfo:nil];
+ [self.view addTrackingArea:trackingArea];
+}
+
- (void)handleEvent : (NSEvent *)theEvent {
auto* view = (ViewBase*)self.view;
auto* theApp = [view lockApp];
@@ -35,9 +47,6 @@
[view unlockApp];
}
-- (void)mouseMove:(NSEvent *)theEvent {
- [self handleEvent:theEvent];
-}
- (void)mouseDown:(NSEvent *)theEvent {
[self handleEvent:theEvent];