xcb\_set\_input\_focus(3) XCB Requests xcb\_set\_input\_focus(3)

# [NAME](#NAME)

xcb\_set\_input\_focus - Sets input focus

# [SYNOPSIS](#SYNOPSIS)

**#include &lt;xcb/xproto.h&gt;**

## [Request function](#Request_function)

xcb\_void\_cookie\_t **xcb\_set\_input\_focus**(xcb\_connection\_t \**conn*, uint8\_t *revert\_to*, xcb\_window\_t *focus*, xcb\_timestamp\_t *time*);

# [REQUEST ARGUMENTS](#REQUEST_ARGUMENTS)

[*conn*](#conn)

The XCB connection to X11.

[*revert\_to*](#revert_to)

One of the following values:

[*XCB\_INPUT\_FOCUS\_NONE*](#XCB_INPUT_FOCUS_NONE)

The focus reverts to *XCB\_NONE*, so no window will have the input focus.

[*XCB\_INPUT\_FOCUS\_POINTER\_ROOT*](#XCB_INPUT_FOCUS_POINTER_ROOT)

The focus reverts to *XCB\_POINTER\_ROOT* respectively. When the focus reverts, FocusIn and FocusOut events are generated, but the last-focus-change time is not changed.

[*XCB\_INPUT\_FOCUS\_PARENT*](#XCB_INPUT_FOCUS_PARENT)

The focus reverts to the parent (or closest viewable ancestor) and the new revert\_to value is *XCB\_INPUT\_FOCUS\_NONE*.

[*XCB\_INPUT\_FOCUS\_FOLLOW\_KEYBOARD*](#XCB_INPUT_FOCUS_FOLLOW_KEYBOARD)

NOT YET DOCUMENTED. Only relevant for the xinput extension.

Specifies what happens when the *focus* window becomes unviewable (if *focus* is neither *XCB\_NONE* nor *XCB\_POINTER\_ROOT*).

[*focus*](#focus)

The window to focus. All keyboard events will be reported to this window. The window must be viewable (TODO), or a *xcb\_match\_error\_t* occurs (TODO).

If *focus* is *XCB\_NONE* (TODO), all keyboard events are discarded until a new focus window is set.

If *focus* is *XCB\_POINTER\_ROOT* (TODO), focus is on the root window of the screen on which the pointer is on currently.

[*time*](#time)

Timestamp to avoid race conditions when running X over the network.

The special value *XCB\_CURRENT\_TIME* will be replaced with the current server time.

# [DESCRIPTION](#DESCRIPTION)

Changes the input focus and the last-focus-change time. If the specified *time* is earlier than the current last-focus-change time, the request is ignored (to avoid race conditions when running X over the network).

A FocusIn and FocusOut event is generated when focus is changed.

# [RETURN VALUE](#RETURN_VALUE)

Returns an *xcb\_void\_cookie\_t*. Errors (if any) have to be handled in the event loop.

If you want to handle errors directly with *xcb\_request\_check* instead, use *xcb\_set\_input\_focus\_checked*. See [**xcb-requests(3)**](/man/os/libxcb/xcb-requests.3) for details.

# [ERRORS](#ERRORS)

[*xcb\_match\_error\_t*](#xcb_match_error_t)

The specified *focus* window is not viewable.

[*xcb\_value\_error\_t*](#xcb_value_error_t)

TODO: Reasons?

[*xcb\_window\_error\_t*](#xcb_window_error_t)

The specified *focus* window does not exist.

# [SEE ALSO](#SEE_ALSO)

[**xcb-requests**(3)](/man/os/libxcb/xcb-requests.3), [**xcb\_focus\_in\_event\_t**(3)](/man/os/libxcb/xcb_focus_in_event_t.3), [**xcb\_focus\_out\_event\_t**(3)](/man/os/libxcb/xcb_focus_out_event_t.3)

# [AUTHOR](#AUTHOR)

Generated from xproto.xml. Contact xcb@lists.freedesktop.org for corrections and improvements.

libxcb 1.17.0 X Version 11

---

Document: xcb_set_input_focus(3) from libxcb 1.17.0-r16 (Chainguard OS)
Source: https://gitlab.freedesktop.org/xorg/lib/libxcb.git
