Skip to content

Commit

Permalink
[mac] fix highdpi for metal
Browse files Browse the repository at this point in the history
  • Loading branch information
krono committed Sep 17, 2020
1 parent 6116ca5 commit f1568ba
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion platforms/iOS/vm/OSX/sqSqueakOSXMetalView.m
Expand Up @@ -201,6 +201,20 @@ - (BOOL)isOpaque {
return YES;
}

- (NSRect) sqScreenSize {
return [self convertRectToBacking: [self bounds]];
}


- (NSPoint) sqMousePosition: (NSEvent*)theEvent {
/* Our client expects the mouse coordinates in Squeak's coordinates,
* but theEvent's location is in "user" coords. so we have to convert. */
NSPoint local_pt = [self convertPoint: [theEvent locationInWindow] fromView:nil];
NSPoint converted = [self convertPointToBacking: local_pt];
// Squeak is upside down
return NSMakePoint(converted.x, -converted.y);
}

#pragma mark Drawing

- (void) setupFullScreendispBitsIndex {
Expand Down Expand Up @@ -363,7 +377,7 @@ -(void)drawRect:(NSRect)rect
}

- (CGSize) screenSizeForTexture {
CGRect screenRect = [self bounds];
CGRect screenRect = [self sqScreenSize];
CGSize screenSize;
screenSize.width = (sqInt)screenRect.size.width;
screenSize.height = (sqInt)screenRect.size.height;
Expand Down

0 comments on commit f1568ba

Please sign in to comment.