XtOwnSelection(3)

๐Ÿ“ฆ
version 1.3.1 ยท 4 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, fedora 43, fedora 44, opensuse-leap 16.0

โœจ XtOwnSelection โ€” the "it's MY selection now bestie" era โœจ

okay so this is a page from the XT FUNCTIONS chapter of the X Toolkit Intrinsics (libXt) manual, and it's literally all about claiming ownership of a selection. like, XA_PRIMARY? XA_SECONDARY? XA_CLIPBOARD? all of it. three whole functions: XtOwnSelection, XtOwnSelectionIncremental, and XtDisownSelection. it's giving โœ‹ "set selection owner" โœ‹ and we're obsessed.


๐ŸŽ€ NAME ๐ŸŽ€

XtOwnSelection, XtOwnSelectionIncremental, XtDisownSelection โ€” set selection owner ๐Ÿ’…


๐ŸŒธ SYNTAX ๐ŸŒธ

#include <X11/Intrinsic.h>

Boolean XtOwnSelection(Widget w, Atom selection, Time time,
       XtConvertSelectionProc convert_proc, XtLoseSelectionProc
       lose_selection, XtSelectionDoneProc done_proc);

Boolean XtOwnSelectionIncremental(Widget w, Atom selection, Time time,
       XtConvertSelectionIncrProc convert_callback,
       XtLoseSelectionIncrProc lose_callback, XtSelectionDoneIncrProc
       done_callback, XtCancelConvertSelectionProc cancel_callback,
       XtPointer client_data);

void XtDisownSelection(Widget w, Atom selection, Time time);

like look at that. three signatures. the incremental one is the long one, she's the main character fr.


๐Ÿฆ‹ ARGUMENTS ๐Ÿฆ‹

  • convert_proc โ€” the procedure that gets called whenever someone requests the current value of the selection. so like, the "here's your data bestie" callback โœจ
  • done_proc โ€” the procedure called after the requestor has received the selection. or NULL if the owner is not interested in being called back (valid! self-care!). ๐Ÿ™ˆ
  • lose_selection โ€” the procedure called whenever the widget has lost selection ownership. or NULL if the owner is not interested in being called back. ๐Ÿ’€
  • selection โ€” an atom that describes the type of the selection. for example, XA_PRIMARY, XA_SECONDARY, or XA_CLIPBOARD. pick your fighter ๐ŸŽ€
  • time โ€” the timestamp that indicates when the selection ownership should commence, or is to be relinquished. timing is everything, no cap โฐ
  • w โ€” the widget that wishes to become the owner, or to relinquish ownership. it's her world and we're just living in it ๐Ÿ‘‘

๐Ÿ’– DESCRIPTION ๐Ÿ’–

XtOwnSelection ๐ŸŒˆ

The XtOwnSelection function informs the Intrinsics selection mechanism that a widget believes it owns a selection. "believes" is doing so much work there and honestly iconic of her.

It returns True if the widget has successfully become the owner and False otherwise. and the widget may fail to become the owner if some other widget has asserted ownership at a time later than this widget. so basically: if someone else claimed it later than you, you lost, sorry babe ๐Ÿ˜ญ

Note that widgets can lose selection ownership either because someone else asserted later ownership of the selection, or because the widget voluntarily gave up ownership of the selection. both paths, both valid.

also note that the lose_selection procedure is not called if the widget fails to obtain selection ownership in the first place. like if you never had it, you can't lose it. the math is mathing ๐Ÿงฎ

XtOwnSelectionIncremental โญ

The XtOwnSelectionIncremental procedure informs the Intrinsics incremental selection mechanism that the specified widget wishes to own the selection. it returns True if the specified widget successfully becomes the selection owner or False otherwise.

For more information about selection, target, and time, see Section 2.6 of the Inter-Client Communication Conventions Manual. iykyk ๐Ÿ“–

A widget that becomes the selection owner using XtOwnSelectionIncremental may use XtDisownSelection to relinquish selection ownership. yes bestie, you can hand it back.

XtDisownSelection ๐Ÿ’…

The XtDisownSelection function informs the Intrinsics selection mechanism that the specified widget is to lose ownership of the selection.

If the widget does not currently own the selection โ€” either because it lost the selection or because it never had the selection to begin with โ€” XtDisownSelection does nothing. literally nothing. it's a no-op and it's not embarrassed about it. ๐Ÿซถ

After a widget has called XtDisownSelection, its convert procedure is not called even if a request arrives later with a timestamp during the period that this widget owned the selection. so like, retroactive requests? blocked. respectfully. ๐Ÿšซ

However โ€” and this is the plot twist โ€” its done procedure will be called if a conversion that started before the call to XtDisownSelection finishes after the call to XtDisownSelection. so if the vibe was already in motion, it finishes its little journey. ๐Ÿงš

๐ŸŒŸ SEE ALSO ๐ŸŒŸ


and that's the whole page, bestie!! ๐Ÿ“ this little legend lives in X Version 11, shipped as part of libXt 1.3.1 โ€” go forth and own your selections, you absolute queen ๐Ÿ‘‘๐Ÿ’œ

๐Ÿ“ฆ where this page comes from