如何直接在桌面上画图?
我想知道如何在 X11 环境中使用 Cairo (用 C 语言)直接在根窗口上绘制,以制作小部件。我复制了tint2的部分代码,但它相当庞大,而且我唯一的结果并不令人满意。 我很高兴有一个完整的工作示例代码,或者至少有一些技巧或小程序可供学习。 谢谢你们!
I'm wondering how to draw directly on the root window in an X11 environment with Cairo (in C), in order to make widgets. I've copied some parts of the code of tint2, but it's quite enormous, and the only result I have is not satisfying.
I would be pleased to have a complete working sample code, or at least some tips or little programs to study.
Thank you guys !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
“底部”窗口是根窗口。问题是,在某些桌面环境中,我们的窗口位于根窗口之上,因此,如果您更改根窗口,您将看不到所做的更改:您需要更改顶部的窗口。
该程序执行您所要求的操作:在根窗口上绘图。要测试它,我建议您:
然后,返回 X(ctrl+alt+f7 或 f8)并运行该程序。
如果你想在 Nautilus 的顶部窗口上绘图,你需要找出它的窗口 ID,然后将其用作“w”变量。 “xwininfo”命令可能会帮助您测试......
The "bottom" window is the root window. The problem is that in some desktop environments we have windows on top of the root window, so if you change the root window, you won't see your changes: you need to change the window that's on the top.
This program does what you ask for: draw on the root window. To test it, I suggest you to:
Then, go back to X (ctrl+alt+f7 or maybe f8) and run the program.
If you want to draw on Nautilus' top window, you will need to find out its window ID and then use it as the "w" variable. The "xwininfo" command might help you testing...