how to define window stacking order?

后端 未结 2 1152
遥遥无期
遥遥无期 2021-01-22 09:12

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

2条回答
  •  有刺的猬
    2021-01-22 10:04

    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.

    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.

    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.

提交回复
热议问题