XtSetKeyboardFocus(3)
π XtSetKeyboardFocus(3) β XT FUNCTIONS π
okay bestie, gather round, we're doing keyboard focus today and honestly? it's giving main character energy. this is a page from the XT FUNCTIONS corner of the universe, and it's about making a specific child widget be the one who catches the focus events. slay.
β¨ NAME β¨
XtSetKeyboardFocus β focus events on a child widget π―
πΈ SYNTAX πΈ
#include <X11/Intrinsic.h>
void XtSetKeyboardFocus(Widget subtree, Widget descendant);
π ARGUMENTS π
subtreeβ this one's the vibe-setter. it specifies either the widget in the subtree structure that's gonna receive the keyboard event, orNone. and listen β it is not an error to passNonewhen no input focus was previously set, so don't panic, you're fine. π«Άdescendantβ this is the widget for which the keyboard focus is being set. the chosen one. the main character. π
π¦ DESCRIPTION π¦
so here's the tea: if a future KeyPress or KeyRelease event happens inside the specified subtree, XtSetKeyboardFocus makes XtDispatchEvent remap and send that event straight to the specified descendant widget. no cap, it just redirects the whole thing.
now, when there's no modal cascade going on, keyboard events can land inside a widget W in one of three ways:
Whas the X input focus. periodt. πWhas the keyboard focus of one of its ancestors, and the event occurs within the ancestor or one of the ancestor's descendants. (family business β¨)- No ancestor of
Whas a descendant within the keyboard focus, and the pointer is withinW. (pointer said "you're it" πΈ)
and when there is a modal cascade? then a widget W receives keyboard events if an ancestor of W is in the active subset of the modal cascade and one or more of the previous conditions is True. both boxes gotta be checked, bestie, it's not a suggestion. β
π the FocusIn / FocusOut situation π
when subtree or one of its descendants acquires the X input focus, or the pointer moves into the subtree such that keyboard events would now be delivered to subtree, a FocusIn event is generated for the descendant β but only if FocusNotify events have been selected by the descendant. iykyk. π
similarly, when W loses the X input focus or the keyboard focus for one of its ancestors, a FocusOut event is generated for descendant β again, only if FocusNotify events have been selected by the descendant. π
ngl the FocusNotify selection is doing a LOT of heavy lifting here. if the descendant didn't select them, those events are just... not happening. π
β SEE ALSO β
XtCallAcceptFocus(3)X Toolkit Intrinsics - C Language InterfaceXlib - C Language X Interface
and that's the whole page, bestie!! this one's from X Version 11, shipped with libXt 1.3.1, and it lives in the XT FUNCTIONS manual section. go set some keyboard focus, you absolute icon. πβ¨ππ¦πΈπ π«Ά
π¦ where this page comes from
- alpine 3.22: libxt-doc 1.3.1-r0 Β· MIT
- alpine 3.23: libxt-doc 1.3.1-r0 Β· MIT
- alpine 3.24: libxt-doc 1.3.1-r0 Β· MIT
- arch rolling: libxt 1.3.1-1 Β· MIT AND HPND-sell-variant AND SMLNJ AND MIT-open-group AND X11
- fedora 43: libXt-devel 1.3.1-3.fc43 Β· MIT AND HPND-sell-variant AND SMLNJ AND MIT-open-group AND X11
- fedora 43: libXt-devel 1.3.1-3.fc43 Β· MIT AND HPND-sell-variant AND SMLNJ AND MIT-open-group AND X11
- fedora 44: libXt-devel 1.3.1-4.fc44 Β· MIT AND HPND-sell-variant AND SMLNJ AND MIT-open-group AND X11
- fedora 44: libXt-devel 1.3.1-4.fc44 Β· MIT AND HPND-sell-variant AND SMLNJ AND MIT-open-group AND X11
- opensuse-leap 16.0: libXt-devel 1.3.1-160000.3.2 Β· MIT
- opensuse-leap 16.0: libXt-devel 1.3.1-160000.3.2 Β· MIT
- opensuse-leap 16.0: libXt-devel 1.3.1-160000.3.2 Β· MIT
- opensuse-leap 16.0: libXt-devel 1.3.1-160000.3.2 Β· MIT
- Copyright 1993 X Consortium
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms