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

Uli Schlachter psychon at znc.in
Fri Sep 28 07:53:38 UTC 2018


Hi,

I would bet that the _unchecked() variants do the same thing that they
do in libxcb:

With a checked request, any error that this causes is returned to you
via the last argument to the _reply() function. For example:

xcb_generic_error *e = NULL;
xcb_get_FOO_reply(c, xcb_get_FOO(c), &e);

if FOO failed, e, will now point to the error.

If you use an unchecked request, the error is not given to you, but is
instead given to your main loop as an event (via e.g. xcb_wait_for_event()).

Cheers,
Uli

On 28.09.2018 08:41, Christophe Lohr wrote:
> 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
> 
> _______________________________________________
> Xcb mailing list
> Xcb at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/xcb
> 


-- 
Sent from my Game Boy.


More information about the Xcb mailing list