aboutsummaryrefslogtreecommitdiffstats
path: root/pugl
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-07-21 15:11:43 +0200
committerDavid Robillard <d@drobilla.net>2019-07-21 15:11:43 +0200
commit38b4790a89420b5b3f9c50e7025173301cd531d4 (patch)
treeeb276e34f85f02744d53e656e6841cb75d495e5f /pugl
parent89d7378adda9987431a665827f92ccbadd893909 (diff)
downloadpugl-38b4790a89420b5b3f9c50e7025173301cd531d4.tar.gz
pugl-38b4790a89420b5b3f9c50e7025173301cd531d4.tar.bz2
pugl-38b4790a89420b5b3f9c50e7025173301cd531d4.zip
Implement enter and leave notifications on MacOS
Diffstat (limited to 'pugl')
-rw-r--r--pugl/pugl_osx.m26
1 files changed, 24 insertions, 2 deletions
diff --git a/pugl/pugl_osx.m b/pugl/pugl_osx.m
index 59f25b9..a283283 100644
--- a/pugl/pugl_osx.m
+++ b/pugl/pugl_osx.m
@@ -293,12 +293,34 @@ keySymToSpecial(PuglView* view, NSEvent* ev)
return [self convertPoint:[event locationInWindow] fromView:nil];
}
-- (void) mouseEntered:(NSEvent*)theEvent
+static void
+handleCrossing(PuglOpenGLView* view, NSEvent* event, const PuglEventType type)
+{
+ const NSPoint wloc = [view eventLocation:event];
+ const NSPoint rloc = [NSEvent mouseLocation];
+ const PuglEventCrossing ev = {
+ type,
+ view->puglview,
+ 0,
+ [event timestamp],
+ wloc.x,
+ view->puglview->height - wloc.y,
+ rloc.x,
+ [[NSScreen mainScreen] frame].size.height - rloc.y,
+ getModifiers(view->puglview, event),
+ PUGL_CROSSING_NORMAL
+ };
+ puglDispatchEvent(view->puglview, (const PuglEvent*)&ev);
+}
+
+- (void) mouseEntered:(NSEvent*)event
{
+ handleCrossing(self, event, PUGL_ENTER_NOTIFY);
}
-- (void) mouseExited:(NSEvent*)theEvent
+- (void) mouseExited:(NSEvent*)event
{
+ handleCrossing(self, event, PUGL_LEAVE_NOTIFY);
}
- (void) mouseMoved:(NSEvent*)event