[openbox] Best way to programmatically toggle decorations?

Oddbjørn Kvalsund oddbjorn at nixx.no
Fri Jun 9 08:18:49 EDT 2006

On Thu 08 Jun 16:05, Gary Scharf wrote:
> What's the best/simplest approach to programmatically setting the
> decorated/undecorated state of a window?

I hope this is not too off-topic, but I have a similar question; I have
found from googling that setting a windows state to fullscreen (from
within the application) can be a potentially tricky issue.
I have however used the following code with great success with openbox
(3.2.7) as my window-manager:

void setfullscreen(Display display, Window window)
    XEvent xev;
    XWindowAttributes attr;
    Atom state = XInternAtom(display, "_NET_WM_STATE", 0);
    Atom windowstate = XInternAtom(display, "_NET_WM_STATE_FULLSCREEN", 0);

    XGetWindowAttributes(display, window, &attr);

    xev.type = ClientMessage;
    xev.xclient.type = ClientMessage;
    xev.xclient.serial = 0;
    xev.xclient.send_event = 1;
    xev.xclient.display = display;
    xev.xclient.window = window;
    xev.xclient.message_type = state;
    xev.xclient.format = 32;
    xev.xclient.data.l[0] = 1;
    xev.xclient.data.l[1] = windowstate;
    xev.xclient.data.l[2] = None;

    XSendEvent(display, attr.root, False,
                SubstructureRedirectMask | SubstructureNotifyMask, &xev);

My question is this; is this code "enough" to follow the EWMH (1.3) standard?
I have, as I mentioned, found from testing locally that this works great with
openbox, but can I expect this to work with other (EWMH-compliant)
window-managers? What is your impression on EWMH adoption, can I expect the
above code to work with must current desktops (Gnome/KDE/Xfce)?
Should I perhaps add a check on _NET_WM_ALLOWED_ACTIONS to see that the
_NET_WM_STATE_FULLSCREEN state is supported?


Regards Oddbjørn Kvalsund

More information about the openbox mailing list