Tk_CreateC...sageHandler(3)
π NAME π
Okay so welcome to the Tk Library Procedures page for Tk_CreateC...sageHandler(3), bestie β the title is cursed-cute but the content is solid.
Tk_CreateClientMessageHandler,Tk_DeleteClientMessageHandlerβ associate procedure callback withClientMessagetype X events. π
β¨ SYNOPSIS β¨
#include <tk.h>
Tk_CreateClientMessageHandler(proc)
Tk_DeleteClientMessageHandler(proc)
π ARGUMENTS π
Tk_ClientMessageProc *proc(in) β procedure to invoke whenever aClientMessageX event occurs on any display.
π¦ DESCRIPTION π¦
So Tk_CreateClientMessageHandler sets things up so that proc gets invoked later, whenever a ClientMessage X event happens and it is not handled by WM_PROTOCOL. It's literally made for apps that need to watch X ClientMessage events β drag-and-drop apps, iykyk.
The callback to proc gets made by Tk_HandleEvent. Big caveat: this mechanism only works in programs that dispatch events through Tk_HandleEvent β or through other Tk procedures that call Tk_HandleEvent, like Tcl_DoOneEvent or Tk_MainLoop.
proc should have arguments and result that match the type Tk_ClientMessageProc:
typedef int Tk_ClientMessageProc(
Tk_Window tkwin,
XEvent *eventPtr);
The tkwin parameter to proc is the Tk window associated with this event. eventPtr is a pointer to the X event.
Whenever an X ClientMessage event is processed by Tk_HandleEvent, proc gets called if it wasn't handled as a WM_PROTOCOL. The return value from proc is normally 0. A non-zero return value means the event is not to be handled further β that is, proc has done all the processing that's allowed for the event. π«Ά
If there are multiple ClientMessage event handlers, each one is called for each event, in the order in which they were established. Periodt.
Tk_DeleteClientMessageHandler may be called to delete a previously-created ClientMessage event handler: it deletes each handler it finds that matches the proc argument. If no such handler exists, then Tk_DeleteClientMessageHandler returns without doing anything.
πΈ Tk does support having more than one callback with the same proc argument, but it's probably a bad idea. Not me warning you or anything. Just... don't.
π KEYWORDS π
bindcallbackeventhandler
That's the whole page from the Tk 8.4 manual, bestie β source/version is Tk 8.4, the footer didn't list a date, and the title is Tk_CreateC...sageHandler(3) πβ¨
π¦ where this page comes from
- alpine 3.23: tk9-doc 9.0.3-r0 Β· TCL
- alpine 3.24: tk9-doc 9.0.3-r2 Β· TCL
- fedora 43: tk-devel 1:9.0.2-1.fc43 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- fedora 43: tk-devel 1:9.0.2-1.fc43 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- fedora 44: tk-devel 1:9.0.2-1.fc44 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- fedora 44: tk-devel 1:9.0.2-1.fc44 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- nixos 26.05: tk 9.0.3
- nixpkgs unstable: tk 9.1.0
- Copyright (c) 2000 Ajuba Solutions
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms