Search code examples
x11xlibxcbopenbox

Can't reserve space for window with xcb


I'm trying to create a status bar in rust using xcb. I have written one already in C++ already using a mix of xcb and xlib so I'll be using that as a point of comparison. I'm also testing this on openbox which is a window manager written in xlib if that matters.

I'm currently unable to reserve space for my bar in the rust version. Below is the full output of xprop

WM_CLASS(STRING) = "onyxbar"
WM_NAME(STRING) = "bar"
_NET_WM_STRUT(CARDINAL) = 0, 0, 20, 0
_NET_WM_STRUT_PARTIAL(CARDINAL) = 0, 0, 20, 0, 0, 0, 0, 0, 1920, 3840, 0, 0
_NET_WM_STATE(ATOM) = _NET_WM_STATE_STICKY, _NET_WM_STATE_ABOVE
_NET_WM_WINDOW_TYPE(CARDINAL) = _NET_WM_WINDOW_TYPE_DOCK

you can see that the relevant _NET_WM_STRUT and _NET_WM_STRUT_PARTIAL are the same between this and the xprop output for my working bar in c++:

WM_STATE(WM_STATE):
                window state: Normal
                icon window: 0x0
_NET_WM_ALLOWED_ACTIONS(ATOM) = _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_BELOW
_KDE_NET_WM_FRAME_STRUT(CARDINAL) = 0, 0, 0, 0
_NET_FRAME_EXTENTS(CARDINAL) = 0, 0, 0, 0
_NET_WM_ICON(CARDINAL) =        Icon (48 x 48):  (some big ascii icon)
_OB_APP_TYPE(UTF8_STRING) = "dock"
_OB_APP_TITLE(UTF8_STRING) = "bar"
_OB_APP_GROUP_CLASS(UTF8_STRING) =
_OB_APP_GROUP_NAME(UTF8_STRING) =
_OB_APP_CLASS(UTF8_STRING) =
_OB_APP_NAME(UTF8_STRING) = "limebar"
_OB_APP_ROLE(UTF8_STRING) =
_NET_WM_VISIBLE_ICON_NAME(UTF8_STRING) = "bar"
_NET_WM_VISIBLE_NAME(UTF8_STRING) = "bar"
WM_CLASS(STRING) = "limebar", "", "", "", "", ""
WM_NAME(STRING) = "bar"
_NET_WM_STRUT(CARDINAL) = 0, 0, 20, 0
_NET_WM_STRUT_PARTIAL(CARDINAL) = 0, 0, 20, 0, 0, 0, 0, 0, 1920, 3840, 0, 0
_NET_WM_DESKTOP(CARDINAL) = 4294967295
_NET_WM_STATE(ATOM) = _NET_WM_STATE_ABOVE
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_DOCK

Now of course there's some extra info in the C++ version's output but it is my understanding that it's only _NET_WM_STRUT and _NET_WM_STRUT_PARTIAL that matter when it comes to reserving space. What am I missing here?


Solution

  • Your working example has a WM_STATE property. The non-working does not.

    This property is set by the window manager when it manages a window. Are you perhaps creating an override-redirect window in the Rust version, but not in the C++ version?