如何定义窗口堆叠顺序? [英] how to define window stacking order?

查看:372
本文介绍了如何定义窗口堆叠顺序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写自己的窗口管理器.我面临的一个问题是,我不了解如何定义窗口显示的顺序.我发现的唯一方法是使用 xcb_configure_window .但是它对我来说似乎非常有限:它只允许将窗口放在最上面,或者放在最下面(没有分层的概念).功能有限:(..

I'm trying to write my own window manager. One issue I faced is that I don't understand how to define in which order windows should be displayed. The only means I found is to use xcb_configure_window. But it looks very limited to me: it only allows either to rise the window on top of all, or put it to the very bottom (no notion of layers or something). What a limited functionality :(.

我真正想做的是定义窗口顺序并告诉X.或定义多层窗口(例如,正常,最重要,最重要).因此,我可以相对于它的层来升高(或降低)窗口.因此,较低层的窗口将永远不会覆盖较高层的窗口.

What I really would like to do is to define the window order and tell X about it. Or to define multiple layers of windows (e.g, normal, above all, below all). So I could rise (or lower) the window with respect to its layer. So windows from lower layers will not ever cover windows from upper layers.

那么,除了xcb_configure_window之外,是否还有其他库函数来定义窗口的顺序?还是我需要忍受它?那意味着我必须在窗口管理器中跟踪窗口的顺序.

So, is there any other library function to define the order of windows apart from xcb_configure_window? Or I need to live with it? That would mean I have to track the order of windows in my window manager.

链接到相关的XCB文档: https://www.x.org/releases/X11R7.6/doc/libxcb/tutorial/index.html#winstack

Link to relevant XCB documentation: https://www.x.org/releases/X11R7.6/doc/libxcb/tutorial/index.html#winstack

推荐答案

X11仅给您绝对最小值.没有层,也没有始终在上方或始终在下方的窗口.您可以自己编写所有精美的东西,通常是在窗口管理器中实现的.

X11 only gives you the absolute minimum. There are no layers or always-over or always-under windows. You implement all the fancy stuff yourself, typically in the window manager, which is what you are writing.

没有原始协议请求可立即更改窗口的堆叠顺序. Xlib具有执行此功能的XRestackWindows函数,但每个窗口使用一个配置请求.伪代码就是

There is no raw protocol request to change the stacking order of windows at once. Xlib has a function XRestackWindows which does that, but it uses one configure request per window. The pseudocode is just

 for each window in the list except the first
      change the stacking order to be under the previous window

就是这样.没什么比这更花哨的了.

That's it. Nothing more fancy than that.

您确实需要跟踪WM中的堆叠顺序以实现各层,因此,当程序尝试重新堆叠顶层窗口时,您将截获该请求并仅将其重新堆叠在其层内.

You do need to track the stacking order in your WM in order to implement layers, so that when a program tries to restack a top level window, you intercept the request and only restack it within its layer.

另一种实现图层的可能方法是拥有多个透明全屏窗口,并使用户的顶级窗口与这些窗口(而不是根窗口)相对.我不太确定它是否会一直工作,并且您需要以一种或另一种方式处理透明性,这需要透明性来支持硬件或复合扩展,或者可能两者兼有.

Another possible way to implement layers is to have several transparent full-screen windows and reparent users' top-level windows to those, instead of to the root window. I'm not totally sure it will always work though, and you need to deal with transparency in one way or another, which requires transparency supporting hardware or the composite extension or possibly both.

这篇关于如何定义窗口堆叠顺序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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