Created
January 27, 2014 08:33
-
-
Save jouyouyun/8644930 to your computer and use it in GitHub Desktop.
Test Window
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For window class InputOnly, the depth must be zero according to the x11protocol.txt