XtGrabKey(3)
π NAME π
okay bestie, welcome to the XtGrabKey page from the XT FUNCTIONS fam π this is the group of Intrinsics calls that manage grabs β and there's eight of them, so buckle up:
XtGrabKeyXtUngrabKeyXtGrabKeyboardXtUngrabKeyboardXtGrabButtonXtUngrabButtonXtGrabPointerXtUngrabPointer
β¨ SYNTAX β¨
the way you pull these in, no cap:
#include <X11/Intrinsic.h>
void XtGrabKey(Widget widget, KeyCode keycode, Modifiers modifiers,
Boolean owner_events, int pointer_mode, int keyboard_mode);
void XtUngrabKey(Widget widget, KeyCode keycode, Modifiers modifiers);
int XtGrabKeyboard(Widget widget, Boolean owner_events, int
pointer_mode, int keyboard_mode, Time time);
void XtUngrabKeyboard(Widget widget, Time time);
void XtGrabButton(Widget widget, int button, Modifiers modifiers,
Boolean owner_events, unsigned int event_mask, int pointer_mode,
int keyboard_mode, Window confine_to, Cursor cursor);
void XtUngrabButton(Widget widget, unsigned button, Modifiers
modifiers);
int XtGrabPointer(Widget widget, Boolean owner_events, unsigned int
event_mask, int pointer_mode, int keyboard_mode, Window
confine_to, Cursor cursor, Time time);
void XtUngrabPointer(Widget widget, Time time);
πΈ ARGUMENTS πΈ
widgetβ this is the widget in whose window the grab goes down. Must be of classCoreor a subclass thereof, fr fr, no exceptions.keycodemodifiersowner_eventspointer_modekeyboard_modetimebuttonconfine_tocursorβ all of the above just specify the arguments to the associated Xlib function call. that's the whole vibe. π«Ά
(yeah, one description for the whole little squad of them β they're passing the baton straight to Xlib and the docs are like "you know how Xlib works, girlie" π)
π DESCRIPTION π
π¦ XtGrabKey π¦
so XtGrabKey calls XGrabKey, and it hands over the widget's window as the grab window β but only if the widget is realized. The remaining arguments are exactly as for XGrabKey. If the widget is not realized, or gets unrealized later, the call to XGrabKey will be performed (again) when the widget is realized and its window becomes mapped. iconic deferred behavior β¨
In the future, if XtDispatchEvent is called with a KeyPress event matching the specified keycode and modifiers (which may be AnyKey or AnyModifier, respectively) for the widget's window, the Intrinsics will call XtUngrabKeyboard with the timestamp from the KeyPress event if either of these is true:
- There is a modal cascade and the widget is not in the active subset of the cascade and the keyboard was not previously grabbed, or
XFilterEventreturnsTrue.
π¦ XtUngrabKey π¦
XtUngrabKey calls XUngrabKey with the widget's window as the ungrab window β again, only if the widget is realized. The remaining arguments are exactly as for XUngrabKey. If the widget is not realized, XtUngrabKey removes a deferred XtGrabKey request, if any, for the specified widget, keycode, and modifiers. cleanup era π
π¦ XtGrabKeyboard π¦
if the specified widget is realized, XtGrabKeyboard calls XGrabKeyboard with the widget's window as the grab window. The remaining arguments and return value are exactly as for XGrabKeyboard. If the widget is not realized, XtGrabKeyboard immediately returns GrabNotViewable. and listen β no future ungrab is implied by XtGrabKeyboard. periodt.
π¦ XtUngrabKeyboard π¦
XtUngrabKeyboard calls XUngrabKeyboard with the specified time. that's it, that's the whole function, slay π
π¦ XtGrabButton π¦
XtGrabButton calls XGrabButton with the widget's window as the grab window if the widget is realized. The remaining arguments are exactly as for XGrabButton. If the widget is not realized, or is later unrealized, the call to XGrabButton will be performed (again) when the widget is realized and its window becomes mapped. same deferred glow-up as the key one π§
In the future, if XtDispatchEvent is called with a ButtonPress event matching the specified button and modifiers (which may be AnyButton or AnyModifier, respectively) for the widget's window, the Intrinsics will call XtUngrabPointer with the timestamp from the ButtonPress event if either of these is true:
- There is a modal cascade and the widget is not in the active subset of the cascade and the pointer was not previously grabbed, or
XFilterEventreturnsTrue.
π¦ XtUngrabButton π¦
XtUngrabButton calls XUngrabButton with the widget's window as the ungrab window if the widget is realized. The remaining arguments are exactly as for XUngrabButton. If the widget is not realized, XtUngrabButton removes a deferred XtGrabButton request, if any, for the specified widget, button, and modifiers. bye bye deferred request π
π¦ XtGrabPointer π¦
XtGrabPointer calls XGrabPointer with the widget's window as the grab window. The remaining arguments and return value are exactly as for XGrabPointer. If the widget is not realized, XtGrabPointer immediately returns GrabNotViewable. and heads up bestie β no future ungrab is implied by XtGrabPointer. same energy as the keyboard one, no cap π
π¦ XtUngrabPointer π¦
XtUngrabPointer calls XUngrabPointer with the specified time. short, sweet, iconic. β
quick vibe check:XtGrabKeyboardandXtGrabPointerare the two that bail out immediately withGrabNotViewableon an unrealized widget instead of deferring β the key and button versions are the ones that wait patiently for realization. don't mix those up, iykyk π
π SEE ALSO π
X Toolkit Intrinsics - C Language InterfaceXlib - C Language X Interface
that's the whole page babes π this was X Version 11, libXt 1.3.1, and you just read the XtGrabKey(3) manpage. go grab something (responsibly) πβ¨π¦
π¦ 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 (c) 1993, 1994 X Consortium
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms