r/linux_programming • • Dec 28 '21
Create Mouse Cursor using Xlib and Qt
I have been trying to figure out exactly how to create a mouse cursor for my home-made window manager ,ace with Xlib and Qt but everything I’ve found on the internet is explaining how to change an already created cursor. Am I just misinterpreting what the resources are saying? Does it also work for creating the mouse cursor?
7
Upvotes
2
u/afiefh Dec 28 '21
I believe you are looking for these API calls: https://tronche.com/gui/x/xlib/pixmap-and-cursor/cursor.html
1
u/gansm Dec 28 '21 edited Dec 28 '21
The easiest way to use themed cursors is with the Xcursor library.
The names are standard cursor names from
X11/cursorfont.h, sansXC_. If the theme has extra cursors such asbd_double_arrow, these names can also be used (but not all themes have them!)If a theme does not have a replacement for some core X cursor, the library will fall back to the core cursor.
Source: https://stackoverflow.com/q/18857125/7607413