Tk_OwnSelection(3tk)
π Tk_OwnSelection β bestie, you're the owner now π
okay so this is Tk_OwnSelection(3tk) from the Tk Library Procedures, and it's literally about handing your window the aux cord for the primary selection. let's get into it π
β¨ NAME β¨
Tk_OwnSelection β make a window the owner of the primary selection π
πΈ SYNOPSIS πΈ
#include <tk.h>
Tk_OwnSelection(tkwin, selection, proc, clientData)
π¦ ARGUMENTS π¦
Tk_Window tkwin(in) β the window that's about to become the shiny new selection owner. main character behavior, honestly.Atom selection(in) β the name of the selection you're claiming, likeXA_PRIMARYfor example.Tk_LostSelProc *proc(in) β the procedure that gets invoked later whentkwinloses selection ownership. think of it as the "you're not the owner anymore" callback πvoid *clientData(in) β an arbitrary one-word value that gets passed along toproc. no questions asked, just vibes.
π DESCRIPTION π
So Tk_OwnSelection arranges for tkwin to become the new owner of the selection specified by the atom selection. Once this call finishes, future requests for that selection get directed to the handlers created for tkwin using Tk_CreateSelHandler. periodt.
And then, when tkwin eventually loses the selection ownership β yeah, it happens to everyone β proc will be invoked so the window can clean itself up (like, e.g. by unhighlighting the selection). so thoughtful of it π«Ά
proc should have arguments and a 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 that was given to Tk_OwnSelection, and it's usually a pointer to a data structure containing application-specific information about tkwin. iykyk π«
π₯ KEYWORDS π₯
own, selection owner
ngl bestie, if you skip the proc you're gonna be that window that never cleans up after itself, and nobody wants that energy π
slay, go own that selection β¨ππ
β with love, from the Tk Library Procedures, version 4.0, dated Tk_OwnSelection(3tk), which is giving vintage but still iconic ππ
π¦ where this page comes from
- debian trixie: tk9.0-doc 9.0.1-3
- ubuntu questing: tk9.0-doc 9.0.2-1
- ubuntu resolute: tk9.0-doc 9.0.3-1
- ubuntu stonking: tk9.0-doc 9.0.4-1
- Copyright (c) 1990-1994 The Regents of the University of California
- Copyright (c) 1994-1996 Sun Microsystems, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms