Merge branch 'master' into jgrpp
This commit is contained in:
@@ -33,6 +33,8 @@ public:
|
||||
|
||||
void ClearSystemSprites() override;
|
||||
|
||||
void PopulateSystemSprites() override;
|
||||
|
||||
bool HasAnimBuffer() override { return true; }
|
||||
uint8 *GetAnimBuffer() override { return this->anim_buffer; }
|
||||
|
||||
@@ -54,6 +56,9 @@ class FVideoDriver_CocoaOpenGL : public DriverFactoryBase {
|
||||
public:
|
||||
FVideoDriver_CocoaOpenGL() : DriverFactoryBase(Driver::DT_VIDEO, 9, "cocoa-opengl", "Cocoa OpenGL Video Driver") {}
|
||||
Driver *CreateInstance() const override { return new VideoDriver_CocoaOpenGL(); }
|
||||
|
||||
protected:
|
||||
bool UsesHardwareAcceleration() const override { return true; }
|
||||
};
|
||||
|
||||
#endif /* VIDEO_COCOA_OGL_H */
|
||||
|
||||
@@ -214,6 +214,8 @@ const char *VideoDriver_CocoaOpenGL::Start(const StringList ¶m)
|
||||
this->UpdateVideoModes();
|
||||
MarkWholeScreenDirty();
|
||||
|
||||
this->is_game_threaded = !GetDriverParamBool(param, "no_threads") && !GetDriverParamBool(param, "no_thread");
|
||||
|
||||
return nullptr;
|
||||
|
||||
}
|
||||
@@ -227,6 +229,11 @@ void VideoDriver_CocoaOpenGL::Stop()
|
||||
CGLReleaseContext(this->gl_context);
|
||||
}
|
||||
|
||||
void VideoDriver_CocoaOpenGL::PopulateSystemSprites()
|
||||
{
|
||||
OpenGLBackend::Get()->PopulateCursorCache();
|
||||
}
|
||||
|
||||
void VideoDriver_CocoaOpenGL::ClearSystemSprites()
|
||||
{
|
||||
CGLSetCurrentContext(this->gl_context);
|
||||
@@ -265,7 +272,7 @@ void VideoDriver_CocoaOpenGL::AllocateBackingStore(bool force)
|
||||
CGLSetCurrentContext(this->gl_context);
|
||||
NSRect frame = [ this->cocoaview getRealRect:[ this->cocoaview frame ] ];
|
||||
OpenGLBackend::Get()->Resize(frame.size.width, frame.size.height, force);
|
||||
_screen.dst_ptr = this->GetVideoPointer();
|
||||
if (this->buffer_locked) _screen.dst_ptr = this->GetVideoPointer();
|
||||
this->dirty_rect = {};
|
||||
|
||||
/* Redraw screen */
|
||||
|
||||
@@ -47,6 +47,8 @@ public:
|
||||
|
||||
void EditBoxLostFocus() override;
|
||||
|
||||
std::vector<int> GetListOfMonitorRefreshRates() override;
|
||||
|
||||
/* --- The following methods should be private, but can't be due to Obj-C limitations. --- */
|
||||
|
||||
void MainLoopReal();
|
||||
@@ -122,7 +124,7 @@ protected:
|
||||
|
||||
class FVideoDriver_CocoaQuartz : public DriverFactoryBase {
|
||||
public:
|
||||
FVideoDriver_CocoaQuartz() : DriverFactoryBase(Driver::DT_VIDEO, 10, "cocoa", "Cocoa Video Driver") {}
|
||||
FVideoDriver_CocoaQuartz() : DriverFactoryBase(Driver::DT_VIDEO, 8, "cocoa", "Cocoa Video Driver") {}
|
||||
Driver *CreateInstance() const override { return new VideoDriver_CocoaQuartz(); }
|
||||
};
|
||||
|
||||
|
||||
@@ -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 ¶m)
|
||||
this->GameSizeChanged();
|
||||
this->UpdateVideoModes();
|
||||
|
||||
this->is_game_threaded = !GetDriverParamBool(param, "no_threads") && !GetDriverParamBool(param, "no_thread");
|
||||
|
||||
return nullptr;
|
||||
|
||||
}
|
||||
|
||||
@@ -700,9 +700,9 @@ void CocoaDialog(const char *title, const char *message, const char *buttonLabel
|
||||
if (!EditBoxInGlobalFocus() || IsInsideMM(pressed_key & ~WKC_SPECIAL_KEYS, WKC_F1, WKC_PAUSE + 1)) {
|
||||
HandleKeypress(pressed_key, unicode);
|
||||
}
|
||||
DEBUG(driver, 2, "cocoa_v: QZ_KeyEvent: %x (%x), down, mapping: %x", keycode, unicode, pressed_key);
|
||||
DEBUG(driver, 3, "cocoa_v: QZ_KeyEvent: %x (%x), down, mapping: %x", keycode, unicode, pressed_key);
|
||||
} else {
|
||||
DEBUG(driver, 2, "cocoa_v: QZ_KeyEvent: %x (%x), up", keycode, unicode);
|
||||
DEBUG(driver, 3, "cocoa_v: QZ_KeyEvent: %x (%x), up", keycode, unicode);
|
||||
}
|
||||
|
||||
return interpret_keys;
|
||||
|
||||
Reference in New Issue
Block a user