summaryrefslogtreecommitdiff
path: root/src/video/cocoa
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2021-03-08 15:20:49 +0100
committerMichael Lutz <michi@icosahedron.de>2021-03-08 15:43:22 +0100
commit25656a10cb237fc1be7dac3e2207a1986633bf06 (patch)
treee989d2081c2dbcf025ac830843fb382701133d73 /src/video/cocoa
parentae1f7bd6954176c02effe4048e8b9fe900038389 (diff)
downloadopenttd-25656a10cb237fc1be7dac3e2207a1986633bf06.tar.xz
Fix #8808: [OSX, OpenGL] Crash on switching blitters due to double-mapping the video buffer.
Diffstat (limited to 'src/video/cocoa')
-rw-r--r--src/video/cocoa/cocoa_ogl.mm2
-rw-r--r--src/video/cocoa/cocoa_v.mm4
-rw-r--r--src/video/cocoa/cocoa_wnd.mm4
3 files changed, 5 insertions, 5 deletions
diff --git a/src/video/cocoa/cocoa_ogl.mm b/src/video/cocoa/cocoa_ogl.mm
index 915f43779..c75de1e04 100644
--- a/src/video/cocoa/cocoa_ogl.mm
+++ b/src/video/cocoa/cocoa_ogl.mm
@@ -265,7 +265,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 */
diff --git a/src/video/cocoa/cocoa_v.mm b/src/video/cocoa/cocoa_v.mm
index af63fe5f4..7b7fe9d67 100644
--- a/src/video/cocoa/cocoa_v.mm
+++ b/src/video/cocoa/cocoa_v.mm
@@ -213,7 +213,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 +224,7 @@ void VideoDriver_Cocoa::EditBoxLostFocus()
{
[ [ this->cocoaview inputContext ] discardMarkedText ];
/* Clear any marked string from the current edit box. */
- HandleTextInput(NULL, true);
+ HandleTextInput(nullptr, true);
}
/**
diff --git a/src/video/cocoa/cocoa_wnd.mm b/src/video/cocoa/cocoa_wnd.mm
index d5a7ba84c..825130006 100644
--- a/src/video/cocoa/cocoa_wnd.mm
+++ b/src/video/cocoa/cocoa_wnd.mm
@@ -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;