aboutsummaryrefslogtreecommitdiff
path: root/nexgb/examples/window.go
diff options
context:
space:
mode:
authorAndrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu>2012-05-07 04:09:19 -0400
committerAndrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu>2012-05-07 04:09:19 -0400
commitdc48249e1acea54b391f53b95f16e515dead7c97 (patch)
tree3467fee8294f8800977de0df3030d82e69bb7528 /nexgb/examples/window.go
parent3bf376bd6648e011de9131c1d90a39c6d3890d65 (diff)
downloadhaven-dc48249e1acea54b391f53b95f16e515dead7c97.tar.gz
haven-dc48249e1acea54b391f53b95f16e515dead7c97.tar.xz
haven-dc48249e1acea54b391f53b95f16e515dead7c97.zip
lots of docs and examples
Diffstat (limited to 'nexgb/examples/window.go')
-rw-r--r--nexgb/examples/window.go61
1 files changed, 0 insertions, 61 deletions
diff --git a/nexgb/examples/window.go b/nexgb/examples/window.go
deleted file mode 100644
index 68fe27b..0000000
--- a/nexgb/examples/window.go
+++ /dev/null
@@ -1,61 +0,0 @@
-package main
-
-import (
- "fmt"
- "log"
-
- "github.com/BurntSushi/xgb"
-)
-
-func main() {
- X, err := xgb.NewConn()
- if err != nil {
- log.Fatal(err)
- }
-
- wid, _ := X.NewId()
- X.CreateWindow(X.DefaultScreen().RootDepth, wid, X.DefaultScreen().Root,
- 0, 0, 500, 500, 0,
- xgb.WindowClassInputOutput, X.DefaultScreen().RootVisual,
- 0, []uint32{})
- X.ChangeWindowAttributes(wid, xgb.CwEventMask | xgb.CwBackPixel,
- []uint32{0xffffffff, xgb.EventMaskKeyPress | xgb.EventMaskKeyRelease})
-
- err = X.MapWindowChecked(wid).Check()
- if err != nil {
- fmt.Printf("Checked Error for mapping window %d: %s\n", wid, err)
- } else {
- fmt.Printf("Map window %d successful!\n", wid)
- }
-
- err = X.MapWindowChecked(0x1).Check()
- if err != nil {
- fmt.Printf("Checked Error for mapping window 0x1: %s\n", err)
- } else {
- fmt.Printf("Map window 0x1 successful!\n")
- }
-
- for {
- ev, xerr := X.WaitForEvent()
- if ev == nil && xerr == nil {
- log.Fatal("Both event and error are nil. Exiting...")
- }
-
- if ev != nil {
- fmt.Printf("Event: %s\n", ev)
- }
- if xerr != nil {
- fmt.Printf("Error: %s\n", xerr)
- }
-
- if xerr == nil {
- geom, err := X.GetGeometry(0x1).Reply()
- if err != nil {
- fmt.Printf("Geom Error: %#v\n", err)
- } else {
- fmt.Printf("Geometry: %#v\n", geom)
- }
- }
- }
-}
-