Tk_QueueWindowEvent(3)

πŸ’… Tk_QueueWindowEvent(3) β€” a Tk Library Procedures moment

ok so before we even start: this page lives in the Tk Library Procedures manual, and it's basically the group chat between your window events and Tcl's event queue. two functions, one whole vibe. let's get into it 🫢


✨ NAME ✨

Tk_CollapseMotionEvents, Tk_QueueWindowEvent β€” add a window event to the Tcl event queue (and control whether motion events get squished together, bestie)


🌸 SYNOPSIS 🌸

#include <tk.h>

int
Tk_CollapseMotionEvents(display, collapse)

Tk_QueueWindowEvent(eventPtr, position)

πŸŽ€ ARGUMENTS πŸŽ€

  • Display *display (in) β€” the display you're controlling motion-event-collapsing for. like, which screen are we talking about, be specific πŸ’…
  • int collapse (in) β€” tells it whether motion events should be collapsed or not. yes/no energy.
  • XEvent *eventPtr (in) β€” the event you're adding to the queue. highkey important: all the unused fields of the structure gotta be set to zero. not optional, not a suggestion. zero them out fr fr.
  • Tcl_QueuePosition position (in) β€” where in the queue the new event goes: TCL_QUEUE_TAIL, TCL_QUEUE_HEAD, or TCL_QUEUE_MARK.

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so Tk_QueueWindowEvent does the whole thing where it places a window event on Tcl's internal event queue so it can eventually get serviced. the way it works: it creates a Tcl_Event structure, copies the event into that structure, and then calls Tcl_QueueEvent to actually add the event to the queue. and then when the event eventually gets removed from the queue, it's processed just like all window events. iconic, no notes πŸ’–

now, the motion event lore: when multiple motion events are received for the same window in rapid succession, they are collapsed by default. that's just the default behavior, it's giving efficiency. but you can control this with Tk_CollapseMotionEvents. and here's the cute bit β€” Tk_CollapseMotionEvents always returns the previous value for collapse behavior on the display. so it's like, "here's your old setting back, bestie, you're welcome" ✨

the position argument to Tk_QueueWindowEvent has the same significance as it does for Tcl_QueueEvent β€” so if you want the details on that, go read the documentation for Tcl_QueueEvent. iykyk 🧚


⭐ KEYWORDS ⭐

callback, clock, handler, modal timeout, events


ngl this one's short but it matters β€” queue those events correctly and zero your unused struct fields, or the vibe check will fail 😭

made with love for the Tk fam, version 7.5, signed off on Tk_QueueWindowEvent(3) πŸ’œπŸŽ€πŸ’…

πŸ“¦ where this page comes from