1XSetInputFocus(3)               XLIB FUNCTIONS               XSetInputFocus(3)
2
3
4

NAME

6       XSetInputFocus, XGetInputFocus - control input focus
7

SYNTAX

9       int  XSetInputFocus(Display *display, Window focus, int revert_to, Time
10              time);
11
12       int XGetInputFocus(Display *display,  Window  *focus_return,  int  *re‐
13              vert_to_return);
14

ARGUMENTS

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 be‐
24                 comes not viewable.  You can pass  RevertToParent,  RevertTo‐
25                 PointerRoot, or RevertToNone.
26
27       revert_to_return
28                 Returns  the  current focus state RevertToPointerRoot, or Re‐
29                 vertToNone).
30
31       time      Specifies the time.  You can pass either a timestamp or  Cur‐
32                 rentTime.
33

DESCRIPTION

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  is replaced by the current X server time).  XSetInputFocus
40       causes the X server to generate FocusIn and FocusOut events.
41
42       Depending on the focus argument, the following occurs:
43
44       •    If focus is None, all keyboard events are discarded  until  a  new
45            focus window is set, and the revert_to argument is ignored.
46
47       •    If  focus is a window, it becomes the keyboard's focus window.  If
48            a generated keyboard event would normally be reported to this win‐
49            dow or one of its inferiors, the event is reported as usual.  Oth‐
50            erwise, the event is reported relative to the focus window.
51
52       •    If focus is PointerRoot, the focus window is dynamically taken  to
53            be  the  root  window of whatever screen the pointer is on at each
54            keyboard event.  In this case, the revert_to argument is ignored.
55
56       The specified focus window must be viewable at the time  XSetInputFocus
57       is  called, or a BadMatch error results.  If the focus window later be‐
58       comes not viewable, the X server evaluates the  revert_to  argument  to
59       determine the new focus window as follows:
60
61       •    If  revert_to  is  RevertToParent, the focus reverts to the parent
62            (or the closest viewable ancestor), and the new revert_to value is
63            taken to be RevertToNone.
64
65       •    If revert_to is RevertToPointerRoot or RevertToNone, the focus re‐
66            verts to PointerRoot or None, respectively.  When  the  focus  re‐
67            verts, the X server generates FocusIn and FocusOut events, but the
68            last-focus-change time is not affected.
69
70       XSetInputFocus can generate BadMatch, BadValue, and BadWindow errors.
71
72       The XGetInputFocus function returns the focus window  and  the  current
73       focus state.
74

DIAGNOSTICS

76       BadValue  Some numeric value falls outside the range of values accepted
77                 by the request.  Unless a specific range is specified for  an
78                 argument,  the  full  range defined by the argument's type is
79                 accepted.  Any argument defined as a set of alternatives  can
80                 generate this error.
81
82       BadWindow A value for a Window argument does not name a defined Window.
83

SEE ALSO

85       XWarpPointer(3)
86       Xlib - C Language X Interface
87
88
89
90X Version 11                     libX11 1.7.0                XSetInputFocus(3)
Impressum