app/internal/wm: [macOS] avoid NSView.isFlipped

When using Gio with ANGLE, the isFlipped coordinate system flip will
apply to rendering as well. Fortunately we're no longer using NSOpenGLView
so isFlipped only applies to mouse events. Convert them manually to avoid
isFlipped and support ANGLE.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-05-17 10:45:16 +02:00
parent 39775f555a
commit 3a0583564b
+3 -4
View File
@@ -49,16 +49,15 @@ static void handleMouse(NSView *view, NSEvent *event, int typ, CGFloat dx, CGFlo
dx *= 10;
dy *= 10;
}
gio_onMouse((__bridge CFTypeRef)view, typ, [NSEvent pressedMouseButtons], p.x, p.y, dx, dy, [event timestamp], [event modifierFlags]);
// Origin is in the lower left corner. Convert to upper left.
CGFloat height = view.bounds.size.height;
gio_onMouse((__bridge CFTypeRef)view, typ, [NSEvent pressedMouseButtons], p.x, height - p.y, dx, dy, [event timestamp], [event modifierFlags]);
}
@interface GioView : NSView
@end
@implementation GioView
- (BOOL)isFlipped {
return YES;
}
- (void)drawRect:(NSRect)r {
gio_onDraw((__bridge CFTypeRef)self);
}