xfixes.GetCursorImage how to #26
Replies: 8 comments
-
Also when calling the function, I'm getting this |
Beta Was this translation helpful? Give feedback.
-
I've never worked, with
Please don't attach images with error messages. Always copy-paste text. It's easier to work with. Also the whole error message is very badly readable from your image. |
Beta Was this translation helpful? Give feedback.
-
sorry, this is the sample code, the line func main() {
X, err := xgb.NewConn()
if err != nil {
fmt.Println(err)
return
}
defer X.Close()
// xproto.Setup retrieves the Setup information from the setup bytes
// gathered during connection.
setup := xproto.Setup(X)
// This is the default screen with all its associated info.
screen := setup.DefaultScreen(X)
fmt.Println(screen.Root)
err = xfixes.Init(X)
if err != nil {
fmt.Println(err)
os.Exit(-1)
}
var cursorImageCookie xfixes.GetCursorImageCookie
cursorImageCookie = xfixes.GetCursorImage(X)
var cursorImageReply *xfixes.GetCursorImageReply
cursorImageReply, err = cursorImageCookie.Reply()
if err != nil {
fmt.Println(err)
os.Exit(-1)
}
fmt.Println(cursorImageReply.CursorImage)
} |
Beta Was this translation helpful? Give feedback.
-
You are not initializing the extension correctly: https://www.x.org/releases/X11R7.7/doc/fixesproto/fixesproto.txt |
Beta Was this translation helpful? Give feedback.
-
the library api only has this |
Beta Was this translation helpful? Give feedback.
-
I've asked ChatGPT how to do it and it suggests querying for version after xfixes init (for both xcb and xgb version) like this: // Query xfixes version
versionCookie := xfixes.QueryVersion(conn, xfixes.MajorVersion, xfixes.MinorVersion)
versionReply, err := versionCookie.Reply()
if err != nil {
log.Fatalf("Error: Cannot get xfixes version: %v\n", err)
} Note: I haven't tested it, so I don't know if ChatGPT is right, but from my previous experience it is mostly right and a good helper for debuging and source for inspiration. Note2: If you succeed to get and decode the cursor image, could you write an example (into examples dir) for getting the image and let's say writing it to a file, please? It would be a big help for future package users. |
Beta Was this translation helpful? Give feedback.
-
ok so I figured it out, but using raw xorg apis, will have to convert it to xgb analogy one more questions maybe you know the answer
etc |
Beta Was this translation helpful? Give feedback.
-
I don't know answer for your question, but my guess is, that xgb doesn't know anything about text fields in app, so the app has to set the cursors by itself. Just for curiosity I've asked ChatGPT your question, hope it helps. On the other note. I think this is not an issue. I'll convert this thread to Discussions. You can set this thread as answered, if you found the solution (feel free to share your findings) and maybe open new for your next question above. Have a nice time. |
Beta Was this translation helpful? Give feedback.
-
I'm trying to capture the screen with the cursor.
Seems I have to break this down into two steps
here is a sample code
how do I convert the
cursorImageReply.CursorImage
to a golangimage.Image
or any other golang image formatsBeta Was this translation helpful? Give feedback.
All reactions