mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-28 07:48:37 -04:00
cocoadisplay: Fix fullscreen regression on Intel macs
Partially backs out 619050bb32a6b154e48af968ca9372278292cd61 Fixes #1316 (for good this time hopefully)
This commit is contained in:
parent
602bd3e023
commit
dae26c2e4b
@ -43,35 +43,12 @@
|
|||||||
#import <OpenGL/OpenGL.h>
|
#import <OpenGL/OpenGL.h>
|
||||||
#import <Carbon/Carbon.h>
|
#import <Carbon/Carbon.h>
|
||||||
|
|
||||||
#include <sys/sysctl.h>
|
|
||||||
|
|
||||||
TypeHandle CocoaGraphicsWindow::_type_handle;
|
TypeHandle CocoaGraphicsWindow::_type_handle;
|
||||||
|
|
||||||
#ifndef MAC_OS_X_VERSION_10_15
|
#ifndef MAC_OS_X_VERSION_10_15
|
||||||
#define NSAppKitVersionNumber10_14 1671
|
#define NSAppKitVersionNumber10_14 1671
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if this is an arm64-based mac.
|
|
||||||
*/
|
|
||||||
static int is_arm64_mac() {
|
|
||||||
#ifdef __aarch64__
|
|
||||||
return 1;
|
|
||||||
#elif defined(__x86_64__)
|
|
||||||
// Running in Rosetta 2?
|
|
||||||
static int ret = -1;
|
|
||||||
if (ret < 0) {
|
|
||||||
size_t size = sizeof(ret);
|
|
||||||
if (sysctlbyname("sysctl.proc_translated", &ret, &size, nullptr, 0) == -1) {
|
|
||||||
ret = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -211,29 +188,17 @@ begin_frame(FrameMode mode, Thread *current_thread) {
|
|||||||
cocoagsg->lock_context();
|
cocoagsg->lock_context();
|
||||||
|
|
||||||
// Set the drawable.
|
// Set the drawable.
|
||||||
if (_properties.get_fullscreen() && !is_arm64_mac()) {
|
// Although not recommended, it is technically possible to use the same
|
||||||
// Fullscreen. Note that this call doesn't work with the newer
|
// context with multiple different-sized windows. If that happens, the
|
||||||
// Metal-based OpenGL drivers.
|
// context needs to be updated accordingly.
|
||||||
CGLError err = CGLSetFullScreenOnDisplay((CGLContextObj) [cocoagsg->_context CGLContextObj], CGDisplayIDToOpenGLDisplayMask(_display));
|
if ([cocoagsg->_context view] != _view) {
|
||||||
if (err != kCGLNoError) {
|
// XXX I'm not 100% sure that changing the view requires it to update.
|
||||||
cocoadisplay_cat.error()
|
_context_needs_update = true;
|
||||||
<< "Failed call to CGLSetFullScreenOnDisplay with display mask "
|
[cocoagsg->_context setView:_view];
|
||||||
<< CGDisplayIDToOpenGLDisplayMask(_display) << ": " << CGLErrorString(err) << "\n";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Although not recommended, it is technically possible to use the same
|
|
||||||
// context with multiple different-sized windows. If that happens, the
|
|
||||||
// context needs to be updated accordingly.
|
|
||||||
if ([cocoagsg->_context view] != _view) {
|
|
||||||
// XXX I'm not 100% sure that changing the view requires it to update.
|
|
||||||
_context_needs_update = true;
|
|
||||||
[cocoagsg->_context setView:_view];
|
|
||||||
|
|
||||||
if (cocoadisplay_cat.is_spam()) {
|
if (cocoadisplay_cat.is_spam()) {
|
||||||
cocoadisplay_cat.spam()
|
cocoadisplay_cat.spam()
|
||||||
<< "Switching context to view " << _view << "\n";
|
<< "Switching context to view " << _view << "\n";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user