xgb-render: add some comments

Some containing code to list out potentially interesting information
from the X server.
This commit is contained in:
Přemysl Eric Janouch 2018-08-21 20:47:06 +02:00
parent 44b01ccb17
commit 215e3e8630
Signed by: p
GPG Key ID: A0420B94F92B9493

View File

@ -73,11 +73,34 @@ func main() {
_ = xproto.MapWindow(X, wid)
/*
rfilters, err := render.QueryFilters(X, xproto.Drawable(wid)).Reply()
if err != nil {
log.Fatalln(err)
}
filters := []string{}
for _, f := range rfilters.Filters {
filters = append(filters, f.Name)
}
log.Printf("filters: %v\n", filters)
*/
pformats, err := render.QueryPictFormats(X).Reply()
if err != nil {
log.Fatalln(err)
}
/*
for _, pf := range pformats.Formats {
log.Printf("format %2d: depth %2d, RGBA %3x %3x %3x %3x\n",
pf.Id, pf.Depth,
pf.Direct.RedMask, pf.Direct.GreenMask, pf.Direct.BlueMask,
pf.Direct.AlphaMask)
}
*/
// Similar to XRenderFindVisualFormat.
// The DefaultScreen is almost certain to be zero.
var pformat render.Pictformat
@ -100,6 +123,8 @@ func main() {
if err != nil {
log.Fatalln(err)
}
// Dithering is not supported. :(
render.CreatePicture(X, pid, xproto.Drawable(wid), pformat, 0, []uint32{})
// Reserve an ID for the gradient.
@ -133,6 +158,7 @@ func main() {
return
}
// We could also use a transformation matrix for changes in size.
_ = render.CreateLinearGradient(X, gid,
render.Pointfix{F64ToFixed(0), F64ToFixed(0)},
render.Pointfix{F64ToFixed(0), F64ToFixed(float64(h) - 100)},
@ -172,5 +198,4 @@ func main() {
gradient()
}
}
}