51 { 52 self->_remoteLayerID = RemoteLayerGetIdForRemote(self->_remoteLayer); 53 if (self->_remoteLayerID != 0) 54 { 55 [self->_remoteLayer retain]; 56 } 57 else 58 { 59 NSLog(@"RemoteLayer ERROR: 0 _remoteLayerID for serverName:%@", serverName); 60 } 61 } 62 else 63 { 64 NSLog(@"RemoteLayer ERROR: nil remoteLayer for serverName:%@", serverName); 65 } 66 } 67 68 - (id)initWithSharedContext:(CGLContextObj)ctx 69 andClientContext:(CGLContextObj)clCtx 70 withHiDPIAware:(BOOL)HiDPIAware 71 { 72 LOG("GlassLayer3D initWithSharedContext]"); 73 self = [super init]; 74 if (self != nil) 75 { 76 self->_serverPort = MACH_PORT_NULL; 77 self->_remoteLayer = nil; 78 self->_remoteLayerID = 0; 79 80 self->_painterOffscreen = [[GlassOffscreen alloc] initWithContext:clCtx]; 81 self->_glassOffscreen = [[GlassOffscreen alloc] initWithContext:ctx]; 82 [self->_glassOffscreen setLayer:self]; 83 LOG(" GlassLayer3D context: %p", ctx); 84 85 self->isHiDPIAware = HiDPIAware; 86 87 [self setAsynchronous:NO]; 88 [self setAutoresizingMask:(kCALayerWidthSizable|kCALayerHeightSizable)]; 89 [self setContentsGravity:kCAGravityTopLeft]; 90 91 // Initially the view is not in any window yet, so using the 92 // screens[0]'s scale is a good starting point (this is most probably 93 // the notebook's main LCD display which is HiDPI-capable). 94 // Note that mainScreen is the screen with the current app bar focus 95 // in Mavericks and later OS so it will likely not match the screen 96 // we initially show windows on if an app is started from an external 97 // monitor. 98 [self notifyScaleFactorChanged:GetScreenScaleFactor([[NSScreen screens] objectAtIndex:0])]; 99 100 [self setMasksToBounds:YES]; 101 [self setNeedsDisplayOnBoundsChange:YES]; | 51 { 52 self->_remoteLayerID = RemoteLayerGetIdForRemote(self->_remoteLayer); 53 if (self->_remoteLayerID != 0) 54 { 55 [self->_remoteLayer retain]; 56 } 57 else 58 { 59 NSLog(@"RemoteLayer ERROR: 0 _remoteLayerID for serverName:%@", serverName); 60 } 61 } 62 else 63 { 64 NSLog(@"RemoteLayer ERROR: nil remoteLayer for serverName:%@", serverName); 65 } 66 } 67 68 - (id)initWithSharedContext:(CGLContextObj)ctx 69 andClientContext:(CGLContextObj)clCtx 70 withHiDPIAware:(BOOL)HiDPIAware 71 withIsSwPipe:(BOOL)isSwPipe 72 { 73 LOG("GlassLayer3D initWithSharedContext]"); 74 self = [super init]; 75 if (self != nil) 76 { 77 self->_serverPort = MACH_PORT_NULL; 78 self->_remoteLayer = nil; 79 self->_remoteLayerID = 0; 80 81 self->_painterOffscreen = [[GlassOffscreen alloc] initWithContext:clCtx andIsSwPipe:isSwPipe]; 82 self->_glassOffscreen = [[GlassOffscreen alloc] initWithContext:ctx andIsSwPipe:isSwPipe]; 83 [self->_glassOffscreen setLayer:self]; 84 LOG(" GlassLayer3D context: %p", ctx); 85 86 self->isHiDPIAware = HiDPIAware; 87 88 [self setAsynchronous:NO]; 89 [self setAutoresizingMask:(kCALayerWidthSizable|kCALayerHeightSizable)]; 90 [self setContentsGravity:kCAGravityTopLeft]; 91 92 // Initially the view is not in any window yet, so using the 93 // screens[0]'s scale is a good starting point (this is most probably 94 // the notebook's main LCD display which is HiDPI-capable). 95 // Note that mainScreen is the screen with the current app bar focus 96 // in Mavericks and later OS so it will likely not match the screen 97 // we initially show windows on if an app is started from an external 98 // monitor. 99 [self notifyScaleFactorChanged:GetScreenScaleFactor([[NSScreen screens] objectAtIndex:0])]; 100 101 [self setMasksToBounds:YES]; 102 [self setNeedsDisplayOnBoundsChange:YES]; |