xcb_get_input_focus(3)
β¨ xcb_get_input_focus β bestie, let's find out who has the keyboard β¨
okay so this is a page from the XCB Requests manual, and the star of the show is xcb_get_input_focus(3) π
it's the little request that asks the X11 server "hey queen, which window has the input focus rn?" π
πΈ NAME πΈ
xcb_get_input_focus β no fancy tagline, the manpage literally just leaves it at the name and a dash, and honestly? iconic minimalism π
π¦ SYNOPSIS π¦
First things first, you gotta pull in the header:
#include <xcb/xproto.h>
β¨ Request function β¨
xcb_get_input_focus_cookie_t xcb_get_input_focus(xcb_connection_t *conn,
π Reply datastructure π
this is the struct you get back, look at her:
typedef struct xcb_get_input_focus_reply_t {
uint8_t response_type;
uint8_t revert_to;
uint16_t sequence;
uint32_t length;
xcb_window_t focus;
} xcb_get_input_focus_reply_t;
π«Ά Reply function π«Ά
xcb_get_input_focus_reply_t
*xcb_get_input_focus_reply(xcb_connection_t *conn,
xcb_get_input_focus_cookie_t cookie, xcb_generic_error_t **e);
π REQUEST ARGUMENTS π
just the one bestie, and it's the usual suspect:
connβ the XCB connection to X11. it's your lil hotline to the server π
π REPLY FIELDS π
here's the tea on every single field you're getting back:
response_typeβ what kind of reply this is. in this case it'sXCB_GET_INPUT_FOCUS. this field also lives in thexcb_generic_reply_t, so you can use it to tell your replies apart from each other πsequenceβ the sequence number of the last request the X11 server processed. it's giving receipt tracking fr fr π§Ύlengthβ how long the reply is, measured in words. and yes, a word is 4 bytes in case you were about to guess πrevert_toβ one of these values, no cap:XCB_INPUT_FOCUS_NONEβ the focus reverts toXCB_NONE, so literally no window gets the input focus. the void. the nothingness. πXCB_INPUT_FOCUS_POINTER_ROOTβ the focus reverts toXCB_POINTER_ROOTrespectively. when the focus reverts,FocusInandFocusOutevents get generated, but the last-focus-change time does not change. okay subtle but important, noted πXCB_INPUT_FOCUS_PARENTβ the focus reverts to the parent (or the closest viewable ancestor) and the newrevert_tovalue becomesXCB_INPUT_FOCUS_NONE. it's giving "go ask your mom" energy π«£XCB_INPUT_FOCUS_FOLLOW_KEYBOARDβNOT YET DOCUMENTED. only relevant for the xinput extension. and then there's aTODO: NOT YET DOCUMENTED.sitting right there under it. bestie the docs said "we'll finish this later" and never came back π
focusβTODO: NOT YET DOCUMENTED. yeah. that's the whole description. the field that literally tells you which window is focused... undocumented π i know. i know.
π DESCRIPTION π
okay so the DESCRIPTION section on this page is... empty. nothing. a whole vibe. we move π§
β RETURN VALUE β
Returns an xcb_get_input_focus_cookie_t. πͺ
the catch: errors have to be handled when you call the reply function xcb_get_input_focus_reply. so don't just grab the cookie and ghost it, okay?
if you'd rather handle errors in the event loop instead, use xcb_get_input_focus_unchecked. see xcb-requests(3) for the details on all that π
π₯ ERRORS π₯
This request does never generate any errors. zero. none. not a single one. slay π
π SEE ALSO π
(also empty on this page β the original just leaves the heading hanging there like an unread text π)
πΈ AUTHOR πΈ
Generated from xproto.xml. got corrections or improvements? hit up xcb@lists.freedesktop.org π§
and that's the whole page bestie π«Ά this one came from X Version 11 and libxcb 1.17.0, and it's filed under the xcb_get_input_focus(3) name. go get that focus, main character π
β¨π
π¦ where this page comes from
- alpine 3.22: libxcb-doc 1.17.0-r0 Β· MIT
- alpine 3.23: libxcb-doc 1.17.0-r1 Β· MIT
- alpine 3.24: libxcb-doc 1.17.0-r2 Β· MIT
- arch rolling: libxcb 1.17.0-1 Β· X11
- centos-stream 10: libxcb-devel 1.17.0-3.el10 Β· X11
- debian trixie: libxcb-doc 1.17.0-2
- fedora 43: libxcb-devel 1.17.0-6.fc43 Β· X11
- fedora 43: libxcb-devel 1.17.0-6.fc43 Β· X11
- fedora 44: libxcb-devel 1.17.0-7.fc44 Β· X11
- fedora 44: libxcb-devel 1.17.0-7.fc44 Β· X11
- nixpkgs unstable: libxcb 1.17.0
- opensuse-leap 16.0: libxcb-devel-doc 1.17.0-160000.2.2 Β· MIT
- ubuntu questing: libxcb-doc 1.17.0-2build1
- ubuntu resolute: libxcb-doc 1.17.0-2ubuntu1
- ubuntu stonking: libxcb-doc 1.17.0-2ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms