Skip to content

Commit 24ce1d1

Browse files
author
GH Action
committed
1 parent cf8222f commit 24ce1d1

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/sokol/c/sokol_app.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5145,7 +5145,7 @@ _SOKOL_PRIVATE id<CAMetalDrawable> _sapp_macos_mtl_swapchain_next(void) {
51455145
}
51465146

51475147
_SOKOL_PRIVATE bool _sapp_macos_mtl_display_link_active(void) {
5148-
return _sapp.macos.mtl.display_link != nil;
5148+
return (nil != _sapp.macos.mtl.display_link) && (!_sapp.macos.mtl.display_link.paused);
51495149
}
51505150

51515151
_SOKOL_PRIVATE void _sapp_macos_mtl_timing_init(void) {
@@ -5185,6 +5185,10 @@ _SOKOL_PRIVATE double _sapp_macos_mtl_timing_frame_duration(void) {
51855185
}
51865186

51875187
_SOKOL_PRIVATE void _sapp_macos_mtl_start_display_link(void) {
5188+
if (nil != _sapp.macos.mtl.display_link) {
5189+
_sapp.macos.mtl.display_link.paused = false;
5190+
return;
5191+
}
51885192
// NOTE: CADisplayLink is only available since macOS 14.0
51895193
SOKOL_ASSERT(nil == _sapp.macos.mtl.display_link);
51905194
SOKOL_ASSERT(nil == _sapp.macos.mtl.fallback_timer);
@@ -5199,14 +5203,11 @@ _SOKOL_PRIVATE void _sapp_macos_mtl_start_display_link(void) {
51995203

52005204
_SOKOL_PRIVATE void _sapp_macos_mtl_stop_display_link(void) {
52015205
if (nil != _sapp.macos.mtl.display_link) {
5202-
[_sapp.macos.mtl.display_link invalidate];
5203-
// NOTE: the run-loop held the only strong reference to the display link
5204-
_sapp.macos.mtl.display_link = nil;
5206+
_sapp.macos.mtl.display_link.paused = true;
52055207
}
52065208
}
52075209

52085210
_SOKOL_PRIVATE void _sapp_macos_mtl_start_fallback_timer(void) {
5209-
SOKOL_ASSERT(nil == _sapp.macos.mtl.display_link);
52105211
SOKOL_ASSERT(nil == _sapp.macos.mtl.fallback_timer);
52115212
_sapp.macos.mtl.fallback_timer = [NSTimer
52125213
timerWithTimeInterval: _SAPP_MACOS_MTL_OBSCURED_FRAME_DURATION_IN_SECONDS

0 commit comments

Comments
 (0)