Tk_InternAtom(3tk)
π NAME π
Tk_InternAtom, Tk_GetAtomName β bestie, these two are literally the cache managers for X atoms β¨
π SYNOPSIS π
#include <tk.h>
Atom
Tk_InternAtom(tkwin, name)
const char *
Tk_GetAtomName(tkwin, atom)
πΈ ARGUMENTS πΈ
Tk_Window tkwin(in) β your window token, bestie. It's what maps the atom or the name relative to one specific display, so like, everything is scoped to that display, okay? πconst char *name(in) β the string name that you want the atom for. Slay.Atom atom(in) β the atom you've got, and you want the matching string name back for it. Periodt.
π¦ DESCRIPTION π¦
Okay so these procedures are giving major XInternAtom and XGetAtomName energy β they're similar to those Xlib ones, fr fr. But listen:
Tk_InternAtom hands you back the atom identifier that goes with the string you passed in as name. π And here's the catch β that atom identifier is only valid for the display associated with tkwin. Not other displays. Just that one. Iykyk.
Tk_GetAtomName is the reverse vibe: it gives you the string that goes with atom on tkwin's display. And the string it returns? It lives in Tk's storage. So:
- the caller does not need to free that space when they're done with the string π«Ά
- and the caller should not modify the contents of the returned string π (hands off, bestie)
If there's no atomatomontkwin's display,Tk_GetAtomNamereturns the string"?bad atom?". Iconic little error string, honestly.
Now the actual main character moment: Tk caches everything that Tk_InternAtom and Tk_GetAtomName give back, so future calls asking for the same info get served straight from the cache without ever contacting the server. π No server round-trip, no waiting.
So like β Tk_InternAtom and Tk_GetAtomName are generally much faster than their Xlib counterparts, and you should use them in place of the Xlib procedures. That's not a suggestion, that's the move. π
β KEYWORDS β
atom, cache, display
okay that's the whole page bestie, mwah π β this was Tk's Tk_InternAtom(3tk), from the Tk library procedures, and yeah, that date/version energy at the bottom is all Tk, no cap. bye bestie, go intern some atoms πβ¨π¦
π¦ 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 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