Files
el/ui/examples/native-hello/src/main.el
T

44 lines
1.3 KiB
EmacsLisp

// main.el Entry point for native-hello.
//
// Boot sequence:
// 1. Initialize the native widget system.
// 2. Read the manifest.el app{} block for window config.
// 3. Create the window.
// 4. Build the widget tree (App.el: app_build).
// 5. Show the window.
// 6. Start the run loop (never returns).
import "App.el"
// Boot
native_init()
// Determine the manifest path relative to where we are invoked.
// When running from the example directory: manifest.el is at ./manifest.el.
// When invoked from elsewhere: pass EL_MANIFEST env var.
let manifest_env: String = env("EL_MANIFEST")
let manifest_path: String = if str_len(manifest_env) > 0 {
manifest_env
} else {
"manifest.el"
}
// Create window from manifest.
let win: Int = window_from_manifest(manifest_path)
let g_window = win
if win < 0 {
println("Error: failed to create window. Is EL_TARGET_MACOS defined?")
exit_program(1)
}
// Build the widget tree.
app_build(win)
// Show the window.
window_show(win)
// Hand control to AppKit. Never returns.
native_run_loop()