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