diff options
author | Andrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu> | 2012-05-07 04:09:19 -0400 |
---|---|---|
committer | Andrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu> | 2012-05-07 04:09:19 -0400 |
commit | dc48249e1acea54b391f53b95f16e515dead7c97 (patch) | |
tree | 3467fee8294f8800977de0df3030d82e69bb7528 /nexgb/examples/randr.go | |
parent | 3bf376bd6648e011de9131c1d90a39c6d3890d65 (diff) | |
download | haven-dc48249e1acea54b391f53b95f16e515dead7c97.tar.gz haven-dc48249e1acea54b391f53b95f16e515dead7c97.tar.xz haven-dc48249e1acea54b391f53b95f16e515dead7c97.zip |
lots of docs and examples
Diffstat (limited to 'nexgb/examples/randr.go')
-rw-r--r-- | nexgb/examples/randr.go | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/nexgb/examples/randr.go b/nexgb/examples/randr.go deleted file mode 100644 index 064856d..0000000 --- a/nexgb/examples/randr.go +++ /dev/null @@ -1,48 +0,0 @@ -package main - -import ( - "fmt" - "log" - - "github.com/BurntSushi/xgb" -) - -func main() { - X, _ := xgb.NewConn() - - err := X.RegisterExtension("randr") - if err != nil { - log.Fatal(err) - } - - resources, err := X.RandrGetScreenResources(X.DefaultScreen().Root).Reply() - if err != nil { - log.Fatal(err) - } - - for _, output := range resources.Outputs { - info, err := X.RandrGetOutputInfo(output, 0).Reply() - if err != nil { - log.Fatal(err) - } - - bestMode := info.Modes[0] - for _, mode := range resources.Modes { - if mode.Id == uint32(bestMode) { - fmt.Printf("Width: %d, Height: %d\n", mode.Width, mode.Height) - } - } - } - - fmt.Println("\n") - - for _, crtc := range resources.Crtcs { - info, err := X.RandrGetCrtcInfo(crtc, 0).Reply() - if err != nil { - log.Fatal(err) - } - fmt.Printf("X: %d, Y: %d, Width: %d, Height: %d\n", - info.X, info.Y, info.Width, info.Height) - } -} - |