通过 _NET_WM_STRUT 和 _NET_WM_STRUT_PARTIAL 获得的保留桌面 space 上的位置工具栏

Position toolbar on reserved desktop space obtained with _NET_WM_STRUT and _NET_WM_STRUT_PARTIAL

我是 x11 调用的新手。

我正在 SLED11 上使用 QT 4.8 开发自定义应用程序工具栏。

我在将工具栏定位在通过 x11 调用(_NET_WM_STRUT 和 _NET_WM_STRUT_PARTIAL)

获得的保留 space 上时遇到问题

看一些论坛我了解到我必须保留工具栏区域以便其他应用程序 windows 无法覆盖它。我使用了 _NET_WM_STRUT 和 _NET_WM_STRUT_PARTIAL。

这是我用来预订 space:

的代码
void ToolbarWindow::dock(int width, int height)
{
   Display *display  = QX11Info::display();

   int insets[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
   insets[2] = height;
   insets[8] = 0;
   insets[9] = width;

   XChangeProperty(display,
                winId(),
                XInternAtom(QX11Info::display(), "_NET_WM_STRUT", False),
                XA_CARDINAL ,
                32,
                PropModeReplace,
                (unsigned char *)&insets, 4);

   XChangeProperty(display,
                 winId(),
                XInternAtom(QX11Info::display(), "_NET_WM_STRUT_PARTIAL", False),
                XA_CARDINAL ,
                32,
                PropModeReplace,
                (unsigned char *)&insets, 12);

}

这是我在创建工具栏时对 GUI 控制器的调用:

ToolbarWindow *toolbar = new ToolbarWindow(co);

toolbar->setGeometry(monitor->getX(), monitor->getY(), monitor->getWidth(), 170);
toolbar->show();

toolbar->dock(monitor->getWidth(), 170);

我看到的是 space 是保留的,但是我的工具栏 出现在 保留区域的下方。 但这不是我想要的,我想让所有其他 windows 留在下方(即使最大化)但不是我的工具栏...我为它保留了 space,我想要它填写 space...

谁能帮帮我?

谢谢。

n.m。'回答正确。

I have found that for this to work reliably, the window should be of type _NET_WM_TYPE_DOCK and you must first map it then move it to position, otherwise the WM may sometimes place it outside of it own strut. – n.m.

这是我添加的代码:

Atom tmp = XInternAtom(display, "_NET_WM_WINDOW_TYPE_DOCK", False);
XChangeProperty(display,
                winId(),
                XInternAtom(display, "_NET_WM_WINDOW_TYPE", False),
                XA_ATOM ,
                32,
                PropModeReplace,
                (unsigned char *)&tmp, 1);

非常感谢。