1XGrabButton(3) XLIB FUNCTIONS XGrabButton(3)
2
3
4
6 XGrabButton, XUngrabButton - grab pointer buttons
7
9 int XGrabButton(Display *display, unsigned int button, unsigned int
10 modifiers, Window grab_window, Bool owner_events, unsigned int
11 event_mask, int pointer_mode, keyboard_mode, Window confine_to,
12 Cursor cursor);
13
14 int XUngrabButton(Display *display, unsigned int button, unsigned int
15 modifiers, Window grab_window);
16
18 button Specifies the pointer button that is to be grabbed or re‐
19 leased or AnyButton.
20
21 confine_to
22 Specifies the window to confine the pointer in or None.
23
24 cursor Specifies the cursor that is to be displayed or None.
25
26 display Specifies the connection to the X server.
27
28 event_mask
29 Specifies which pointer events are reported to the client.
30 The mask is the bitwise inclusive OR of the valid pointer
31 event mask bits.
32
33 grab_window
34 Specifies the grab window.
35
36 keyboard_mode
37 Specifies further processing of keyboard events. You can
38 pass GrabModeSync or GrabModeAsync.
39
40 modifiers Specifies the set of keymasks or AnyModifier. The mask is
41 the bitwise inclusive OR of the valid keymask bits.
42
43 owner_events
44 Specifies a Boolean value that indicates whether the pointer
45 events are to be reported as usual or reported with respect
46 to the grab window if selected by the event mask.
47
48 pointer_mode
49 Specifies further processing of pointer events. You can pass
50 GrabModeSync or GrabModeAsync.
51
53 The XGrabButton function establishes a passive grab. In the future,
54 the pointer is actively grabbed (as for XGrabPointer), the last-
55 pointer-grab time is set to the time at which the button was pressed
56 (as transmitted in the ButtonPress event), and the ButtonPress event is
57 reported if all of the following conditions are true:
58
59 • The pointer is not grabbed, and the specified button is logically
60 pressed when the specified modifier keys are logically down, and
61 no other buttons or modifier keys are logically down.
62
63 • The grab_window contains the pointer.
64
65 • The confine_to window (if any) is viewable.
66
67 • A passive grab on the same button/key combination does not exist
68 on any ancestor of grab_window.
69
70 The interpretation of the remaining arguments is as for XGrabPointer.
71 The active grab is terminated automatically when the logical state of
72 the pointer has all buttons released (independent of the state of the
73 logical modifier keys), at which point a ButtonRelease event is re‐
74 ported to the grabbing window.
75
76 Note that the logical state of a device (as seen by client applica‐
77 tions) may lag the physical state if device event processing is frozen.
78
79 This request overrides all previous grabs by the same client on the
80 same button/key combinations on the same window. A modifiers of Any‐
81 Modifier is equivalent to issuing the grab request for all possible
82 modifier combinations (including the combination of no modifiers). It
83 is not required that all modifiers specified have currently assigned
84 KeyCodes. A button of AnyButton is equivalent to issuing the request
85 for all possible buttons. Otherwise, it is not required that the spec‐
86 ified button currently be assigned to a physical button.
87
88 If some other client has already issued a XGrabButton with the same
89 button/key combination on the same window, a BadAccess error results.
90 When using AnyModifier or AnyButton, the request fails completely, and
91 a BadAccess error results (no grabs are established) if there is a con‐
92 flicting grab for any combination. XGrabButton has no effect on an ac‐
93 tive grab.
94
95 XGrabButton can generate BadCursor, BadValue, and BadWindow errors.
96
97 The XUngrabButton function releases the passive button/key combination
98 on the specified window if it was grabbed by this client. A modifiers
99 of AnyModifier is equivalent to issuing the ungrab request for all pos‐
100 sible modifier combinations, including the combination of no modifiers.
101 A button of AnyButton is equivalent to issuing the request for all pos‐
102 sible buttons. XUngrabButton has no effect on an active grab.
103
104 XUngrabButton can generate BadValue and BadWindow errors.
105
107 BadCursor A value for a Cursor argument does not name a defined Cursor.
108
109 BadValue Some numeric value falls outside the range of values accepted
110 by the request. Unless a specific range is specified for an
111 argument, the full range defined by the argument's type is
112 accepted. Any argument defined as a set of alternatives can
113 generate this error.
114
115 BadWindow A value for a Window argument does not name a defined Window.
116
118 XAllowEvents(3), XGrabPointer(3), XGrabKey(3), XGrabKeyboard(3),
119 Xlib - C Language X Interface
120
121
122
123X Version 11 libX11 1.7.0 XGrabButton(3)