Own main workers and narrow Apple render hooks

This commit is contained in:
2026-06-16 07:43:44 +02:00
parent 6f4bd4b26f
commit 0c72aa0312
9 changed files with 167 additions and 52 deletions

View File

@@ -143,6 +143,18 @@ public:
[ios_view hide_keyboard];
});
};
bridge.acquire_render_context = [ios_view] {
[ios_view async_lock];
};
bridge.release_render_context = [ios_view] {
[ios_view async_unlock];
};
bridge.present_render_context = [ios_view] {
[ios_view async_swap];
};
bridge.bind_main_render_target = [ios_view] {
[ios_view->glview bindDrawable];
};
bridge.display_file = [ios_view](std::string path) {
dispatch_async(dispatch_get_main_queue(), ^{
[ios_view display_file:path];
@@ -197,6 +209,15 @@ public:
[osx_view share_file:[NSString stringWithUTF8String:path.c_str()]];
});
};
bridge.acquire_render_context = [osx_view] {
[osx_view async_lock];
};
bridge.release_render_context = [osx_view] {
[osx_view async_unlock];
};
bridge.present_render_context = [osx_view] {
[osx_view async_swap];
};
bridge.set_cursor_visible = [osx_view](bool visible) {
[osx_view show_cursor:visible];
};
@@ -372,10 +393,8 @@ public:
void acquire_render_context() override
{
#if __OSX__
[App::I->osx_view async_lock];
#elif __IOS__
[App::I->ios_view async_lock];
#if defined(__IOS__) || defined(__OSX__)
active_apple_document_platform_services().acquire_render_context();
#elif __ANDROID__
android_async_lock();
#elif __LINUX__ || __WEB__
@@ -385,10 +404,8 @@ public:
void release_render_context() override
{
#if __OSX__
[App::I->osx_view async_unlock];
#elif __IOS__
[App::I->ios_view async_unlock];
#if defined(__IOS__) || defined(__OSX__)
active_apple_document_platform_services().release_render_context();
#elif __ANDROID__
android_async_unlock();
#endif
@@ -396,10 +413,8 @@ public:
void present_render_context() override
{
#if __OSX__
[App::I->osx_view async_swap];
#elif __IOS__
[App::I->ios_view async_swap];
#if defined(__IOS__) || defined(__OSX__)
active_apple_document_platform_services().present_render_context();
#elif __ANDROID__
android_async_swap();
#elif __LINUX__ || __WEB__
@@ -417,7 +432,7 @@ public:
void bind_main_render_target() override
{
#if __IOS__
[App::I->ios_view->glview bindDrawable];
active_apple_document_platform_services().bind_main_render_target();
#else
bind_default_render_target();
#endif