uikit: inline three trivial legacy IMP helpers into #objc_class methods
Three holdover free functions from the pre-M3 era were each
just two or three lines that forwarded to a global. With M3
finished, every call site is one #objc_class method body, so
the wrapper indirection earns nothing — inline them.
Deleted:
uikit_window_getter → body of SxSceneDelegate.window
uikit_window_setter → body of SxSceneDelegate.setWindow
uikit_did_finish_launching → body of
SxAppDelegate.application_didFinishLaunchingWithOptions
The bigger helpers (uikit_keyboard_will_change_frame,
uikit_scene_will_connect, uikit_gl_view_tick/_layout, the four
uikit_gl_view_touches_*) stay — their bodies are 30-80 lines
each, so wrapping them in a small forwarding method body inside
#objc_class is the cleaner factoring.
Chess on iOS-sim: board renders, full game state intact. 183
example tests + zig build test green.
This commit is contained in:
@@ -186,7 +186,12 @@ SxAppDelegate :: #objc_class("SxAppDelegate") {
|
||||
#extends UIResponder;
|
||||
|
||||
application_didFinishLaunchingWithOptions :: (self: *Self, app: *void, opts: *void) -> BOOL {
|
||||
return xx uikit_did_finish_launching(xx self, xx 0, app, opts);
|
||||
inline if OS == .ios {
|
||||
if g_uikit_plat != null {
|
||||
uikit_subscribe_keyboard_notifications(xx self);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
sxKeyboardWillChangeFrame :: (self: *Self, notification: *void) {
|
||||
@@ -213,11 +218,13 @@ SxSceneDelegate :: #objc_class("SxSceneDelegate") {
|
||||
}
|
||||
|
||||
window :: (self: *Self) -> *void {
|
||||
return uikit_window_getter(xx self, xx 0);
|
||||
if g_uikit_plat == null { return xx 0; }
|
||||
return g_uikit_plat.window;
|
||||
}
|
||||
|
||||
setWindow :: (self: *Self, w: *void) {
|
||||
uikit_window_setter(xx self, xx 0, w);
|
||||
if g_uikit_plat == null { return; }
|
||||
g_uikit_plat.window = w;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -560,25 +567,6 @@ uikit_create_gl_context :: (plat: *UIKitPlatform) {
|
||||
load_gl(@ios_gl_proc);
|
||||
}
|
||||
|
||||
uikit_window_getter :: (self: *void, _cmd: *void) -> *void callconv(.c) {
|
||||
if g_uikit_plat == null { return xx 0; }
|
||||
g_uikit_plat.window;
|
||||
}
|
||||
|
||||
uikit_window_setter :: (self: *void, _cmd: *void, w: *void) callconv(.c) {
|
||||
if g_uikit_plat == null { return; }
|
||||
g_uikit_plat.window = w;
|
||||
}
|
||||
|
||||
uikit_did_finish_launching :: (self: *void, _cmd: *void, app: *void, opts: *void) -> u8 callconv(.c) {
|
||||
inline if OS == .ios {
|
||||
if g_uikit_plat != null {
|
||||
uikit_subscribe_keyboard_notifications(self);
|
||||
}
|
||||
}
|
||||
1;
|
||||
}
|
||||
|
||||
uikit_subscribe_keyboard_notifications :: (delegate: *void) {
|
||||
inline if OS != .ios { return; }
|
||||
center := NSNotificationCenter.defaultCenter();
|
||||
|
||||
Reference in New Issue
Block a user