Replace the remaining .kry and C application sources with Ziran modules, move vendored dependencies to their current pointers, and add Ziran tests for the ported hosts and policies. Co-Authored-By: Claude Opus 5.5 <[email protected]>
42 lines
1.1 KiB
Ziran
42 lines
1.1 KiB
Ziran
#import, file "../src/platform/activity_host.zi";
|
|
#import "c_string"
|
|
|
|
c :: #system_library "c";
|
|
ActivitySetEnv :: (name: *u8, value: *u8, overwrite: s32) -> s32 #foreign c "setenv";
|
|
ActivityUnsetEnv :: (name: *u8) -> s32 #foreign c "unsetenv";
|
|
|
|
#program_export
|
|
main :: () -> s32 {
|
|
display_name: [24]u8
|
|
session_name: [24]u8
|
|
x11_name: [8]u8
|
|
wayland_name: [16]u8
|
|
if !CopyCString("WAYLAND_DISPLAY", display_name[:]) ||
|
|
!CopyCString("XDG_SESSION_TYPE", session_name[:]) ||
|
|
!CopyCString("x11", x11_name[:]) ||
|
|
!CopyCString("wayland", wayland_name[:]) {
|
|
return 1
|
|
}
|
|
if ActivityUnsetEnv(*display_name[0]) != 0 ||
|
|
ActivitySetEnv(*session_name[0], *x11_name[0], 1) != 0 {
|
|
return 2
|
|
}
|
|
if app_is_wayland() {
|
|
return 3
|
|
}
|
|
if ActivitySetEnv(*session_name[0], *wayland_name[0], 1) != 0 {
|
|
return 4
|
|
}
|
|
if !app_is_wayland() {
|
|
return 5
|
|
}
|
|
if ActivitySetEnv(*session_name[0], *x11_name[0], 1) != 0 {
|
|
return 6
|
|
}
|
|
if app_idle_milliseconds() != -1 ||
|
|
app_idle_milliseconds() != -1 {
|
|
return 7
|
|
}
|
|
return 0
|
|
}
|