Skip to content

Instantly share code, notes, and snippets.

@jouyouyun
Created January 27, 2014 08:33
Show Gist options
  • Save jouyouyun/8644930 to your computer and use it in GitHub Desktop.
Save jouyouyun/8644930 to your computer and use it in GitHub Desktop.
Test Window
package main
import (
"fmt"
"github.com/BurntSushi/xgb"
"github.com/BurntSushi/xgb/xproto"
)
func main() {
X, err := xgb.NewConn()
if err != nil {
panic(fmt.Sprintf("Unable to connect X server: %s\n", err))
}
wid, _ := xproto.NewWindowId(X)
setupInfo := xproto.Setup(X)
screen := setupInfo.DefaultScreen(X)
fmt.Println("Root window:", screen.Root)
err = xproto.CreateWindowChecked(X,
screen.RootDepth,
wid, screen.Root, 0, 0, 150, 150, 0,
xproto.WindowClassInputOnly, screen.RootVisual,
//xproto.WindowClassInputOutput, screen.RootVisual,
0,
//xproto.CwBackPixel|xproto.CwEventMask,
[]uint32{
0xffffffff,
xproto.EventMaskStructureNotify |
xproto.EventMaskKeyPress |
xproto.EventMaskKeyRelease}).Check()
if err != nil {
panic(fmt.Sprintln("Create Windoe Failed:", err))
}
xproto.MapWindow(X, wid)
X.Sync()
for {
}
}
@snyh
Copy link

snyh commented Jan 28, 2014

For window class InputOnly, the depth must be zero according to the x11protocol.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment