C ++ - 在X窗口中更改光标 [英] C++ - change the cursor in an X Window
本文介绍了C ++ - 在X窗口中更改光标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我认为这很容易找到,但google搜索已经非常无益。有没有简单的api更改鼠标光标在你的X窗口? (我知道在Windows中你可以调用SetCursor)
I thought this would be easy to find, but a google search has been very unhelpful. Is there a simple api to change the mouse cursor in your X window? (I know in windows you can just call "SetCursor")
推荐答案
#include <X11/cursorfont.h>
/* ... */
Cursor c;
c = XCreateFontCursor(dpy, XC_xterm);
XDefineCursor(dpy, w, c);
其中dpy是您的显示,w是您的窗口,XC_xterm是一个常数,定义光标的形状。以下是可用光标形状的列表,以及图片。
Where dpy is your display, w is your window and XC_xterm is a constant defining the shape of your cursor. Here's a list of available cursor shape, along with images.
这篇关于C ++ - 在X窗口中更改光标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文