1XSetInputFocus(3) XLIB FUNCTIONS XSetInputFocus(3)
2
3
4
6 XSetInputFocus, XGetInputFocus - control input focus
7
9 int XSetInputFocus(Display *display, Window focus, int revert_to, Time
10 time);
11
12 int XGetInputFocus(Display *display, Window *focus_return, int
13 *revert_to_return);
14
16 display Specifies the connection to the X server.
17
18 focus Specifies the window, PointerRoot, or None.
19
20 focus_return
21 Returns the focus window, PointerRoot, or None.
22
23 revert_to Specifies where the input focus reverts to if the window
24 becomes not viewable. You can pass RevertToParent, RevertTo‐
25 PointerRoot, or RevertToNone.
26
27 revert_to_return
28 Returns the current focus state (RevertToParent, RevertTo‐
29 PointerRoot, or RevertToNone).
30
31 time Specifies the time. You can pass either a timestamp or Cur‐
32 rentTime.
33
35 The XSetInputFocus function changes the input focus and the last-focus-
36 change time. It has no effect if the specified time is earlier than
37 the current last-focus-change time or is later than the current X
38 server time. Otherwise, the last-focus-change time is set to the spec‐
39 ified time (CurrentTime is replaced by the current X server time).
40 XSetInputFocus causes the X server to generate FocusIn and FocusOut
41 events.
42
43 Depending on the focus argument, the following occurs:
44
45 · If focus is None, all keyboard events are discarded until a new
46 focus window is set, and the revert_to argument is ignored.
47
48 · If focus is a window, it becomes the keyboard's focus window. If
49 a generated keyboard event would normally be reported to this win‐
50 dow or one of its inferiors, the event is reported as usual. Oth‐
51 erwise, the event is reported relative to the focus window.
52
53 · If focus is PointerRoot, the focus window is dynamically taken to
54 be the root window of whatever screen the pointer is on at each
55 keyboard event. In this case, the revert_to argument is ignored.
56
57 The specified focus window must be viewable at the time XSetInputFocus
58 is called, or a BadMatch error results. If the focus window later
59 becomes not viewable, the X server evaluates the revert_to argument to
60 determine the new focus window as follows:
61
62 · If revert_to is RevertToParent, the focus reverts to the parent
63 (or the closest viewable ancestor), and the new revert_to value is
64 taken to be RevertToNone.
65
66 · If revert_to is RevertToPointerRoot or RevertToNone, the focus
67 reverts to PointerRoot or None, respectively. When the focus
68 reverts, the X server generates FocusIn and FocusOut events, but
69 the last-focus-change time is not affected.
70
71 XSetInputFocus can generate BadMatch, BadValue, and BadWindow errors.
72
73 The XGetInputFocus function returns the focus window and the current
74 focus state.
75
77 BadValue Some numeric value falls outside the range of values accepted
78 by the request. Unless a specific range is specified for an
79 argument, the full range defined by the argument's type is
80 accepted. Any argument defined as a set of alternatives can
81 generate this error.
82
83 BadWindow A value for a Window argument does not name a defined Window.
84
86 XWarpPointer(3)
87 Xlib - C Language X Interface
88
89
90
91X Version 11 libX11 1.6.5 XSetInputFocus(3)