Re: Examples on using xcb-util-wm?

Uli Schlachter <[email protected]>
Newsgroups gmane.comp.freedesktop.xcb
Message-ID <[email protected]>
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
-- 
Sent from my Game Boy.
_______________________________________________
Xcb mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/xcb
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.