Giter Club home page Giter Club logo

Comments (8)

bluetech avatar bluetech commented on August 26, 2024

The code for the function is:

XKB_EXPORT int32_t
xkb_x11_get_core_keyboard_device_id(xcb_connection_t *conn)
{
    int32_t device_id;
    xcb_xkb_get_device_info_cookie_t cookie = xcb_xkb_get_device_info(conn, XCB_XKB_ID_USE_CORE_KBD, 0, 0, 0, 0, 0, 0);
    xcb_xkb_get_device_info_reply_t *reply = xcb_xkb_get_device_info_reply(conn, cookie, NULL);

    if (!reply)
        return -1;

    device_id = reply->deviceID;
    free(reply);
    return device_id;
}

To see why it fails, I suggest copy/pasting the the above into your own code, but also pass the third argument to xcb_xkb_get_device_info_reply (instead of NULL) to see what is the X11 error. You can do it like this:

xcb_generic_error_t *error;
reply = xcb_xkb_get_device_info_reply(conn, cookie, &error);
if (!reply) {
    printf("ERROR CODE: %d\n", error->error_code);
    return -1;
}

from libxkbcommon.

IoIxD avatar IoIxD commented on August 26, 2024

I suggest copy/pasting the the above into your own code

Well I'm actually using Golang, using it's built in C translation layer to interface with C functions from this library, so that's a little easier said then done.

but also pass the third argument to xcb_xkb_get_device_info_reply (instead of NULL) to see what is the X11 error. You can do it like this:

xcb_xkb_get_device_info_reply returns null. In the off chance you know Golang, here is my code...

xkbDevID := C.xkb_x11_get_core_keyboard_device_id(xcb)
if xkbDevID == -1 {
	var theError *C.xcb_generic_error_t
	var cookie C.xcb_xkb_get_device_info_cookie_t
	cookie = C.xcb_xkb_get_device_info(xcb, 256, 0, 0, 0, 0, 0, 0);
	reply := C.xcb_xkb_get_device_info_reply(xcb, cookie, &theError)
	if(reply != nil) {
		msg := int(theError.full_sequence)
		return errors.New(fmt.Sprintf("x11: xkb_x11_get_core_keyboard_device_id failed. %d",msg))
	} else {
		return errors.New("x11: xkb_x11_get_core_keyboard_device_id failed. so did xcb_xkb_get_device_info_reply.")
	}
}

...so what does it mean if both xkb_x11_get_core_keyboard_device_id and xcb_xkb_get_device_info_reply are null?

from libxkbcommon.

bluetech avatar bluetech commented on August 26, 2024

If reply is nil, then I think theError would be not nil. So if you change the if(reply != nil) to if(theError != nil), what is the value of msg?

from libxkbcommon.

IoIxD avatar IoIxD commented on August 26, 2024

theError is also nil.

from libxkbcommon.

whot avatar whot commented on August 26, 2024

just a random thought: DISPLAY is set correctly and you do have a connection to the X server?

from libxkbcommon.

IoIxD avatar IoIxD commented on August 26, 2024

Yep.

Terminal showing that $DISPLAY is :0.0 and I am booted into X

from libxkbcommon.

bluetech avatar bluetech commented on August 26, 2024

This is almost certainly not an xkbcommon problem, and we don't have any more ideas, so closing.

from libxkbcommon.

IoIxD avatar IoIxD commented on August 26, 2024

Yes, xkb on this linux install was broken. I forgot to respond with this, sorry.

from libxkbcommon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.