XFocusChangeEvent(3)
π¦ XFocusChangeEvent(3) β XLIB FUNCTIONS π¦
okay bestie, welcome to XFocusChangeEvent(3), the manual page from XLIB FUNCTIONS that explains the FocusIn and FocusOut event structure. This is not the whole Xlib saga β itβs the focus-event character arc, and itβs lowkey iconic. Letβs get into it. π
π NAME π
XFocusChangeEvent β FocusIn and FocusOut event structure. periodt.
β¨ STRUCTURES β¨
The structure for FocusIn and FocusOut events contains this exact code, no cap:
typedef struct {
int type; /* FocusIn or FocusOut */
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 window; /* window of event */
int mode; /* NotifyNormal, NotifyGrab, NotifyUngrab */
int detail;
/*
* NotifyAncestor, NotifyVirtual, NotifyInferior,
* NotifyNonlinear,NotifyNonlinearVirtual, NotifyPointer,
* NotifyPointerRoot, NotifyDetailNone
*/
} XFocusChangeEvent;
typedef XFocusChangeEvent XFocusInEvent;
typedef XFocusChangeEvent XFocusOutEvent;
When you receive these events, the structure members are set as follows. Vibe check each one:
typeβ set to the event type constant name that uniquely identifies it. For example, when the X server reports aGraphicsExposeevent to a client application, it sends anXGraphicsExposeEventstructure with thetypemember set toGraphicsExpose.displayβ set to a pointer to the display the event was read on.send_eventβ set toTrueif the event came from aSendEventprotocol request.serialβ set from the serial number reported in the protocol, but expanded from the 16-bit least-significant bits to a full 32-bit value. numbers but make it full, iykyk.windowβ set to the window that is most useful to toolkit dispatchers.
The window member is set to the window on which the FocusIn or FocusOut event was generated. This is the window used by the X server to report the event. The mode member is set to indicate whether the focus events are normal focus events, focus events while grabbed, focus events when a grab activates, or focus events when a grab deactivates. The X server can set the mode member to NotifyNormal, NotifyWhileGrabbed, NotifyGrab, or NotifyUngrab.
not me noticing the struct comment up top listsNotifyNormal,NotifyGrab, andNotifyUngrab, while the prose also namesNotifyWhileGrabbedβ both are in the original, bestie, so both stay. π«Ά
π¨ ordering tea: All FocusOut events caused by a window unmap are generated after any UnmapNotify event; however, the X protocol does not constrain the ordering of FocusOut events with respect to generated EnterNotify, LeaveNotify, VisibilityNotify, and Expose events. Thatβs the rule, fr fr.
Depending on the event mode, the detail member is set to indicate the notify detail and can be NotifyAncestor, NotifyVirtual, NotifyInferior, NotifyNonlinear, NotifyNonlinearVirtual, NotifyPointer, NotifyPointerRoot, or NotifyDetailNone. β¨
π SEE ALSO π
XAnyEvent(3)XButtonEvent(3)XCreateWindowEvent(3)XCirculateEvent(3)XCirculateRequestEvent(3)XColormapEvent(3)XConfigureEvent(3)XConfigureRequestEvent(3)XCrossingEvent(3)XDestroyWindowEvent(3)XErrorEvent(3)XExposeEvent(3)XGraphicsExposeEvent(3)XGravityEvent(3)XKeymapEvent(3)XMapEvent(3)XMapRequestEvent(3)XPropertyEvent(3)XReparentEvent(3)XResizeRequestEvent(3)XSelectionClearEvent(3)XSelectionEvent(3)XSelectionRequestEvent(3)XUnmapEvent(3)XVisibilityEvent(3)Xlib - C Language X Interface
cute sign-off: this page is from X Version 11, libX11 1.8.14, and the page is XFocusChangeEvent(3). the footer doesnβt show a date, so Iβm not inventing one β no cap. bye bestie, go handle those focus events with main character energy. πππ¦
π¦ where this page comes from
- alpine 3.24: libx11-doc 1.8.14-r0 Β· X11
- arch rolling: libx11 1.8.14-1 Β· MIT AND X11
- nixos 26.05: libx11 1.8.14
- nixpkgs unstable: libx11 1.8.14
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms