Comments (8)
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.
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.
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.
theError is also nil.
from libxkbcommon.
just a random thought: DISPLAY
is set correctly and you do have a connection to the X server?
from libxkbcommon.
Yep.
from libxkbcommon.
This is almost certainly not an xkbcommon problem, and we don't have any more ideas, so closing.
from libxkbcommon.
Yes, xkb on this linux install was broken. I forgot to respond with this, sorry.
from libxkbcommon.
Related Issues (20)
- xkbcommon supports no way for a prefix pattern to override a longer pattern matching the prefix HOT 7
- Keysyms removed without prior deprecation HOT 1
- Compose sequences which require shift have stopped working since 1.6.0 HOT 7
- User help HOT 6
- Add "Caps Lock (while pressed)" option to switch keyboard layouts HOT 1
- Does libxkbcommon can support Android HOT 1
- After install, qt, slicer, cmake graphical interface can not use the keyboard, when using the keyboard input, the software will directly flash back. HOT 2
- Compose sequence terminates after pressing ISO_LEVEL5_SHIFT HOT 1
- `xkb_keysym_to_utf8()` requires output buffer size to be at least 7, but it should be 5 HOT 1
- keyboard layout change to CTRL-Shift/ALT-Shift brakes other shortcuts starting with CTRL-Shift/ALT-Shift HOT 9
- symbol map fails with recent lld (aka broken test for -Wl,--version-script) HOT 4
- Support for Arbitrary Modifiers (Accessibility Keybindings) HOT 10
- Modern Composition HOT 10
- Keymap file failed to load: us,mao,us- HOT 1
- Add support for conditional comments HOT 5
- Aliases HOT 16
- Can't input «angle quotes» into applications linked with libxkbcommon 1.5.0 running in GNOME linked with libxkbcommon 1.6.0 HOT 4
- Fatal error when $XDG_CONFIG_HOME/XCompose is a directory HOT 4
- question: how to map from xcb key press/release event state field to xkb_mod_mask_t HOT 2
- Support for pointer keys? HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libxkbcommon.