-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
40 lines (34 loc) · 799 Bytes
/
main.go
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
35
36
37
38
39
40
package main
import (
"fmt"
"image"
"github.com/jezek/xgo"
)
func main() {
d, err := xgo.OpenDisplay("")
if err != nil {
fmt.Println(err)
return
}
fmt.Printf("Display opened: %#v\n", d)
w, err := d.NewWindow(
xgo.WindowOperations{}.Size(image.Pt(100, 100)),
)
if err != nil {
fmt.Println(err)
return
}
fmt.Printf("Window created: %#v\n", w)
if err := w.Map(); err != nil {
fmt.Println(err)
return
}
fmt.Println("Window mapped")
//Note:
//if window is closed, so the connection is, and so the current program.
//TODO examine the panic error produced: panic: close of closed channel
//I have red, that this happens only on well behaved window managers
//see createAndHandleWindow example for window close handling
fmt.Println("<enter to end>")
fmt.Scanln()
}