input focus

Steven J Abner pheonix.sja at att.net
Wed Apr 9 20:37:23 UTC 2025


Having issue trying to resolve what I've learned here and documentation.
Here's the code:

xcb_window_t
_get_focused(void) {

  xcb_window_t rWindow = 0;
  xcb_generic_error_t *err;
  xcb_get_input_focus_reply_t *r0
    = xcb_get_input_focus_reply(connection,
                           xcb_get_input_focus(connection), &err);
  xcb_flush(connection);
  if (r0 != NULL) {
    if (r0->length != 0) rWindow = r0->focus;
    free(r0);
  }
  return rWindow;
}

I get no error, I get no length, and response is 1 instead of 
XCB_GET_INPUT_FOCUS (42) documentation states. This is from debugger:

$1 = (xcb_generic_error_t *) 0x0
$2 = {response_type = 1 '\001', revert_to = 1 '\001', sequence = 14, 
length = 0, focus = 83886080}

Note that focus I believe is the correct response, or at least what I 
expected.

Questions: First, I am supposed to free reply? second, which replies do 
I not test to see if valid reply, third, is this gcc messing with me 
and I can use 'focus' result?
Ohh, am I using correctly?

Dazed and Confused (Steve)






More information about the Xcb mailing list