TICKIT_WINDOW_BIND_EVENT(3)

✨ TICKIT_WINDOW_BIND_EVENT(3) ✨

okay so bestie, welcome to the Library Functions Manual section for tickit_window_bind_event and tickit_window_unbind_event_id β€” the two functions that let you add and remove event handlers on a window. it's giving event-listener glow-up πŸ’…


🌸 NAME 🌸

tickit_window_bind_event, tickit_window_unbind_event_id β€” add or remove event handlers, no cap πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <tickit.h>

typedef int TickitWindowEventFn(TickitWindow *win, TickitEventFlags flags,
    void *info, void *user);

int tickit_window_bind_event(TickitWindow *win, TickitWindowEvent ev,
    TickitBindFlags flags,
    TickitWindowEventFn *fn, void *user);
void tickit_window_unbind_event_id(TickitWindow *win, int id);

Link with -ltickit. 🫢


πŸ’– DESCRIPTION πŸ’–

so tickit_window_bind_event() is the main character here: it adds a brand-new event handler to the list of handlers that the window is holding onto, and it hands you back an integer that identifies that handler. like a little name tag but make it a number ✨

this handler is gonna get invoked every time the event named by the ev argument happens. and when it does get invoked, func receives:

  • the window instance itself πŸͺŸ
  • a flags bitmask 🚩
  • a pointer to an event information structure β€” and bestie, the type of that struct depends on the event, so check which event you're binding for, iykyk
  • the user data pointer it was installed with πŸŽ€

then tickit_window_unbind_event_id() is the breakup function: it removes an event handler that was previously added, using the identifier that got returned when it was added. and if that handler was installed with TICKIT_BIND_UNBIND, it gets invoked with the TICKIT_EV_UNBIND flag on the way out. it's giving closure, literally 😭


⭐ RETURN VALUE ⭐

  • tickit_window_bind_event() returns an identifier integer πŸ‘‘
  • tickit_window_unbind_event_id() returns no value. nothing. silence. periodt. πŸ’€

🌈 SEE ALSO 🌈


and that's the whole page bestie, sourced from the TICKIT_WINDOW_BIND_EVENT(3) manual, page TICKIT_WINDOW_BIND_EVENT(3) β€” go bind some events and slay πŸ’…πŸ’–βœ¨