fullscreenxcbewmh

How do I provide the _NET_WM_STATE_FULLSCREEN hint with xcb?


I'm trying to write a fullscreen application with xcb for my own edification and I'm having trouble with the above. I've found a couple pieces of code that do this using Xlib, but none with xcb. I've found the xcb_ewmh_connection_t structure and I'm tentatively using it like this:

xcb_connection_t *Connection = xcb_connect(NULL, NULL);
xcb_ewmh_connection_t EWMH;
xcb_intern_atom_cookie_t *EWMHCookie = xcb_ewmh_init_atoms(Connection, &EWMH);

and then using the atoms inside the structure with EWMH._NET_WM_STATE, etc.

Given this little background, how can I go about hinting the window manager that the window should be fullscreen?


Solution

  • Examining xcb_ewmh.h, it looks to me like you also need to call

    if(!xcb_ewmh_init_atoms_replies(&EWMH, EWMHCookie, NULL))
        /* handle errors */;
    

    Once you've done that, the _NET_WM_STATE documentation should help for how to use this particular property.

    See the ICCCM section on Client Properties for background on this technique of using properties to communicate to the window manager.

    See the ChangeProperty request for how to set properties in general. That maps to the xcb_change_property function by the usual protocol stub rules.

    I hope that's enough references to get you going!