diff options
author | David Robillard <d@drobilla.net> | 2019-07-21 10:09:55 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-07-21 14:44:19 +0200 |
commit | c1e49399271f4d0729a2ac2ed0a60f9980bd2133 (patch) | |
tree | d902397f2e04eac7bb98ff3b461bba69c64e1b1b | |
parent | 753af54d546963bd86c64ca3c5dde5cc8c92c4c8 (diff) | |
download | pugl-c1e49399271f4d0729a2ac2ed0a60f9980bd2133.tar.gz pugl-c1e49399271f4d0729a2ac2ed0a60f9980bd2133.tar.bz2 pugl-c1e49399271f4d0729a2ac2ed0a60f9980bd2133.zip |
Fix tracking area implementation on MacOS
I am not sure why updateTrackingAreas was being spammed before, but that caused
the event loop to constantly tick when the mouse was hovered over the window
despite nothing else happening.
Everything seems to work fine without it, and this seems to match other code,
so remove it. Also call super in updateTrackingAreas as suggested by the
documentation.
-rw-r--r-- | pugl/pugl_osx.m | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/pugl/pugl_osx.m b/pugl/pugl_osx.m index 1870207..80938f2 100644 --- a/pugl/pugl_osx.m +++ b/pugl/pugl_osx.m @@ -301,11 +301,12 @@ keySymToSpecial(PuglView* view, NSEvent* ev) const int opts = (NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved | NSTrackingActiveAlways); - trackingArea = [ [NSTrackingArea alloc] initWithRect:[self bounds] - options:opts - owner:self - userInfo:nil]; + trackingArea = [[NSTrackingArea alloc] initWithRect:[self bounds] + options:opts + owner:self + userInfo:nil]; [self addTrackingArea:trackingArea]; + [super updateTrackingAreas]; } - (NSPoint) eventLocation:(NSEvent*)event @@ -315,7 +316,6 @@ keySymToSpecial(PuglView* view, NSEvent* ev) - (void)mouseEntered:(NSEvent*)theEvent { - [self updateTrackingAreas]; } - (void)mouseExited:(NSEvent*)theEvent @@ -393,7 +393,6 @@ keySymToSpecial(PuglView* view, NSEvent* ev) (uint32_t)[event buttonNumber] + 1 }; puglDispatchEvent(puglview, (const PuglEvent*)&ev); - [self updateTrackingAreas]; } - (void) rightMouseDown:(NSEvent*)event @@ -418,8 +417,6 @@ keySymToSpecial(PuglView* view, NSEvent* ev) - (void) scrollWheel:(NSEvent*)event { - [self updateTrackingAreas]; - const NSPoint wloc = [self eventLocation:event]; const NSPoint rloc = [NSEvent mouseLocation]; const PuglEventScroll ev = { @@ -436,7 +433,6 @@ keySymToSpecial(PuglView* view, NSEvent* ev) [event deltaY] }; puglDispatchEvent(puglview, (const PuglEvent*)&ev); - [self updateTrackingAreas]; } - (void) keyDown:(NSEvent*)event |