ffi 1.27: switch safe-insets call site to sx-side JNI implementation
`AndroidPlatform.safe_insets` now reaches into the JVM through the
sx helpers from 1.25 + 1.26 instead of the C `sx_android_query_safe_insets`
foreign call:
attached := false;
env := sx_android_get_env(g_android_activity, @attached);
if env != null {
clazz := sx_android_activity_clazz(g_android_activity);
sx_query_safe_insets_jni(env, clazz, @t, @l, @b, @r);
if attached { sx_android_detach_env(g_android_activity); }
}
Chess Android IR now includes the seven `(@SX_JNI_CLS_*, @SX_JNI_MID_*)`
slot pairs (one per unique literal `(name, sig)` pair: getWindow,
getDecorView, getRootWindowInsets, getSystemWindowInset{Top,Left,
Bottom,Right}). First call populates each; subsequent calls hit the
cached jmethodID via the 1.17 lazy-init branch.
The C `sx_android_query_safe_insets` body is now unused; left in place
per the plan ("leave the file in place until Phase 2 deletes it").
Chess Android + iOS-sim both compile clean; host 118/119;
cross-compile 3/3.
On-device chess regression is the next checkpoint — the safe-area
behavior is visible: board must sit below the status bar with
correct top inset on a Pixel 7 Pro with notch. Deferred to the next
session (requires APK build + adb install + screencap).
This commit is contained in:
@@ -390,7 +390,13 @@ impl Platform for AndroidPlatform {
|
||||
// bootstrap is too early.
|
||||
if !self.safe_insets_queried and g_android_activity != null and self.egl_surface != null {
|
||||
t : s32 = 0; l : s32 = 0; b : s32 = 0; r : s32 = 0;
|
||||
sx_android_query_safe_insets(g_android_activity, @t, @l, @b, @r);
|
||||
attached : bool = false;
|
||||
env := sx_android_get_env(g_android_activity, @attached);
|
||||
if env != null {
|
||||
clazz := sx_android_activity_clazz(g_android_activity);
|
||||
sx_query_safe_insets_jni(env, clazz, @t, @l, @b, @r);
|
||||
if attached { sx_android_detach_env(g_android_activity); }
|
||||
}
|
||||
inv : f32 = if self.dpi_scale > 0.0 then 1.0 / self.dpi_scale else 1.0;
|
||||
self.safe_top = xx t * inv;
|
||||
self.safe_left = xx l * inv;
|
||||
|
||||
Reference in New Issue
Block a user