input focus

Peter Harris pharris2 at rocketsoftware.com
Wed Apr 9 21:03:24 UTC 2025


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

>   if (r0 != NULL) {
>     if (r0->length != 0) rWindow = r0->focus;

r0->length (the amount of extra data beyond the basic reply) is always 0 for get_input_focus (see GetInputFocus under https://www.x.org/releases/X11R7.7/doc/xproto/x11protocol.html#Encoding::Requests ), so this test will always fail and you'll never set rWindow.

> I get no error, I get no length, and response is 1 instead of
> XCB_GET_INPUT_FOCUS (42) documentation states.

XCB_GET_INPUT_FOCUS (42) is the request number. Replies always have response_type 1 (XCB_REPLY). If the response is 0 (XCB_ERROR), it will be returned in the error pointer instead. Larger response_type numbers are events.

> 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?

Yes.

> second, which replies do
> I not test to see if valid reply,

Always test for valid replies. But test correctly: If the reply pointer is non-NULL, it's a valid reply. If it's not a valid reply, the reply pointer will be NULL and the error pointer will be non-NULL instead.

> Ohh, am I using correctly?

No, see above.

Peter Harris
================================
Rocket Software, Inc. and subsidiaries ■ 77 Fourth Avenue, Waltham MA 02451 ■ Main Office Toll Free Number: +1 855.577.4323
Contact Customer Support: https://my.rocketsoftware.com/RocketCommunity/RCEmailSupport
Unsubscribe from Marketing Messages/Manage Your Subscription Preferences - http://www.rocketsoftware.com/manage-your-email-preferences
Privacy Policy - http://www.rocketsoftware.com/company/legal/privacy-policy
================================

This communication and any attachments may contain confidential information of Rocket Software, Inc. All unauthorized use, disclosure or distribution is prohibited. If you are not the intended recipient, please notify Rocket Software immediately and destroy all copies of this communication. Thank you.


More information about the Xcb mailing list