Merge branch 'master' into jgrpp

This commit is contained in:
Jonathan G Rennison
2021-04-05 17:50:39 +01:00
164 changed files with 3493 additions and 2443 deletions

View File

@@ -43,6 +43,7 @@
#import <sys/param.h> /* for MAXPATHLEN */
#import <sys/time.h> /* gettimeofday */
#include <array>
/**
* Important notice regarding all modifications!!!!!!!
@@ -201,6 +202,7 @@ bool VideoDriver_Cocoa::ToggleFullscreen(bool full_screen)
[ NSMenu setMenuBarVisible:!full_screen ];
this->UpdateVideoModes();
this->InvalidateGameOptionsWindow();
return true;
}
@@ -213,7 +215,7 @@ bool VideoDriver_Cocoa::ToggleFullscreen(bool full_screen)
*/
bool VideoDriver_Cocoa::AfterBlitterChange()
{
this->ChangeResolution(_cur_resolution.width, _cur_resolution.height);
this->AllocateBackingStore(true);
return true;
}
@@ -224,7 +226,31 @@ void VideoDriver_Cocoa::EditBoxLostFocus()
{
[ [ this->cocoaview inputContext ] discardMarkedText ];
/* Clear any marked string from the current edit box. */
HandleTextInput(NULL, true);
HandleTextInput(nullptr, true);
}
/**
* Get refresh rates of all connected monitors.
*/
std::vector<int> VideoDriver_Cocoa::GetListOfMonitorRefreshRates()
{
std::vector<int> rates{};
if (MacOSVersionIsAtLeast(10, 6, 0)) {
std::array<CGDirectDisplayID, 16> displays;
uint32_t count = 0;
CGGetActiveDisplayList(displays.size(), displays.data(), &count);
for (uint32_t i = 0; i < count; i++) {
CGDisplayModeRef mode = CGDisplayCopyDisplayMode(displays[i]);
int rate = (int)CGDisplayModeGetRefreshRate(mode);
if (rate > 0) rates.push_back(rate);
CGDisplayModeRelease(mode);
}
}
return rates;
}
/**
@@ -436,6 +462,8 @@ void VideoDriver_Cocoa::InputLoop()
/** Main game loop. */
void VideoDriver_Cocoa::MainLoopReal()
{
this->StartGameThread();
for (;;) {
@autoreleasepool {
if (_exit_game) {
@@ -444,12 +472,12 @@ void VideoDriver_Cocoa::MainLoopReal()
break;
}
if (this->Tick()) {
this->Paint();
}
this->Tick();
this->SleepTillNextTick();
}
}
this->StopGameThread();
}
@@ -561,6 +589,8 @@ const char *VideoDriver_CocoaQuartz::Start(const StringList &param)
this->GameSizeChanged();
this->UpdateVideoModes();
this->is_game_threaded = !GetDriverParamBool(param, "no_threads") && !GetDriverParamBool(param, "no_thread");
return nullptr;
}