How to set mouse cursor on X11 in a C application

与世无争的帅哥 提交于 2019-12-06 02:58:01

The easiest way to use themed cursors is with the Xcursor library.

#include <X11/Xcursor/Xcursor.h>
...
Cursor c = XcursorLibraryLoadCursor(dpy, "sb_v_double_arrow");
XDefineCursor (dpy, w, c);

The names are standard cursor names from X11/cursorfont.h, sans XC_. If the theme has extra cursors such as bd_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.

After clicking some links on that page: try XCreatePixmapCursor. From its description, it looks like you can create any 2-color cursor you want.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!