XCB vs. KModifierKeyInfoProvider
Martin Gräßlin
mgraesslin at kde.org
Mon Sep 2 07:05:27 UTC 2013
Hi all,
I just started porting KModifierKeyInfoProvider to a
QAbstractNativeEventFilter and hit a problem. The existing x11Event filter
looks for X11 XkbEvent. Now in Qt 5 we would have to look for the matching
event in XCB. But that doesn't exist.
There seems to be an XKB extension for XCB which seems to still be
experimental and is not included in the packages by Debian and Ubuntu [1].
Qt's 3rd party copy of xcb includes the required header xkb.h but I think this
doesn't help us much.
While looking for solutions to that problem I found that i3 (a modern wm proud
to not using XLib) opens an XDisplay and an own X11 event handler just for xkb
[2].
Qt re-declares the xkb events [3]:
#ifndef QT_NO_XKB
namespace {
typedef union {
/* All XKB events share these fields. */
struct {
uint8_t response_type;
uint8_t xkbType;
uint16_t sequence;
xcb_timestamp_t time;
uint8_t deviceID;
} any;
xcb_xkb_map_notify_event_t map_notify;
xcb_xkb_state_notify_event_t state_notify;
} _xkb_event;
}
#endif
I don't know what I should do. I see the following options:
1) require xb-xkb
2) open XDisplay connection
3) re-declare the event structure just like Qt
4) drop X11 support from KModifierKeyInfo for the time being or drop it
completely
My own opinions:
1) no, no, no, that would break my build ;-)
2) that's quite some overhead
3) I just don't like it and would feel very uncomfortable given that we don't
have unit tests and that this could break in future if xkb.h becomes
available.
4) lxr.kde.org only lists two users: Plasma DataEngine and Kile. For the
Plasma DataEngine one could go the XDisplay connection approach.
Overall I don't like any of the possible solutions and I hope for some good
input on how to circumvent this problem.
Cheers
Martin
[1] I do not know how to check for other distros. If one wants to check: look
for /usr/include/xcb/xkb.h
[2] http://code.stapelberg.de/git/i3/tree/src/main.c#n148
[3]
https://qt.gitorious.org/qt/qtbase/source/99362fb7f25a88829c2d824ebfe6da61d4d7b35f:src/plugins/platforms/xcb/qxcbconnection.cpp#L753
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20130902/b8cf2640/attachment.sig>
More information about the Kde-frameworks-devel
mailing list