如何在所有其他窗口之上创建一个X窗口/客户端,而不是在WM控制下,并且没有输入?(覆盖、OSD)

时间:2022-07-03 15:53:25

I want to write applications (or use existing ones, that would be even more convenient) that behave like a hardware screens OSD (on screen display), only without input.

我想编写应用程序(或者使用现有的应用程序,这样会更方便),它们的行为就像一个硬件屏幕OSD(在屏幕上显示),只是不需要输入。

That is: A graphical output (e.g. from a GUI toolkit like Qt or Gtk) is placed on a layer where it is above even fullscreen-windows like Firefox F11 mode or a video player in fullscreen mode. That includes "above" the mouse cursor as well, so technically and graphically the mouse cursor would move below this widget. I don't know about real fullscreen applications with SDL or OpenGL though, but this is not the requirement. If you know this as well please include it in your answer.

也就是说:图形输出(例如,来自Qt或Gtk的GUI工具包)被放置在一个层上,这个层甚至比全屏幕窗口(如Firefox F11模式)或全屏模式的视频播放器都要高。这也包括“上面”的鼠标指针,因此从技术上和图形上来说,鼠标指针将移动到这个小部件的下面。我不知道有SDL或OpenGL的全屏应用程序,但这不是必需的。如果你也知道这个,请把它写在你的答案里。

Real world applications are read-only overlays like a little webcam window, a TV-station like logo or premade annotations. So all in all this is meant for live presentations, streaming and recording of screencasts and tutorials with minimal post processing.

现实世界中的应用程序都是只读覆盖,比如一个小的网络摄像头窗口,一个像logo或预先制作的注解的电视站。所有这一切都是为了现场演示,流媒体和录制视频和教程,最少的后期处理。

My own hacked, unsuccesful, experiments showed at least that removing this window from the WM control ( I did this by choosing a GTK popup dialog instead of a real main window) lets you position in absolute coordinates and it will ignore things like virtual desktops and workspaces, which is good, so you can switch between those and the overlay/HUD will stay in place.

我自己砍的人士同成功人士区分开来,实验显示至少把这个窗口从WM控制(我选择一个GTK弹出对话框,而不是真正的主窗口)允许您在绝对坐标位置,它将忽略虚拟桌面和工作区,这很好,所以你可以切换和覆盖/住房和城市发展部将呆在的地方。

Of course this cannot be done in software with the same Z-value (top/bottom windows) as the hardware screen. So technically I am talking above all other windows but below the screensaver or lock-screen layer.

当然,这不能在与硬件屏幕具有相同z值(顶部/底部窗口)的软件中实现。所以从技术上讲,我说的是除屏保或锁屏层之外的所有其他窗口。

+1 internet for linking to docs and giving the right keywords.

+1互联网链接到文档并提供正确的关键字。

+2 internet for a working code example, language, gui-toolkit etc. doesn't matter.

+2 internet用于工作代码示例、语言、gui-toolkit等都不重要。

1 个解决方案

#1


2  

You probably need composite overlay window from Composite extension - see section 3.2 "Composite Overlay Window" extension docs. (cursor is above this window)

您可能需要复合扩展的复合覆盖窗口——请参阅第3.2节“复合覆盖窗口”扩展文档。(光标在窗口上方)

Version 0.3 of the protocol adds the Composite Overlay Window, which provides compositing managers with a surface on which to draw without interference. This window is always above normal windows and is always below the screen saver window. It is an InputOutput window whose width and height are the screen dimensions. Its visual is the root visual and its border width is zero. Attempts to redirect it using the composite extension are ignored. This window does not appear in the reply of the QueryTree request. It is also an override redirect window. These last two features make it invisible to window managers and other X11 clients. The only way to access the XID of this window is via the CompositeGetOverlayWindow request. Initially, the Composite Overlay Window is unmapped.

协议的0.3版本添加了复合覆盖窗口,它为复合管理器提供了一个可以在上面不受干扰地绘制的表面。这个窗口总是在普通窗口之上,并且总是在屏幕保护程序窗口之下。它是一个InputOutput窗口,其宽度和高度是屏幕尺寸。它的视觉是根视觉,它的边框宽度为零。忽略了使用复合扩展对其进行重定向的尝试。此窗口不会出现在QueryTree请求的回复中。它也是一个覆盖重定向窗口。最后两个特性使窗口管理器和其他X11客户端看不到它。访问这个窗口的XID的唯一方法是通过CompositeGetOverlayWindow请求。最初,复合覆盖窗口未被映射。

Example using node-x11:

使用node-x11示例:

var x11 = require('x11');

x11.createClient(function(err, display) {
    var X = display.client;
    var root = display.screen[0].root;
    X.require('composite', function(err, Composite) {
      Composite.GetOverlayWindow(root, function(err, overlay) {
        // already automatically mapped here:
        //
        // CompositeGetOverlayWindow returns the XID of the Composite Overlay
        // Window. If the window has not yet been mapped, it is mapped by this
        // request. When all clients who have called this request have terminated
        // their X11 connections the window is unmapped.
      });
    });
});

#1


2  

You probably need composite overlay window from Composite extension - see section 3.2 "Composite Overlay Window" extension docs. (cursor is above this window)

您可能需要复合扩展的复合覆盖窗口——请参阅第3.2节“复合覆盖窗口”扩展文档。(光标在窗口上方)

Version 0.3 of the protocol adds the Composite Overlay Window, which provides compositing managers with a surface on which to draw without interference. This window is always above normal windows and is always below the screen saver window. It is an InputOutput window whose width and height are the screen dimensions. Its visual is the root visual and its border width is zero. Attempts to redirect it using the composite extension are ignored. This window does not appear in the reply of the QueryTree request. It is also an override redirect window. These last two features make it invisible to window managers and other X11 clients. The only way to access the XID of this window is via the CompositeGetOverlayWindow request. Initially, the Composite Overlay Window is unmapped.

协议的0.3版本添加了复合覆盖窗口,它为复合管理器提供了一个可以在上面不受干扰地绘制的表面。这个窗口总是在普通窗口之上,并且总是在屏幕保护程序窗口之下。它是一个InputOutput窗口,其宽度和高度是屏幕尺寸。它的视觉是根视觉,它的边框宽度为零。忽略了使用复合扩展对其进行重定向的尝试。此窗口不会出现在QueryTree请求的回复中。它也是一个覆盖重定向窗口。最后两个特性使窗口管理器和其他X11客户端看不到它。访问这个窗口的XID的唯一方法是通过CompositeGetOverlayWindow请求。最初,复合覆盖窗口未被映射。

Example using node-x11:

使用node-x11示例:

var x11 = require('x11');

x11.createClient(function(err, display) {
    var X = display.client;
    var root = display.screen[0].root;
    X.require('composite', function(err, Composite) {
      Composite.GetOverlayWindow(root, function(err, overlay) {
        // already automatically mapped here:
        //
        // CompositeGetOverlayWindow returns the XID of the Composite Overlay
        // Window. If the window has not yet been mapped, it is mapped by this
        // request. When all clients who have called this request have terminated
        // their X11 connections the window is unmapped.
      });
    });
});