1XSETDEVICEFOCUS(3) XSETDEVICEFOCUS(3)
2
3
4
6 XSetDeviceFocus, XGetDeviceFocus - control extension input device focus
7
9 #include <X11/extensions/XInput.h>
10
11 XSetDeviceFocus( Display *display,
12 XDevice *device,
13 Window focus,
14 int revert_to,
15 Time time);
16
17 XGetDeviceFocus( Display *display,
18 XDevice *device,
19 Window *focus_return,
20 int *revert_to_return,
21 int * time_return);
22
23 Arguments
24
25 display
26 Specifies the connection to the X server.
27
28 device
29 Specifies the device whose focus is to be queried or
30 changed.
31
32 focus
33 Specifies the window, PointerRoot, FollowKeyboard, or
34 None.
35
36 focus_return
37 Returns the focus window, PointerRoot, FollowKeyboard, or
38 None.
39
40 revert_to
41 Specifies where the input focus reverts to if the window
42 becomes not viewable. You can pass RevertToParent,
43 RevertToPointerRoot, RevertToFollowKeyboard, or
44 RevertToNone.
45
46 revert_to_return
47 Returns the current focus state RevertToParent,
48 RevertToPointerRoot, RevertToFollowKeyboard, or
49 RevertToNone.
50
51 time_return
52 Returns the last_focus_time for the device.
53
54 time
55 Specifies the time. You can pass either a timestamp or
56 CurrentTime.
57
59 The XSetDeviceFocus request changes the focus of the specified
60 device and its last-focus-change time. It has no effect if the
61 specified time is earlier than the current last-focus-change
62 time or is later than the current X server time. Otherwise, the
63 last-focus-change time is set to the specified time CurrentTime
64 is replaced by the current X server time). XSetDeviceFocus
65 causes the X server to generate DeviceFocusIn and
66 DeviceFocusOut events.
67
68 Depending on the focus argument, the following occurs:
69 * If focus is None , all device events are discarded until a
70 new focus window is set, and the revert_to argument is
71 ignored.
72 * If focus is a window, it becomes the device's focus window.
73 If a generated device event would normally be reported to
74 this window or one of its inferiors, the event is reported
75 as usual. Otherwise, the event is reported relative to the
76 focus window.
77 * If focus is PointerRoot, the focus window is dynamically
78 taken to be the root window of whatever screen the pointer
79 is on at each event from the specified device. In this
80 case, the revert_to argument is ignored.
81 * If focus is FollowKeyboard, the focus window is dynamically
82 taken to be the window to which the X keyboard focus is set
83 at each input event.
84
85 The specified focus window must be viewable at the time
86 XSetDeviceFocus is called, or a BadMatch error results. If the
87 focus window later becomes not viewable, the X server evaluates
88 the revert_to argument to determine the new focus window as
89 follows:
90 * If revert_to is RevertToParent, the focus reverts to the
91 parent (or the closest viewable ancestor), and the new
92 revert_to value is taken to be RevertToNone.
93 * If revert_to is RevertToPointerRoot,
94 RevertToFollowKeyboard, or RevertToNone, the focus reverts
95 to PointerRoot, FollowKeyboard, or None, respectively.
96
97 When the focus reverts, the X server generates DeviceFocusIn
98 and DeviceFocusOut events, but the last-focus-change time is
99 not affected.
100
101 Input extension devices are not required to support the ability
102 to be focused. Attempting to set the focus of a device that
103 does not support this request will result in a BadMatch error.
104 Whether or not given device can support this request can be
105 determined by the information returned by XOpenDevice. For
106 those devices that support focus, XOpenDevice will return an
107 XInputClassInfo structure with the input_class field equal to
108 the constant FocusClass (defined in the file XI.h).
109
110 XSetDeviceFocus can generate BadDevice, BadMatch, BadValue, and
111 BadWindow errors.
112
113 The XGetDeviceFocus request returns the focus window and the
114 current focus state.
115
116 Not all input extension devices can be focused. Attempting to
117 query the focus state of a device that can't be focused results
118 in a BadMatch error. A device that can be focused returns
119 information for input Class Focus when an XOpenDevice request
120 is made.
121
122 XGetDeviceFocus can generate BadDevice, and BadMatch errors.
123
125 BadDevice
126 An invalid device was specified. The specified device
127 does not exist or has not been opened by this client via
128 XOpenInputDevice. This error may also occur if the
129 specified device is the X keyboard or X pointer device.
130
131 BadValue
132 Some numeric value falls outside the range of values
133 accepted by the request. Unless a specific range is
134 specified for an argument, the full range defined by the
135 argument's type is accepted. Any argument defined as a
136 set of alternatives can generate this error.
137
138 BadWindow
139 A value for a Window argument does not name a defined
140 Window.
141
142 BadMatch
143 This error may occur if an XGetDeviceFocus or
144 XSetDeviceFocus request was made specifying a device
145 that the server implementation does not allow to be
146 focused.
147
148
149
150 05/04/2023 XSETDEVICEFOCUS(3)