aboutsummaryrefslogtreecommitdiff
path: root/prototypes
diff options
context:
space:
mode:
authorPřemysl Janouch <p@janouch.name>2018-08-21 20:47:06 +0200
committerPřemysl Janouch <p@janouch.name>2018-09-02 18:25:34 +0200
commit215e3e863003d8c62600507b5e302a7f4da2de55 (patch)
treec60b1870d5b0acb99dd35dfcb49149b9d77c4d9d /prototypes
parent44b01ccb177bf188efc416609e95892dd7d77977 (diff)
downloadhaven-215e3e863003d8c62600507b5e302a7f4da2de55.tar.gz
haven-215e3e863003d8c62600507b5e302a7f4da2de55.tar.xz
haven-215e3e863003d8c62600507b5e302a7f4da2de55.zip
xgb-render: add some comments
Some containing code to list out potentially interesting information from the X server.
Diffstat (limited to 'prototypes')
-rw-r--r--prototypes/xgb-xrender.go27
1 files changed, 26 insertions, 1 deletions
diff --git a/prototypes/xgb-xrender.go b/prototypes/xgb-xrender.go
index 73b5fed..3ae51ad 100644
--- a/prototypes/xgb-xrender.go
+++ b/prototypes/xgb-xrender.go
@@ -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()
}
}
-
}