XSelectionEvent(3)

✨ XSelectionEvent(3) β€” SelectionNotify Event Structure ✨

Okay bestie, so this page is from the XLIB FUNCTIONS section and it's literally all about XSelectionEvent β€” the structure for SelectionNotify events. I'm gonna walk you through it, no cap. πŸ’…


πŸ“¦ STRUCTURES πŸ“¦

The structure for SelectionNotify events contains:

typedef struct {
        int type;       /* SelectionNotify */
        unsigned long serial;   /* # of last request processed by server */
        Bool send_event;        /* true if this came from a SendEvent request */
        Display *display;       /* Display the event was read from */
        Window requestor;
        Atom selection;
        Atom target;
        Atom property;  /* atom or None */
        Time time;
} XSelectionEvent;

When you receive this event, the structure members are set as follows β€” and yes, I'm gonna break it down so you don't have to guess. 🫢

  • The type member is set to the event type constant name that uniquely identifies it. For example, when the X server reports a GraphicsExpose event to a client application, it sends an XGraphicsExposeEvent structure with the type member set to GraphicsExpose. Iconic.
  • The display member is set to a pointer to the display the event was read on.
  • The send_event member is set to True if the event came from a SendEvent protocol request.
  • The serial member is set from the serial number reported in the protocol but expanded from the 16-bit least-significant bits to a full 32-bit value.
  • The window member is set to the window that is most useful to toolkit dispatchers. Main character energy fr fr.

Now for the rest of the members β€” these are the ones that tell you all about the selection itself:

  • The requestor member is set to the window associated with the requestor of the selection.
  • The selection member is set to the atom that indicates the selection. For example, PRIMARY is used for the primary selection.
  • The target member is set to the atom that indicates the converted type. For example, PIXMAP is used for a pixmap.
  • The property member is set to the atom that indicates which property the result was stored on. If the conversion failed, the property member is set to None. 😭 (that's the sad path, bestie)
  • The time member is set to the time the conversion took place and can be a timestamp or CurrentTime.

πŸ‘€ SEE ALSO πŸ‘€

You already know I gotta shout out the whole squad β€” every single one of these is a real manpage, so go read them if you're curious:

And of course, the big one: Xlib - C Language X Interface β€” the whole vibe, iykyk. 🌈


Okay that's the whole page, bestie. This one's from X Version 11, libX11 1.8.14, and the date line says XSelectionEvent(3) β€” slay, you're all caught up! πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from