зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1702898 - Remove some respondsToSelector checks that were only needed for old macOS versions. r=mac-reviewers,jgilbert,tnikkel,bradwerth
-[NSOpenGLContext pixelFormat] is 10.10+ -[NSScreen backingScaleFactor] is 10.7+ +[NSEvent isSwipeTrackingFromScrollEventsEnabled] is 10.7+ Differential Revision: https://phabricator.services.mozilla.com/D110772
This commit is contained in:
Родитель
8754752264
Коммит
3c50594c6e
|
@ -168,22 +168,13 @@ static bool IsSameGPU(CGOpenGLDisplayMask mask1, CGOpenGLDisplayMask mask2) {
|
|||
return !mask1 && !mask2;
|
||||
}
|
||||
|
||||
static NSOpenGLPixelFormat* GetPixelFormatForContext(NSOpenGLContext* aContext) {
|
||||
// -[NSOpenGLContext pixelFormat] is macOS 10.10+
|
||||
if ([aContext respondsToSelector:@selector(pixelFormat)]) {
|
||||
return [aContext pixelFormat];
|
||||
}
|
||||
return [[[NSOpenGLPixelFormat alloc]
|
||||
initWithCGLPixelFormatObj:CGLGetPixelFormat([aContext CGLContextObj])] autorelease];
|
||||
}
|
||||
|
||||
void GLContextCGL::MigrateToActiveGPU() {
|
||||
if (!mActiveGPUSwitchMayHaveOccurred.compareExchange(true, false)) {
|
||||
return;
|
||||
}
|
||||
|
||||
CGOpenGLDisplayMask newPreferredDisplayMask = GetFreshContextDisplayMask();
|
||||
NSOpenGLPixelFormat* pixelFormat = GetPixelFormatForContext(mContext);
|
||||
NSOpenGLPixelFormat* pixelFormat = [mContext pixelFormat];
|
||||
GLint currentVirtualScreen = [mContext currentVirtualScreen];
|
||||
GLint currentDisplayMask = 0;
|
||||
[pixelFormat getValues:¤tDisplayMask
|
||||
|
|
|
@ -725,12 +725,9 @@ bool nsCocoaUtils::HiDPIEnabled() {
|
|||
if ([desc objectForKey:NSDeviceIsScreen] == nil) {
|
||||
continue;
|
||||
}
|
||||
CGFloat scale = [screen respondsToSelector:@selector(backingScaleFactor)]
|
||||
? [screen backingScaleFactor]
|
||||
: 1.0;
|
||||
// Currently, we only care about differentiating "1.0" and "2.0",
|
||||
// so we set one of the two low bits to record which.
|
||||
if (scale > 1.0) {
|
||||
if ([screen backingScaleFactor] > 1.0) {
|
||||
scaleFactors |= 2;
|
||||
} else {
|
||||
scaleFactors |= 1;
|
||||
|
|
|
@ -480,10 +480,7 @@ nsresult nsLookAndFeel::NativeGetInt(IntID aID, int32_t& aResult) {
|
|||
aResult = 0;
|
||||
break;
|
||||
case IntID::SwipeAnimationEnabled:
|
||||
aResult = 0;
|
||||
if ([NSEvent respondsToSelector:@selector(isSwipeTrackingFromScrollEventsEnabled)]) {
|
||||
aResult = [NSEvent isSwipeTrackingFromScrollEventsEnabled];
|
||||
}
|
||||
aResult = NSEvent.isSwipeTrackingFromScrollEventsEnabled;
|
||||
break;
|
||||
case IntID::ContextMenuOffsetVertical:
|
||||
aResult = -6;
|
||||
|
|
Загрузка…
Ссылка в новой задаче