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