Create window without title bar

前端 未结 2 2030
伪装坚强ぢ
伪装坚强ぢ 2021-01-15 18:03

I am trying to create a simple panel for Openbox in Arch Linux using c++, but I cannot figure out how to remove the title bar from a window.

I am creating the window

2条回答
  •  死守一世寂寞
    2021-01-15 18:44

    A more correct way is to use the Extended Window Manager Hints.

    The idea is that you don't tell the window manager how to decorate or not your window, you just indicate the window type with _NET_WM_WINDOW_TYPE :

    Atom window_type = XInternAtom(display, "_NET_WM_WINDOW_TYPE", False);
    long value = XInternAtom(display, "_NET_WM_WINDOW_TYPE_DOCK", False);
    XChangeProperty(display, your_window, window_type,
       XA_ATOM, 32, PropModeReplace, (unsigned char *) &value,1 );
    

    "Dock" is the type for panels and taskbar. Usually they are undecorated and appear on all desktops. As written on the documentation, previously the _MOTIF_WM_HINTS property was used to define the appearance and decorations of the window. Window managers still support it, but _NET_WM_WINDOW_TYPE is prefered as it describe the function and let the window manager (and user) decide on the appearance and behavior of that type of window.

    Another interesting property for a panel is _NET_WM_STRUT_PARTIAL, to "reserve" space.

提交回复
热议问题