[Xcb] Examples on using xcb-util-wm?

Christophe Lohr christophe.lohr at cegetel.net
Fri Sep 28 06:41:44 UTC 2018


Hi,
  Many thanks for your indications.

Could you please tell me more about the  _unchecked()  variants ?

Is it because sometimes the X11 specifications says "This property
SHOULD be set and updated by the Window Manager." ?
Or is it because errors are managed in a specific way?
or something else?

Regards
Christophe


Le 27/09/2018 à 18:21, Uli Schlachter a écrit :
> On 27.09.2018 17:41, Christophe Lohr wrote:
>> Hi,
>>   I'm looking for some piece of code showing the use of the xcb_ewmh module.
>> Let say I want to retreive _NET_CURRENT_DESKTOP and _NET_CLIENT_LIST
>> (i.e. or something like the "wmctrl -l" command)
>> How to proceed?
>> What documentation should I read?
> I took a look at the header file:
>
> You begin by initializing a xcb_ewmh_connection_t via
>
>  xcb_ewmh_connection_t ewmh;
>  if (!xcb_ewmh_init_atoms_replies(&ewmh,
>      xcb_ewmh_init_atoms(c, &ewmh), NULL))
>    puts("init failed");
>
> Then you can query _NET_CURRENT_DESKTOP via:
>
>   uint32_t current_desktop;
>   xcb_ewmh_get_current_desktop_reply(&ewmh,
>     xcb_ewmh_get_current_desktop(&ewmh, 0),
>     &current_desktop, 0);
> (This function returns 0 on errors)
> (now current_desktop contains the current desktop value)
>
>
> Querying the client list works similar, but instead of an uint32_t, you
> get an xcb_ewmh_get_windows_reply_t that is filled for you. This has a
> an array ->windows of size ->windows_len containing the windows.
>
> You can clean this up with xcb_ewmh_get_windows_reply_wipe() (think: free).
>
> I hope this helps.
>
> Cheers,
> Uli



More information about the Xcb mailing list