Tk_OwnSelection(3)

πŸ’… NAME πŸ’…

Okay so this is the Tk_OwnSelection(3) page from the Tk Library Procedures, and it's literally about making a window the owner of the primary selection. Main character energy for windows, no cap πŸ‘‘


✨ SYNOPSIS ✨

#include <tk.h>

Tk_OwnSelection(tkwin, selection, proc, clientData)

πŸŽ€ ARGUMENTS πŸŽ€

  • Tk_Window tkwin (in) β€” the window that's about to become the new selection owner. Go off, tkwin πŸ’–
  • Atom selection (in) β€” the name of the selection to be owned, like XA_PRIMARY. Iconic atom behavior.
  • Tk_LostSelProc *proc (in) β€” the procedure to invoke when tkwin loses selection ownership later. Think of it as the cleanup crew 🧹
  • void *clientData (in) β€” an arbitrary one-word value to pass to proc. A little surprise gift for later 🎁

🌸 DESCRIPTION 🌸

So Tk_OwnSelection arranges for tkwin to become the new owner of the selection specified by the atom selection. After this call completes, future requests for the selection will be directed to handlers created for tkwin using Tk_CreateSelHandler. Slay, that's the whole vibe.

When tkwin eventually loses the selection ownership, proc will be invoked so that the window can clean itself up β€” e.g. by unhighlighting the selection. Very demure, very mindful cleanup 🫢

proc should have arguments and result that match the type Tk_LostSelProc:

typedef void Tk_LostSelProc(
        void *clientData);

The clientData parameter to proc is a copy of the clientData argument given to Tk_OwnSelection, and is usually a pointer to a data structure containing application-specific information about tkwin. Basically a little VIP pass back to your own data πŸ’³βœ¨


πŸ¦‹ KEYWORDS πŸ¦‹

  • own
  • selection owner

Bye bestie β€” this page is from Tk 4.0 and it's the Tk_OwnSelection(3) page. The footer doesn't give a date, so that's the whole source/version moment. Periodt πŸ«ΆπŸ’œ

πŸ“¦ where this page comes from