aboutsummaryrefslogtreecommitdiffstats
path: root/pugl
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-06-06 19:32:03 +0200
committerDavid Robillard <d@drobilla.net>2020-06-13 17:18:25 +0200
commit81f9debf519c4b54e713a7a36a4ac474340d18fb (patch)
treeebf4bf96176cfbe9f4baca62be7021487c627cf0 /pugl
parenteebb62db425333c3a934d9f17fba87a5cee57460 (diff)
downloadpugl-81f9debf519c4b54e713a7a36a4ac474340d18fb.tar.gz
pugl-81f9debf519c4b54e713a7a36a4ac474340d18fb.tar.bz2
pugl-81f9debf519c4b54e713a7a36a4ac474340d18fb.zip
Fix mouse position of events on high resolution MacOS
Diffstat (limited to 'pugl')
-rw-r--r--pugl/detail/mac.m12
1 files changed, 11 insertions, 1 deletions
diff --git a/pugl/detail/mac.m b/pugl/detail/mac.m
index 501f5d9..da9de20 100644
--- a/pugl/detail/mac.m
+++ b/pugl/detail/mac.m
@@ -77,6 +77,14 @@ nsRectFromPoints(PuglView* view, const NSRect rect)
rect.size.height * scaleFactor);
}
+static NSPoint
+nsPointFromPoints(PuglView* view, const NSPoint point)
+{
+ const double scaleFactor = [viewScreen(view) backingScaleFactor];
+
+ return NSMakePoint(point.x * scaleFactor, point.y * scaleFactor);
+}
+
static NSRect
rectToNsRect(const PuglRect rect)
{
@@ -307,7 +315,9 @@ keySymToSpecial(const NSEvent* const ev)
- (NSPoint) eventLocation:(NSEvent*)event
{
- return [self convertPoint:[event locationInWindow] fromView:nil];
+ return nsPointFromPoints(puglview,
+ [self convertPoint:[event locationInWindow]
+ fromView:nil]);
}
static void