mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 23:55:39 +00:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user