aboutsummaryrefslogtreecommitdiffstats
path: root/pugl
diff options
context:
space:
mode:
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