Bind Apple platform services explicitly

This commit is contained in:
2026-06-17 12:20:29 +02:00
parent aec78fb838
commit 065717f89b
7 changed files with 83 additions and 25 deletions

View File

@@ -8,6 +8,7 @@
#include "keymap.h"
#include "main.h"
#include "platform_apple/apple_platform_services.h"
#include "platform_legacy/legacy_platform_services.h"
#include "settings.h"
#include <CoreFoundation/CoreFoundation.h>
#include <Cocoa/Cocoa.h>
@@ -23,6 +24,8 @@
@import AppCenterAnalytics;
@import AppCenterCrashes;
static std::unique_ptr<pp::platform::PlatformServices> g_platform_services;
NSString* keyCodeToString(NSUInteger keyCode, NSUInteger mods)
{
TISInputSourceRef currentKeyboard = TISCopyCurrentKeyboardInputSource();
@@ -522,6 +525,12 @@ NSString* keyCodeToString(NSUInteger keyCode, NSUInteger mods)
[MSCrashes class]
]];
g_platform_services = pp::platform::legacy::create_platform_services({
.apple_document_services = []() -> pp::platform::apple::AppleDocumentPlatformServices& {
return pp::platform::apple::active_legacy_apple_document_platform_services();
},
});
App::I->set_platform_services(g_platform_services.get());
App::I->initLog();
App::I->create();
NSRect r = NSMakeRect(0, 0, App::I->width, App::I->height);