xcb_set_selection_owner(3)

πŸ“¦
version 1.17.0 Β· 4 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, debian trixie, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’… xcb_set_selection_owner β€” bestie's guide to claiming a selection

okay so this is a page from the XCB Requests part of the libxcb manual (that's the X protocol C binding situation, xcb_set_selection_owner(3)), and it's literally about becoming the owner of a selection. yes the whole page. let's go πŸŽ€


✨ NAME ✨

xcb_set_selection_owner β€” sets the owner of a selection 🫢


✨ SYNOPSIS ✨

#include <xcb/xproto.h>

🌸 Request function 🌸

xcb_void_cookie_t xcb_set_selection_owner(xcb_connection_t *conn,
       xcb_window_t owner, xcb_atom_t selection, xcb_timestamp_t time);

✨ REQUEST ARGUMENTS ✨

  • conn β€” your XCB connection to X11. the whole lil pipeline to the server, periodt.
  • owner β€” the new owner of the selection. πŸ‘‘

the special value XCB_NONE means the selection will have no owner. like, nobody's holding it. it's free real estate.

  • selection β€” the selection. that's it, that's the arg. πŸ’…
  • time β€” a timestamp, and it exists to avoid race conditions when you're running X over the network. so valid of it honestly.

here's the tea: the selection will not be changed if time is earlier than the current last-change time of the selection, or if it's later than the current X server time. otherwise, the last-change time gets set to the time you specified. πŸ•°οΈ

the special value XCB_CURRENT_TIME will be replaced with the current server time. iconic behaviour ngl.


✨ DESCRIPTION ✨

Makes window owner the owner of the selection selection, and updates the last-change time of the specified selection. slay. πŸ’–

TODO: briefly explain what a selection is. 🧚 (yes bestie, that's straight from the source, they left us a lil homework note and I'm not about to pretend it isn't there)

✨ RETURN VALUE ✨

Returns an xcb_void_cookie_t. Errors (if any) have to be handled in the event loop β€” that's the vibe, no shortcuts. 😭

If you want to handle errors directly with xcb_request_check instead, use xcb_set_selection_owner_checked. See xcb-requests(3) for details. πŸ¦‹


✨ ERRORS ✨

  • xcb_atom_error_t β€” selection does not refer to a valid atom. 🚫 (caught lacking, fr fr)

✨ SEE ALSO ✨

(yes it references itself. main character energy only. πŸ‘‘)


✨ AUTHOR ✨

Generated from xproto.xml. Contact xcb@lists.freedesktop.org for corrections and improvements. πŸ’Œ


and that's the whole page, bestie β€” every flag, every default, every atom error, all of it preserved πŸ’œ

this has been X Version 11, libxcb 1.17.0, living in the xcb_set_selection_owner(3) era. mwah, go claim your selection. πŸ’…βœ¨