gtk +/x11:有无复合管理器的半透明窗口? [英] Gtk+/X11: semitransparent windows with and without composite managers?

查看:39
本文介绍了gtk +/x11:有无复合管理器的半透明窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一些代码来使我的窗口(最好是窗口上的所有小部件)半透明.我知道我可以使用gtk_window_set_opacity()进行操作,但是它仅在复合管理器正在运行时才起作用,但是如果没有,该怎么办?我在Google上搜索了很多东西,发现很多代码甚至都不能编译,不起作用或只是概念证明.没有令人满意的解决方案.我不想弄糟X11 Xlib糟糕的API(我只是没有时间学习它).

I need some code for making my window (and preferably all widgets on it) semitransparent. I know i can play around with gtk_window_set_opacity(), but it works only when composite manager is running, but what if not? I've googled a lot, found lots of code that mostly doesn't even compile, doesn't work or just a proof of concept. No fulfilling solution. I don't want to mess with X11 Xlib awful API (I just don't have time to learn it).

在哪里可以找到这样的库/代码段?

Where to get such library/code snippet?

推荐答案

对此没有很好的答案(这是发明复合管理器的重要部分).如果您已经可以做到这一点,人们就不会发明整个合成管理器机制.

There's no good answer to this (which is a good part of why compositing managers were invented). If you could already do this, people wouldn't have invented the whole compositing manager mechanism.

唯一的排序答案是在旧的透明终端"等中使用的,该答案是基于对窗口下方内容的屏幕截图,然后在您自己的窗口中绘制屏幕截图.这是一个涉及Xlib的混乱局面,很难正确解决,不可能完全正确并且效率低下.不过,您也许可以做到.看一下支持透明性的终端的旧版本,我认为VTE曾经有此代码,而ZVT小部件确实做到了.例如,启蒙终端也是如此.

The only sort-of answer, used in old "transparent terminals" and the like, is based on making screenshots of the stuff underneath the window and then painting the screenshot in your own window. This is an Xlib-involving mess, hard to get mostly right, impossible to get completely correct, and inefficient. Still, you could do it perhaps. Look at old revisions of terminals supporting transparency, I think VTE used to have this code, ZVT widget certainly did. So did the Enlightenment terminal for example.

但实际上,要走的路是对没有CM的用户来说不透明.

But really the way to go is to just fall back to no transparency for users without a CM.

这篇关于gtk +/x11:有无复合管理器的半透明窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆