ffi 3.2 C5: migrate uikit.sx view tree + GL drawables cluster
Final Phase 3.2 cluster. CALayer / CAEAGLLayer / EAGLContext declared
as `#foreign #objc_class` blocks, plus `setContentScaleFactor` added
to UIView and `-layer` now returns `*CALayer` (was opaque `*void`).
Classes declared:
- CALayer → setOpaque (instance)
- CAEAGLLayer → setDrawableProperties (instance)
- EAGLContext → alloc (class), initWithAPI (instance),
setCurrentContext (class — takes EAGLContext arg),
renderbufferStorage_fromDrawable (instance),
presentRenderbuffer (instance)
- UIView → +setContentScaleFactor (existing decl extended)
The C5 group sits above UIView in the file so the `-layer` return type
`*CALayer` forward-resolves cleanly.
Migration sites in uikit.sx:
- `uikit_create_gl_context` → `EAGLContext.alloc().initWithAPI(api)`
+ `EAGLContext.setCurrentContext(ctx)`.
- `uikit_setup_renderbuffer` → cast `*EAGLContext` and
`gl_ctx.renderbufferStorage_fromDrawable(target, layer)`.
- `uikit_present_renderbuffer` → same cast + `presentRenderbuffer(target)`.
- Scene-connect bring-up: `gl_layer.setOpaque(1)`,
`eagl_layer.setDrawableProperties(...)`,
`gl_view.setContentScaleFactor(scale)`.
One more `objc_getClass(...)` lookup (EAGLContext) retired — the class
slot comes from the declarative binding via `__sx_objc_class_init`.
**Phase 3.2 complete.** Five clusters migrated (C1: Foundation
utility; C2: Notifications + Bundle; C3: RunLoop + display timing;
C4: UIKit chrome; C5: view tree + GL drawables). 8 foreign Cocoa
classes declared; ~30 `#objc_call(T)(...)` sites rewritten to
`recv.method(args)` / `Cls.method(args)`; 6 `objc_getClass`
lookups retired. Sx-defined classes (SxAppDelegate, SxSceneDelegate,
SxGLView, SxMetalView) and a handful of foreign sites that exercise
delegate/protocol surfaces stay on the explicit `#objc_call` form
pending Phase 3.7's class synthesis.
167/167 example tests; chess clean on macOS / iOS sim / Android via
`tools/verify-step.sh`.
This commit is contained in:
@@ -600,27 +600,46 @@ matching the expected output.
|
||||
|
||||
Phase 3.2 C4 landed: UIKit chrome cluster migrated. Six classes
|
||||
declared (UIScreen, UIView, UIWindow, UIViewController, UITextField
|
||||
— plus the existing C1/C2/C3 classes already in place). Migration
|
||||
sites: `show_keyboard` / `hide_keyboard` use `tf.becomeFirstResponder()`
|
||||
/ `tf.resignFirstResponder()`; `uikit_refresh_safe_insets` uses
|
||||
`gl_view.safeAreaInsets()`; `uikit_read_screen_scale` and the GL-
|
||||
context bring-up both use `UIScreen.mainScreen().nativeScale()`;
|
||||
keyboard-frame callback uses `win.screen().bounds()`; the scene-
|
||||
connect bring-up chains `UIWindow.alloc().initWithWindowScene(scene)`
|
||||
and `UIViewController.alloc().init()` then `vc.setView(...)`,
|
||||
`win.setRootViewController(...)`, `gl_view.layer()`,
|
||||
`UITextField.alloc().init()`, `gl_view.addSubview(...)`,
|
||||
`win.makeKeyAndVisible()`. Three `objc_getClass(...)` calls (UIWindow,
|
||||
UIViewController, UITextField) are gone — the class slots come from
|
||||
the declarative bindings via `__sx_objc_class_init`. C4 is the
|
||||
cluster that triggered issue-0043; with the fix in, the chained
|
||||
dispatch resolves correctly under lazy lowering. 167/167 tests +
|
||||
chess clean on macOS / iOS sim / Android.
|
||||
— plus the existing C1/C2/C3 classes already in place). Three
|
||||
`objc_getClass(...)` calls (UIWindow, UIViewController, UITextField)
|
||||
are gone — the class slots come from the declarative bindings via
|
||||
`__sx_objc_class_init`. C4 is the cluster that triggered
|
||||
issue-0043; with the fix in, the chained dispatch resolves
|
||||
correctly under lazy lowering.
|
||||
|
||||
Phase 3.2 C5 landed: view tree + GL drawables cluster migrated.
|
||||
CALayer (`setOpaque`), CAEAGLLayer (`setDrawableProperties`), and
|
||||
EAGLContext (`alloc`, `initWithAPI`, `setCurrentContext`,
|
||||
`renderbufferStorage_fromDrawable`, `presentRenderbuffer`) declared.
|
||||
UIView gained `setContentScaleFactor` and `layer` now returns
|
||||
`*CALayer` (was opaque `*void`). Migration sites:
|
||||
`uikit_create_gl_context` uses `EAGLContext.alloc().initWithAPI(...)`
|
||||
then `EAGLContext.setCurrentContext(ctx)`;
|
||||
`uikit_setup_renderbuffer` uses
|
||||
`gl_ctx.renderbufferStorage_fromDrawable(...)`;
|
||||
`uikit_present_renderbuffer` uses `gl_ctx.presentRenderbuffer(...)`;
|
||||
the scene-connect bring-up uses `gl_layer.setOpaque(1)`,
|
||||
`eagl_layer.setDrawableProperties(...)`, and
|
||||
`gl_view.setContentScaleFactor(scale)`. One more `objc_getClass`
|
||||
(EAGLContext) gone. 167/167 + chess clean on macOS / iOS sim /
|
||||
Android.
|
||||
|
||||
**Phase 3.2 complete.** Surface summary:
|
||||
|
||||
- `#selector("explicit:")` override (parts A1+A2).
|
||||
- Locked-in golden mangling-table test (part B).
|
||||
- Five uikit.sx clusters migrated to declarative `#objc_class`
|
||||
(parts C1..C5) — 8 foreign Cocoa classes declared, 30+
|
||||
`#objc_call` call sites rewritten to `recv.method(args)` /
|
||||
`Cls.method(args)` form. 6 redundant `objc_getClass(...)` lookups
|
||||
retired. Sx-defined classes (SxAppDelegate, SxSceneDelegate,
|
||||
SxGLView, SxMetalView) and a handful of foreign sites that
|
||||
exercise less common paths (e.g. `objc_call(void)(delegate,
|
||||
"setWindow:", ...)` from UIWindowSceneDelegate protocol) stay on
|
||||
the explicit `#objc_call` form pending Phase 3.7's class-synthesis
|
||||
work.
|
||||
|
||||
Open work:
|
||||
- **Phase 3 step 3.2 — C5** — uikit.sx migration (view tree + GL
|
||||
drawables: CAEAGLLayer, EAGLContext, plus any remaining
|
||||
CAMetalLayer / NSTimer sites).
|
||||
- **Phase 3 step 3.3** — `property name: Type` synthesizes
|
||||
`inst.name` → `[inst name]` getter and `inst.name = x` →
|
||||
`[inst setName: x]` setter. `#setter("...")` overrides the setter
|
||||
|
||||
Reference in New Issue
Block a user