XtAddGrab(3)
π XtAddGrab β redirect user input to a modal widget
okay bestie, so this is a page from the XT FUNCTIONS corner of the X world, and it's literally all about grabbing user input and being like "no babe, YOU'RE the main character right now" to exactly one widget. Two functions, one vibe: XtAddGrab and XtRemoveGrab. Let's get into it π«Ά
β¨ NAME β¨
XtAddGrab, XtRemoveGrab β redirect user input to a modal widget
πΈ SYNTAX πΈ
#include <X11/Intrinsic.h>
void XtAddGrab(Widget w, Boolean exclusive, Boolean spring_loaded);
void XtRemoveGrab(Widget w);
π ARGUMENTS π
exclusiveβ tells you whether user events should be dispatched exclusively to this widget, or also to the previous widgets up in the cascade. it's giving "do I share the spotlight or is this a solo performance" β¨spring_loadedβ tells you whether this widget got popped up because the user pressed a pointer button. like, was this a spring-loaded pop-up moment? π¦wβ the widget you're adding to (or removing from) the modal cascade. the actual star of the show π
π DESCRIPTION π
XtAddGrab β the adding era
So XtAddGrab appends the widget (and associated parameters) to the modal cascade, and it also checks that exclusive is True if spring_loaded is True. and if those aren't True?? it generates an error. no cap. π¨
how the modal cascade actually gets used π«
The modal cascade is what XtDispatchEvent consults when it's trying to dispatch a user event. the way that it works: when there's at least one modal widget in the widget cascade, XtDispatchEvent first determines if the event should be delivered. it starts at the most recent cascade entry and follows the cascade up to and including the most recent cascade entry that was added with the exclusive parameter True. periodt.
the active subset π
That subset of the modal cascade, plus all the descendants of those widgets, is what we call the active subset. user events that happen outside the widgets in this subset get ignored or remapped β sorry not sorry π
some real-world tea for you:
- Modal menus with submenus generally add a submenu widget to the cascade with
exclusiveset toFalse. - Modal dialog boxes that need to restrict user input to the most deeply nested dialog box add a subdialog widget to the cascade with
exclusiveset toTrue.
User events that occur within the active subset get delivered to the appropriate widget, which is usually a child or a further descendant of the modal widget. π
remap events, the special ones β¨
Regardless of where on the screen they occur, remap events are always delivered to the most recent widget in the active subset of the cascade that has spring_loaded True β if any such widget exists, that is. iykyk π
XtRemoveGrab β the removal arc π
XtRemoveGrab removes widgets from the modal cascade, starting at the most recent widget and going up to and including the specified widget. and it issues an error if the specified widget is not on the modal cascade. so like, don't try to remove something that was never there, bestie. π
β οΈ heads up: ifexclusiveisn'tTruewhilespring_loadedisTrue,XtAddGrabgenerates an error. and if you try toXtRemoveGraba widget that isn't in the cascade, that's an error too. read the vibe check before you commit π
π SEE ALSO π
- X Toolkit Intrinsics - C Language Interface
- Xlib - C Language X Interface
and that's the whole page, bestie!! this one came from X Version 11, libXt 1.3.1, and it's literally the XtAddGrab(3) page. slay, go forth and grab some input β¨ππ¦π
π¦ 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