-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlinux-window.oak
More file actions
34 lines (30 loc) · 858 Bytes
/
linux-window.oak
File metadata and controls
34 lines (30 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Minimal X11 top-level window sample using Linux stdlib wrappers.
{
println: println
string: string
} := import('std')
{
printf: printf
} := import('fmt')
linux := import('linux')
println('== Linux X11 Window Sample ==')
if linux.isLinux?() {
true -> {
state := linux.openDefaultWindow('Magnolia Linux Window', 800, 480)
if state.type {
:ok -> {
printf('Display: {{ 0 }} Window: {{ 1 }}', state.display, state.window)
eventBuf := linux.createXEventBuffer()
loopResult := linux.runWindowLoop(state.display, addr(eventBuf))
printf('Loop ended with: {{ 0 }}', string(loopResult))
linux.closeWindow(state)
}
_ -> {
println('openDefaultWindow failed.')
println(string(state))
println('Last error: ' + string(linux.lastErrorMessage()))
}
}
}
_ -> println('Not on Linux; skipping X11 window sample.')
}