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