forked from pool/libqt5-qtbase
Accepting request 229476 from KDE:Qt5
the fix for bnc#866051 and bnc#866709, the patches for bnc#866051 will part of Qt 5.3 but since it's important for on-the-fly keyboard layout remapping, should worth included them before 5.3 release. also change %suse_version to 1315 just because of current SLES12 use 1315 as its version number (forwarded request 229475 from mlin7442) OBS-URL: https://build.opensuse.org/request/show/229476 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libqt5-qtbase?expand=0&rev=17
This commit is contained in:
parent
62872611c6
commit
f6c48afebe
666
libqt5-add-better-support-for-keymap-update-handling.patch
Normal file
666
libqt5-add-better-support-for-keymap-update-handling.patch
Normal file
@ -0,0 +1,666 @@
|
|||||||
|
From 9c326376c9a27a02ee6abcb897082f538d0002a7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Gatis Paeglis <gatis.paeglis@digia.com>
|
||||||
|
Date: Thu, 27 Feb 2014 18:05:14 +0100
|
||||||
|
Subject: [PATCH] Add better support for keymap update handling
|
||||||
|
|
||||||
|
Use the new X11 support API xkb_x11_* released in libxkbcommon version 0.4.0.
|
||||||
|
|
||||||
|
From the commit message where this API was introduced:
|
||||||
|
|
||||||
|
"These are function to create an xkb_keymap directly from XKB requests
|
||||||
|
to the X server. This opens up the possibility for X clients to use
|
||||||
|
xcb + xcb-xkb + xkbcommon as a proper replacement for Xlib + xkbfile for
|
||||||
|
keyboard support.
|
||||||
|
|
||||||
|
Why not just use the RMLVO that the server puts in the _XKB_RULES_NAMES
|
||||||
|
property? This does not account for custom keymaps, on-the-fly keymap
|
||||||
|
modifications, remote clients, etc., so is not a proper solution in
|
||||||
|
practice. Also, some servers don't even set it. Now, the client just
|
||||||
|
needs to recreate the keymap in response to a change in the server's
|
||||||
|
keymap (as Xlib clients do with XRefreshKeyboardMapping() and friends)."
|
||||||
|
|
||||||
|
This patch moves XKEYBOARD presence decision from compile time to runtime
|
||||||
|
for a proper remote X client support.
|
||||||
|
|
||||||
|
Task-number: QTBUG-31527
|
||||||
|
Task-number: QTBUG-32760
|
||||||
|
Change-Id: I4d402668cda2126ef180b27022154f96b1874b1d
|
||||||
|
Reviewed-by: Uli Schlachter <psychon@znc.in>
|
||||||
|
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
||||||
|
---
|
||||||
|
src/plugins/platforms/xcb/qxcbconnection.cpp | 59 +++----
|
||||||
|
src/plugins/platforms/xcb/qxcbconnection.h | 2
|
||||||
|
src/plugins/platforms/xcb/qxcbkeyboard.cpp | 218 ++++++++++-----------------
|
||||||
|
src/plugins/platforms/xcb/qxcbkeyboard.h | 35 +---
|
||||||
|
src/plugins/platforms/xcb/xcb-plugin.pro | 8
|
||||||
|
5 files changed, 134 insertions(+), 188 deletions(-)
|
||||||
|
|
||||||
|
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
|
||||||
|
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
|
||||||
|
@@ -766,6 +766,7 @@ namespace {
|
||||||
|
xcb_timestamp_t time;
|
||||||
|
uint8_t deviceID;
|
||||||
|
} any;
|
||||||
|
+ xcb_xkb_new_keyboard_notify_event_t new_keyboard_notify;
|
||||||
|
xcb_xkb_map_notify_event_t map_notify;
|
||||||
|
xcb_xkb_state_notify_event_t state_notify;
|
||||||
|
} _xkb_event;
|
||||||
|
@@ -796,15 +797,11 @@ void QXcbConnection::handleXcbEvent(xcb_
|
||||||
|
case XCB_EXPOSE:
|
||||||
|
HANDLE_PLATFORM_WINDOW_EVENT(xcb_expose_event_t, window, handleExposeEvent);
|
||||||
|
case XCB_BUTTON_PRESS:
|
||||||
|
-#ifdef QT_NO_XKB
|
||||||
|
m_keyboard->updateXKBStateFromCore(((xcb_button_press_event_t *)event)->state);
|
||||||
|
-#endif
|
||||||
|
handleButtonPress(event);
|
||||||
|
HANDLE_PLATFORM_WINDOW_EVENT(xcb_button_press_event_t, event, handleButtonPressEvent);
|
||||||
|
case XCB_BUTTON_RELEASE:
|
||||||
|
-#ifdef QT_NO_XKB
|
||||||
|
m_keyboard->updateXKBStateFromCore(((xcb_button_release_event_t *)event)->state);
|
||||||
|
-#endif
|
||||||
|
handleButtonRelease(event);
|
||||||
|
HANDLE_PLATFORM_WINDOW_EVENT(xcb_button_release_event_t, event, handleButtonReleaseEvent);
|
||||||
|
case XCB_MOTION_NOTIFY:
|
||||||
|
@@ -812,9 +809,7 @@ void QXcbConnection::handleXcbEvent(xcb_
|
||||||
|
xcb_motion_notify_event_t *mev = (xcb_motion_notify_event_t *)event;
|
||||||
|
qDebug("xcb: moved mouse to %4d, %4d; button state %X", mev->event_x, mev->event_y, static_cast<unsigned int>(m_buttons));
|
||||||
|
}
|
||||||
|
-#ifdef QT_NO_XKB
|
||||||
|
m_keyboard->updateXKBStateFromCore(((xcb_motion_notify_event_t *)event)->state);
|
||||||
|
-#endif
|
||||||
|
HANDLE_PLATFORM_WINDOW_EVENT(xcb_motion_notify_event_t, event, handleMotionNotifyEvent);
|
||||||
|
case XCB_CONFIGURE_NOTIFY:
|
||||||
|
HANDLE_PLATFORM_WINDOW_EVENT(xcb_configure_notify_event_t, event, handleConfigureNotifyEvent);
|
||||||
|
@@ -830,29 +825,21 @@ void QXcbConnection::handleXcbEvent(xcb_
|
||||||
|
case XCB_ENTER_NOTIFY:
|
||||||
|
HANDLE_PLATFORM_WINDOW_EVENT(xcb_enter_notify_event_t, event, handleEnterNotifyEvent);
|
||||||
|
case XCB_LEAVE_NOTIFY:
|
||||||
|
-#ifdef QT_NO_XKB
|
||||||
|
m_keyboard->updateXKBStateFromCore(((xcb_leave_notify_event_t *)event)->state);
|
||||||
|
-#endif
|
||||||
|
HANDLE_PLATFORM_WINDOW_EVENT(xcb_leave_notify_event_t, event, handleLeaveNotifyEvent);
|
||||||
|
case XCB_FOCUS_IN:
|
||||||
|
HANDLE_PLATFORM_WINDOW_EVENT(xcb_focus_in_event_t, event, handleFocusInEvent);
|
||||||
|
case XCB_FOCUS_OUT:
|
||||||
|
HANDLE_PLATFORM_WINDOW_EVENT(xcb_focus_out_event_t, event, handleFocusOutEvent);
|
||||||
|
case XCB_KEY_PRESS:
|
||||||
|
-#ifdef QT_NO_XKB
|
||||||
|
m_keyboard->updateXKBStateFromCore(((xcb_key_press_event_t *)event)->state);
|
||||||
|
-#endif
|
||||||
|
HANDLE_KEYBOARD_EVENT(xcb_key_press_event_t, handleKeyPressEvent);
|
||||||
|
case XCB_KEY_RELEASE:
|
||||||
|
-#ifdef QT_NO_XKB
|
||||||
|
m_keyboard->updateXKBStateFromCore(((xcb_key_release_event_t *)event)->state);
|
||||||
|
-#endif
|
||||||
|
HANDLE_KEYBOARD_EVENT(xcb_key_release_event_t, handleKeyReleaseEvent);
|
||||||
|
-#ifdef QT_NO_XKB
|
||||||
|
case XCB_MAPPING_NOTIFY:
|
||||||
|
m_keyboard->handleMappingNotifyEvent((xcb_mapping_notify_event_t *)event);
|
||||||
|
break;
|
||||||
|
-#endif
|
||||||
|
case XCB_SELECTION_REQUEST:
|
||||||
|
{
|
||||||
|
xcb_selection_request_event_t *sr = (xcb_selection_request_event_t *)event;
|
||||||
|
@@ -920,6 +907,8 @@ void QXcbConnection::handleXcbEvent(xcb_
|
||||||
|
_xkb_event *xkb_event = reinterpret_cast<_xkb_event *>(event);
|
||||||
|
if (xkb_event->any.deviceID == m_keyboard->coreDeviceId()) {
|
||||||
|
switch (xkb_event->any.xkbType) {
|
||||||
|
+ // XkbNewKkdNotify and XkbMapNotify together capture all sorts of keymap
|
||||||
|
+ // updates (e.g. xmodmap, xkbcomp, setxkbmap), with minimal redundent recompilations.
|
||||||
|
case XCB_XKB_STATE_NOTIFY:
|
||||||
|
m_keyboard->updateXKBState(&xkb_event->state_notify);
|
||||||
|
handled = true;
|
||||||
|
@@ -928,6 +917,12 @@ void QXcbConnection::handleXcbEvent(xcb_
|
||||||
|
m_keyboard->handleMappingNotifyEvent(&xkb_event->map_notify);
|
||||||
|
handled = true;
|
||||||
|
break;
|
||||||
|
+ case XCB_XKB_NEW_KEYBOARD_NOTIFY: {
|
||||||
|
+ xcb_xkb_new_keyboard_notify_event_t *ev = &xkb_event->new_keyboard_notify;
|
||||||
|
+ if (ev->changed & XCB_XKB_NKN_DETAIL_KEYCODES)
|
||||||
|
+ m_keyboard->updateKeymap();
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
@@ -1661,6 +1656,7 @@ void QXcbConnection::initializeXKB()
|
||||||
|
#ifndef QT_NO_XKB
|
||||||
|
const xcb_query_extension_reply_t *reply = xcb_get_extension_data(m_connection, &xcb_xkb_id);
|
||||||
|
if (!reply || !reply->present) {
|
||||||
|
+ qWarning() << "Qt: XKEYBOARD extension not present on the X server.";
|
||||||
|
xkb_first_event = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
@@ -1670,14 +1666,14 @@ void QXcbConnection::initializeXKB()
|
||||||
|
xcb_xkb_use_extension_cookie_t xkb_query_cookie;
|
||||||
|
xcb_xkb_use_extension_reply_t *xkb_query;
|
||||||
|
|
||||||
|
- xkb_query_cookie = xcb_xkb_use_extension(c, XCB_XKB_MAJOR_VERSION, XCB_XKB_MINOR_VERSION);
|
||||||
|
+ xkb_query_cookie = xcb_xkb_use_extension(c, XKB_X11_MIN_MAJOR_XKB_VERSION, XKB_X11_MIN_MINOR_XKB_VERSION);
|
||||||
|
xkb_query = xcb_xkb_use_extension_reply(c, xkb_query_cookie, 0);
|
||||||
|
|
||||||
|
if (!xkb_query) {
|
||||||
|
qWarning("Qt: Failed to initialize XKB extension");
|
||||||
|
return;
|
||||||
|
} else if (!xkb_query->supported) {
|
||||||
|
- qWarning("Qt: Unsupported XKB version (want %d %d, has %d %d)",
|
||||||
|
+ qWarning("Qt: Unsupported XKB version (We want %d %d, but X server has %d %d)",
|
||||||
|
XCB_XKB_MAJOR_VERSION, XCB_XKB_MINOR_VERSION,
|
||||||
|
xkb_query->serverMajor, xkb_query->serverMinor);
|
||||||
|
free(xkb_query);
|
||||||
|
@@ -1687,25 +1683,28 @@ void QXcbConnection::initializeXKB()
|
||||||
|
has_xkb = true;
|
||||||
|
free(xkb_query);
|
||||||
|
|
||||||
|
- uint affectMap, map;
|
||||||
|
- affectMap = map = XCB_XKB_MAP_PART_KEY_TYPES |
|
||||||
|
- XCB_XKB_MAP_PART_KEY_SYMS |
|
||||||
|
- XCB_XKB_MAP_PART_MODIFIER_MAP |
|
||||||
|
- XCB_XKB_MAP_PART_EXPLICIT_COMPONENTS |
|
||||||
|
- XCB_XKB_MAP_PART_KEY_ACTIONS |
|
||||||
|
- XCB_XKB_MAP_PART_KEY_BEHAVIORS |
|
||||||
|
- XCB_XKB_MAP_PART_VIRTUAL_MODS |
|
||||||
|
- XCB_XKB_MAP_PART_VIRTUAL_MOD_MAP;
|
||||||
|
+ const uint16_t required_map_parts = (XCB_XKB_MAP_PART_KEY_TYPES |
|
||||||
|
+ XCB_XKB_MAP_PART_KEY_SYMS |
|
||||||
|
+ XCB_XKB_MAP_PART_MODIFIER_MAP |
|
||||||
|
+ XCB_XKB_MAP_PART_EXPLICIT_COMPONENTS |
|
||||||
|
+ XCB_XKB_MAP_PART_KEY_ACTIONS |
|
||||||
|
+ XCB_XKB_MAP_PART_KEY_BEHAVIORS |
|
||||||
|
+ XCB_XKB_MAP_PART_VIRTUAL_MODS |
|
||||||
|
+ XCB_XKB_MAP_PART_VIRTUAL_MOD_MAP);
|
||||||
|
+
|
||||||
|
+ const uint16_t required_events = (XCB_XKB_EVENT_TYPE_NEW_KEYBOARD_NOTIFY |
|
||||||
|
+ XCB_XKB_EVENT_TYPE_MAP_NOTIFY |
|
||||||
|
+ XCB_XKB_EVENT_TYPE_STATE_NOTIFY);
|
||||||
|
|
||||||
|
- // Xkb events are reported to all interested clients without regard
|
||||||
|
+ // XKB events are reported to all interested clients without regard
|
||||||
|
// to the current keyboard input focus or grab state
|
||||||
|
xcb_void_cookie_t select = xcb_xkb_select_events_checked(c,
|
||||||
|
XCB_XKB_ID_USE_CORE_KBD,
|
||||||
|
- XCB_XKB_EVENT_TYPE_STATE_NOTIFY | XCB_XKB_EVENT_TYPE_MAP_NOTIFY,
|
||||||
|
+ required_events,
|
||||||
|
0,
|
||||||
|
- XCB_XKB_EVENT_TYPE_STATE_NOTIFY | XCB_XKB_EVENT_TYPE_MAP_NOTIFY,
|
||||||
|
- affectMap,
|
||||||
|
- map,
|
||||||
|
+ required_events,
|
||||||
|
+ required_map_parts,
|
||||||
|
+ required_map_parts,
|
||||||
|
0);
|
||||||
|
|
||||||
|
xcb_generic_error_t *error = xcb_request_check(c, select);
|
||||||
|
--- a/src/plugins/platforms/xcb/qxcbconnection.h
|
||||||
|
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
|
||||||
|
@@ -54,7 +54,7 @@
|
||||||
|
#include <qpa/qwindowsysteminterface.h>
|
||||||
|
|
||||||
|
// This is needed to make Qt compile together with XKB. xkb.h is using a variable
|
||||||
|
-// which is called 'explicit', this is a reserved keyword in c++ */
|
||||||
|
+// which is called 'explicit', this is a reserved keyword in c++
|
||||||
|
#ifndef QT_NO_XKB
|
||||||
|
#define explicit dont_use_cxx_explicit
|
||||||
|
#include <xcb/xkb.h>
|
||||||
|
--- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp
|
||||||
|
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
|
||||||
|
@@ -658,6 +658,7 @@ void QXcbKeyboard::clearXKBConfig()
|
||||||
|
void QXcbKeyboard::updateKeymap()
|
||||||
|
{
|
||||||
|
m_config = true;
|
||||||
|
+ // set xkb context object
|
||||||
|
if (!xkb_context) {
|
||||||
|
xkb_context = xkb_context_new((xkb_context_flags)0);
|
||||||
|
if (!xkb_context) {
|
||||||
|
@@ -666,67 +667,50 @@ void QXcbKeyboard::updateKeymap()
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- readXKBConfig();
|
||||||
|
- // Compile a keymap from RMLVO (rules, models, layouts, variants and options) names
|
||||||
|
- if (xkb_keymap)
|
||||||
|
- xkb_keymap_unref(xkb_keymap);
|
||||||
|
+ // update xkb keymap object
|
||||||
|
+ xkb_keymap_unref(xkb_keymap);
|
||||||
|
+ xkb_keymap = 0;
|
||||||
|
|
||||||
|
- xkb_keymap = xkb_keymap_new_from_names(xkb_context, &xkb_names, (xkb_keymap_compile_flags)0);
|
||||||
|
+ struct xkb_state *new_state = 0;
|
||||||
|
+#ifndef QT_NO_XKB
|
||||||
|
+ if (connection()->hasXKB()) {
|
||||||
|
+ xkb_keymap = xkb_x11_keymap_new_from_device(xkb_context, xcb_connection(), core_device_id, (xkb_keymap_compile_flags)0);
|
||||||
|
+ if (xkb_keymap) {
|
||||||
|
+ // Create a new keyboard state object for a keymap
|
||||||
|
+ new_state = xkb_x11_state_new_from_device(xkb_keymap, xcb_connection(), core_device_id);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+#endif
|
||||||
|
+ if (!xkb_keymap) {
|
||||||
|
+ // Compile a keymap from RMLVO (rules, models, layouts, variants and options) names
|
||||||
|
+ readXKBConfig();
|
||||||
|
+ xkb_keymap = xkb_keymap_new_from_names(xkb_context, &xkb_names, (xkb_keymap_compile_flags)0);
|
||||||
|
+ if (xkb_keymap)
|
||||||
|
+ new_state = xkb_state_new(xkb_keymap);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
if (!xkb_keymap) {
|
||||||
|
qWarning("Qt: Failed to compile a keymap");
|
||||||
|
m_config = false;
|
||||||
|
- return;
|
||||||
|
}
|
||||||
|
- // Create a new keyboard state object for a keymap
|
||||||
|
- struct xkb_state *new_state = xkb_state_new(xkb_keymap);
|
||||||
|
if (!new_state) {
|
||||||
|
- qWarning("Qt: Failed to create a new keyboard state");
|
||||||
|
+ qWarning("Qt: Failed to create xkb state");
|
||||||
|
m_config = false;
|
||||||
|
- return;
|
||||||
|
}
|
||||||
|
+ if (!m_config)
|
||||||
|
+ return;
|
||||||
|
|
||||||
|
- if (xkb_state) {
|
||||||
|
- xkb_state_unref(xkb_state);
|
||||||
|
- xkb_state = new_state;
|
||||||
|
- } else {
|
||||||
|
- xkb_state = new_state;
|
||||||
|
-#ifndef QT_NO_XKB
|
||||||
|
- // get initial state from the X server (and keep it up-to-date at all times)
|
||||||
|
- xcb_xkb_get_state_cookie_t state;
|
||||||
|
- xcb_xkb_get_state_reply_t *init_state;
|
||||||
|
-
|
||||||
|
- xcb_connection_t *c = xcb_connection();
|
||||||
|
- state = xcb_xkb_get_state(c, XCB_XKB_ID_USE_CORE_KBD);
|
||||||
|
- init_state = xcb_xkb_get_state_reply(c, state, 0);
|
||||||
|
- if (!init_state) {
|
||||||
|
- qWarning("Qt: couldn't retrieve an initial keyboard state");
|
||||||
|
- return;
|
||||||
|
- }
|
||||||
|
- /* The xkb keyboard state is comprised of the state of all keyboard modifiers,
|
||||||
|
- the keyboard group, and the state of the pointer buttons */
|
||||||
|
- xkb_state_update_mask(xkb_state,
|
||||||
|
- init_state->baseMods,
|
||||||
|
- init_state->latchedMods,
|
||||||
|
- init_state->lockedMods,
|
||||||
|
- init_state->baseGroup,
|
||||||
|
- init_state->latchedGroup,
|
||||||
|
- init_state->lockedGroup);
|
||||||
|
- free(init_state);
|
||||||
|
-#else
|
||||||
|
+ // update xkb state object
|
||||||
|
+ xkb_state_unref(xkb_state);
|
||||||
|
+ xkb_state = new_state;
|
||||||
|
+ if (!connection()->hasXKB())
|
||||||
|
updateXKBMods();
|
||||||
|
-#endif
|
||||||
|
- }
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef QT_NO_XKB
|
||||||
|
void QXcbKeyboard::updateXKBState(xcb_xkb_state_notify_event_t *state)
|
||||||
|
{
|
||||||
|
- if (!m_config)
|
||||||
|
- return;
|
||||||
|
-
|
||||||
|
- if (connection()->hasXKB()) {
|
||||||
|
-
|
||||||
|
+ if (m_config && connection()->hasXKB()) {
|
||||||
|
const xkb_state_component newState
|
||||||
|
= xkb_state_update_mask(xkb_state,
|
||||||
|
state->baseMods,
|
||||||
|
@@ -741,35 +725,34 @@ void QXcbKeyboard::updateXKBState(xcb_xk
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
-#else
|
||||||
|
void QXcbKeyboard::updateXKBStateFromCore(quint16 state)
|
||||||
|
{
|
||||||
|
- if (!m_config)
|
||||||
|
- return;
|
||||||
|
+ if (m_config && !connection()->hasXKB()) {
|
||||||
|
+ const quint32 modsDepressed = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_DEPRESSED);
|
||||||
|
+ const quint32 modsLatched = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_LATCHED);
|
||||||
|
+ const quint32 modsLocked = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_LOCKED);
|
||||||
|
+ const quint32 xkbMask = xkbModMask(state);
|
||||||
|
+
|
||||||
|
+ const quint32 latched = modsLatched & xkbMask;
|
||||||
|
+ const quint32 locked = modsLocked & xkbMask;
|
||||||
|
+ quint32 depressed = modsDepressed & xkbMask;
|
||||||
|
+ // set modifiers in depressed if they don't appear in any of the final masks
|
||||||
|
+ depressed |= ~(depressed | latched | locked) & xkbMask;
|
||||||
|
|
||||||
|
- const quint32 modsDepressed = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_DEPRESSED);
|
||||||
|
- const quint32 modsLatched = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_LATCHED);
|
||||||
|
- const quint32 modsLocked = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_LOCKED);
|
||||||
|
- const quint32 xkbMask = xkbModMask(state);
|
||||||
|
-
|
||||||
|
- const quint32 latched = modsLatched & xkbMask;
|
||||||
|
- const quint32 locked = modsLocked & xkbMask;
|
||||||
|
- quint32 depressed = modsDepressed & xkbMask;
|
||||||
|
- // set modifiers in depressed if they don't appear in any of the final masks
|
||||||
|
- depressed |= ~(depressed | latched | locked) & xkbMask;
|
||||||
|
-
|
||||||
|
- const xkb_state_component newState
|
||||||
|
- = xkb_state_update_mask(xkb_state,
|
||||||
|
- depressed,
|
||||||
|
- latched,
|
||||||
|
- locked,
|
||||||
|
- 0,
|
||||||
|
- 0,
|
||||||
|
- (state >> 13) & 3); // bits 13 and 14 report the state keyboard group
|
||||||
|
+ const xkb_state_component newState
|
||||||
|
+ = xkb_state_update_mask(xkb_state,
|
||||||
|
+ depressed,
|
||||||
|
+ latched,
|
||||||
|
+ locked,
|
||||||
|
+ 0,
|
||||||
|
+ 0,
|
||||||
|
+ (state >> 13) & 3); // bits 13 and 14 report the state keyboard group
|
||||||
|
|
||||||
|
- if ((newState & XKB_STATE_LAYOUT_EFFECTIVE) == XKB_STATE_LAYOUT_EFFECTIVE) {
|
||||||
|
- //qWarning("TODO: Support KeyboardLayoutChange on QPA (QTBUG-27681)");
|
||||||
|
+ if ((newState & XKB_STATE_LAYOUT_EFFECTIVE) == XKB_STATE_LAYOUT_EFFECTIVE) {
|
||||||
|
+ //qWarning("TODO: Support KeyboardLayoutChange on QPA (QTBUG-27681)");
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -799,16 +782,15 @@ quint32 QXcbKeyboard::xkbModMask(quint16
|
||||||
|
|
||||||
|
void QXcbKeyboard::updateXKBMods()
|
||||||
|
{
|
||||||
|
- xkb_mods.shift = xkb_map_mod_get_index(xkb_keymap, XKB_MOD_NAME_SHIFT);
|
||||||
|
- xkb_mods.lock = xkb_map_mod_get_index(xkb_keymap, XKB_MOD_NAME_CAPS);
|
||||||
|
- xkb_mods.control = xkb_map_mod_get_index(xkb_keymap, XKB_MOD_NAME_CTRL);
|
||||||
|
- xkb_mods.mod1 = xkb_map_mod_get_index(xkb_keymap, "Mod1");
|
||||||
|
- xkb_mods.mod2 = xkb_map_mod_get_index(xkb_keymap, "Mod2");
|
||||||
|
- xkb_mods.mod3 = xkb_map_mod_get_index(xkb_keymap, "Mod3");
|
||||||
|
- xkb_mods.mod4 = xkb_map_mod_get_index(xkb_keymap, "Mod4");
|
||||||
|
- xkb_mods.mod5 = xkb_map_mod_get_index(xkb_keymap, "Mod5");
|
||||||
|
+ xkb_mods.shift = xkb_keymap_mod_get_index(xkb_keymap, XKB_MOD_NAME_SHIFT);
|
||||||
|
+ xkb_mods.lock = xkb_keymap_mod_get_index(xkb_keymap, XKB_MOD_NAME_CAPS);
|
||||||
|
+ xkb_mods.control = xkb_keymap_mod_get_index(xkb_keymap, XKB_MOD_NAME_CTRL);
|
||||||
|
+ xkb_mods.mod1 = xkb_keymap_mod_get_index(xkb_keymap, "Mod1");
|
||||||
|
+ xkb_mods.mod2 = xkb_keymap_mod_get_index(xkb_keymap, "Mod2");
|
||||||
|
+ xkb_mods.mod3 = xkb_keymap_mod_get_index(xkb_keymap, "Mod3");
|
||||||
|
+ xkb_mods.mod4 = xkb_keymap_mod_get_index(xkb_keymap, "Mod4");
|
||||||
|
+ xkb_mods.mod5 = xkb_keymap_mod_get_index(xkb_keymap, "Mod5");
|
||||||
|
}
|
||||||
|
-#endif
|
||||||
|
|
||||||
|
QList<int> QXcbKeyboard::possibleKeys(const QKeyEvent *event) const
|
||||||
|
{
|
||||||
|
@@ -893,10 +875,8 @@ QList<int> QXcbKeyboard::possibleKeys(co
|
||||||
|
result += (qtKey + mods);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- if (kb_state)
|
||||||
|
- xkb_state_unref(kb_state);
|
||||||
|
- if (fallback_keymap)
|
||||||
|
- xkb_keymap_unref(fallback_keymap);
|
||||||
|
+ xkb_state_unref(kb_state);
|
||||||
|
+ xkb_keymap_unref(fallback_keymap);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
@@ -963,58 +943,41 @@ QXcbKeyboard::QXcbKeyboard(QXcbConnectio
|
||||||
|
, xkb_context(0)
|
||||||
|
, xkb_keymap(0)
|
||||||
|
, xkb_state(0)
|
||||||
|
-#ifndef QT_NO_XKB
|
||||||
|
, core_device_id(0)
|
||||||
|
-#endif
|
||||||
|
{
|
||||||
|
memset(&xkb_names, 0, sizeof(xkb_names));
|
||||||
|
- updateKeymap();
|
||||||
|
#ifndef QT_NO_XKB
|
||||||
|
if (connection->hasXKB()) {
|
||||||
|
-
|
||||||
|
updateVModMapping();
|
||||||
|
updateVModToRModMapping();
|
||||||
|
-
|
||||||
|
- // get the core keyboard id
|
||||||
|
- xcb_xkb_get_device_info_cookie_t device_id_cookie;
|
||||||
|
- xcb_xkb_get_device_info_reply_t *device_id;
|
||||||
|
-
|
||||||
|
- device_id_cookie = xcb_xkb_get_device_info(xcb_connection(),
|
||||||
|
- XCB_XKB_ID_USE_CORE_KBD,
|
||||||
|
- 0, 0, 0, 0, 0, 0);
|
||||||
|
-
|
||||||
|
- device_id = xcb_xkb_get_device_info_reply(xcb_connection(), device_id_cookie, 0);
|
||||||
|
- if (!device_id) {
|
||||||
|
+ core_device_id = xkb_x11_get_core_keyboard_device_id(xcb_connection());
|
||||||
|
+ if (core_device_id == -1) {
|
||||||
|
qWarning("Qt: couldn't get core keyboard device info");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
-
|
||||||
|
- core_device_id = device_id->deviceID;
|
||||||
|
- free(device_id);
|
||||||
|
+ } else {
|
||||||
|
+#endif
|
||||||
|
+ m_key_symbols = xcb_key_symbols_alloc(xcb_connection());
|
||||||
|
+ updateModifiers();
|
||||||
|
+#ifndef QT_NO_XKB
|
||||||
|
}
|
||||||
|
-#else
|
||||||
|
- m_key_symbols = xcb_key_symbols_alloc(xcb_connection());
|
||||||
|
- updateModifiers();
|
||||||
|
#endif
|
||||||
|
+ updateKeymap();
|
||||||
|
}
|
||||||
|
|
||||||
|
QXcbKeyboard::~QXcbKeyboard()
|
||||||
|
{
|
||||||
|
- if (xkb_state)
|
||||||
|
- xkb_state_unref(xkb_state);
|
||||||
|
- if (xkb_keymap)
|
||||||
|
- xkb_keymap_unref(xkb_keymap);
|
||||||
|
- if (xkb_context)
|
||||||
|
- xkb_context_unref(xkb_context);
|
||||||
|
-#ifdef QT_NO_XKB
|
||||||
|
- xcb_key_symbols_free(m_key_symbols);
|
||||||
|
-#endif
|
||||||
|
+ xkb_state_unref(xkb_state);
|
||||||
|
+ xkb_keymap_unref(xkb_keymap);
|
||||||
|
+ xkb_context_unref(xkb_context);
|
||||||
|
+ if (!connection()->hasXKB())
|
||||||
|
+ xcb_key_symbols_free(m_key_symbols);
|
||||||
|
clearXKBConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
-#ifndef QT_NO_XKB
|
||||||
|
void QXcbKeyboard::updateVModMapping()
|
||||||
|
{
|
||||||
|
+#ifndef QT_NO_XKB
|
||||||
|
xcb_xkb_get_names_cookie_t names_cookie;
|
||||||
|
xcb_xkb_get_names_reply_t *name_reply;
|
||||||
|
xcb_xkb_get_names_value_list_t names_list;
|
||||||
|
@@ -1078,10 +1041,12 @@ void QXcbKeyboard::updateVModMapping()
|
||||||
|
}
|
||||||
|
|
||||||
|
free(name_reply);
|
||||||
|
+#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void QXcbKeyboard::updateVModToRModMapping()
|
||||||
|
{
|
||||||
|
+#ifndef QT_NO_XKB
|
||||||
|
xcb_xkb_get_map_cookie_t map_cookie;
|
||||||
|
xcb_xkb_get_map_reply_t *map_reply;
|
||||||
|
xcb_xkb_get_map_map_t map;
|
||||||
|
@@ -1144,8 +1109,9 @@ void QXcbKeyboard::updateVModToRModMappi
|
||||||
|
|
||||||
|
free(map_reply);
|
||||||
|
resolveMaskConflicts();
|
||||||
|
+#endif
|
||||||
|
}
|
||||||
|
-#else
|
||||||
|
+
|
||||||
|
void QXcbKeyboard::updateModifiers()
|
||||||
|
{
|
||||||
|
// The core protocol does not provide a convenient way to determine the mapping
|
||||||
|
@@ -1209,7 +1175,6 @@ void QXcbKeyboard::updateModifiers()
|
||||||
|
free(modMapReply);
|
||||||
|
resolveMaskConflicts();
|
||||||
|
}
|
||||||
|
-#endif
|
||||||
|
|
||||||
|
void QXcbKeyboard::resolveMaskConflicts()
|
||||||
|
{
|
||||||
|
@@ -1292,17 +1257,9 @@ void QXcbKeyboard::handleKeyEvent(QWindo
|
||||||
|
|
||||||
|
if (!m_config)
|
||||||
|
return;
|
||||||
|
- // It is crucial the order of xkb_state_key_get_one_sym &
|
||||||
|
- // xkb_state_update_key operations is not reversed!
|
||||||
|
+
|
||||||
|
+ // It is crucial the order of xkb_state_key_get_one_sym & xkb_state_update_key operations is not reversed!
|
||||||
|
xcb_keysym_t sym = xkb_state_key_get_one_sym(xkb_state, code);
|
||||||
|
-#ifdef QT_NO_XKB
|
||||||
|
- enum xkb_key_direction direction;
|
||||||
|
- if (type == QEvent::KeyPress)
|
||||||
|
- direction = XKB_KEY_DOWN;
|
||||||
|
- else
|
||||||
|
- direction = XKB_KEY_UP;
|
||||||
|
- xkb_state_update_key(xkb_state, code, direction);
|
||||||
|
-#endif
|
||||||
|
|
||||||
|
QPlatformInputContext *inputContext = QGuiApplicationPrivate::platformIntegration()->inputContext();
|
||||||
|
QMetaMethod method;
|
||||||
|
@@ -1422,17 +1379,14 @@ void QXcbKeyboard::handleKeyReleaseEvent
|
||||||
|
void QXcbKeyboard::handleMappingNotifyEvent(const void *event)
|
||||||
|
{
|
||||||
|
updateKeymap();
|
||||||
|
-#ifdef QT_NO_XKB
|
||||||
|
- void *ev = const_cast<void *>(event);
|
||||||
|
- xcb_refresh_keyboard_mapping(m_key_symbols, static_cast<xcb_mapping_notify_event_t *>(ev));
|
||||||
|
- updateModifiers();
|
||||||
|
-#else
|
||||||
|
- Q_UNUSED(event)
|
||||||
|
if (connection()->hasXKB()) {
|
||||||
|
updateVModMapping();
|
||||||
|
updateVModToRModMapping();
|
||||||
|
+ } else {
|
||||||
|
+ void *ev = const_cast<void *>(event);
|
||||||
|
+ xcb_refresh_keyboard_mapping(m_key_symbols, static_cast<xcb_mapping_notify_event_t *>(ev));
|
||||||
|
+ updateModifiers();
|
||||||
|
}
|
||||||
|
-#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
--- a/src/plugins/platforms/xcb/qxcbkeyboard.h
|
||||||
|
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.h
|
||||||
|
@@ -44,11 +44,15 @@
|
||||||
|
|
||||||
|
#include "qxcbobject.h"
|
||||||
|
|
||||||
|
-#ifdef QT_NO_XKB
|
||||||
|
#include <xcb/xcb_keysyms.h>
|
||||||
|
-#endif
|
||||||
|
|
||||||
|
#include <xkbcommon/xkbcommon.h>
|
||||||
|
+#ifndef QT_NO_XKB
|
||||||
|
+// note: extern won't be needed from libxkbcommon 0.4.1 and above
|
||||||
|
+extern "C" {
|
||||||
|
+#include <xkbcommon/xkbcommon-x11.h>
|
||||||
|
+}
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
#include <QEvent>
|
||||||
|
|
||||||
|
@@ -65,41 +69,37 @@ public:
|
||||||
|
|
||||||
|
void handleKeyPressEvent(QXcbWindowEventListener *eventListener, const xcb_key_press_event_t *event);
|
||||||
|
void handleKeyReleaseEvent(QXcbWindowEventListener *eventListener, const xcb_key_release_event_t *event);
|
||||||
|
-
|
||||||
|
void handleMappingNotifyEvent(const void *event);
|
||||||
|
|
||||||
|
Qt::KeyboardModifiers translateModifiers(int s) const;
|
||||||
|
-
|
||||||
|
void updateKeymap();
|
||||||
|
QList<int> possibleKeys(const QKeyEvent *e) const;
|
||||||
|
|
||||||
|
-#ifdef QT_NO_XKB
|
||||||
|
- void updateXKBStateFromCore(quint16 state);
|
||||||
|
+ // when XKEYBOARD not present on the X server
|
||||||
|
void updateXKBMods();
|
||||||
|
quint32 xkbModMask(quint16 state);
|
||||||
|
-#else
|
||||||
|
- int coreDeviceId() { return core_device_id; }
|
||||||
|
+ void updateXKBStateFromCore(quint16 state);
|
||||||
|
+ // when XKEYBOARD is present on the X server
|
||||||
|
+ int coreDeviceId() const { return core_device_id; }
|
||||||
|
+#ifndef QT_NO_XKB
|
||||||
|
void updateXKBState(xcb_xkb_state_notify_event_t *state);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void handleKeyEvent(QWindow *window, QEvent::Type type, xcb_keycode_t code, quint16 state, xcb_timestamp_t time);
|
||||||
|
- void resolveMaskConflicts();
|
||||||
|
|
||||||
|
+ void resolveMaskConflicts();
|
||||||
|
QString keysymToUnicode(xcb_keysym_t sym) const;
|
||||||
|
-
|
||||||
|
int keysymToQtKey(xcb_keysym_t keysym) const;
|
||||||
|
int keysymToQtKey(xcb_keysym_t keysym, Qt::KeyboardModifiers &modifiers, QString text) const;
|
||||||
|
|
||||||
|
void readXKBConfig();
|
||||||
|
void clearXKBConfig();
|
||||||
|
-
|
||||||
|
-#ifdef QT_NO_XKB
|
||||||
|
+ // when XKEYBOARD not present on the X server
|
||||||
|
void updateModifiers();
|
||||||
|
-#else
|
||||||
|
+ // when XKEYBOARD is present on the X server
|
||||||
|
void updateVModMapping();
|
||||||
|
void updateVModToRModMapping();
|
||||||
|
-#endif
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_config;
|
||||||
|
@@ -120,9 +120,8 @@ private:
|
||||||
|
|
||||||
|
_mod_masks rmod_masks;
|
||||||
|
|
||||||
|
-#ifdef QT_NO_XKB
|
||||||
|
+ // when XKEYBOARD not present on the X server
|
||||||
|
xcb_key_symbols_t *m_key_symbols;
|
||||||
|
-
|
||||||
|
struct _xkb_mods {
|
||||||
|
xkb_mod_index_t shift;
|
||||||
|
xkb_mod_index_t lock;
|
||||||
|
@@ -133,12 +132,10 @@ private:
|
||||||
|
xkb_mod_index_t mod4;
|
||||||
|
xkb_mod_index_t mod5;
|
||||||
|
};
|
||||||
|
-
|
||||||
|
_xkb_mods xkb_mods;
|
||||||
|
-#else
|
||||||
|
+ // when XKEYBOARD is present on the X server
|
||||||
|
_mod_masks vmod_masks;
|
||||||
|
int core_device_id;
|
||||||
|
-#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
--- a/src/plugins/platforms/xcb/xcb-plugin.pro
|
||||||
|
+++ b/src/plugins/platforms/xcb/xcb-plugin.pro
|
||||||
|
@@ -121,12 +121,8 @@ contains(QT_CONFIG, xcb-qt) {
|
||||||
|
INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/sysinclude
|
||||||
|
LIBS += -lxcb -L$$OUT_PWD/xcb-static -lxcb-static
|
||||||
|
} else {
|
||||||
|
- LIBS += -lxcb -lxcb-image -lxcb-icccm -lxcb-sync -lxcb-xfixes -lxcb-shm -lxcb-randr -lxcb-shape
|
||||||
|
- contains(DEFINES, QT_NO_XKB) {
|
||||||
|
- LIBS += -lxcb-keysyms
|
||||||
|
- } else {
|
||||||
|
- LIBS += -lxcb-xkb
|
||||||
|
- }
|
||||||
|
+ LIBS += -lxcb -lxcb-image -lxcb-icccm -lxcb-sync -lxcb-xfixes -lxcb-shm -lxcb-randr -lxcb-shape -lxcb-keysyms
|
||||||
|
+ !contains(DEFINES, QT_NO_XKB):LIBS += -lxcb-xkb
|
||||||
|
}
|
||||||
|
|
||||||
|
# libxkbcommon
|
122
libqt5-add-support-for-byte-swapping.patch
Normal file
122
libqt5-add-support-for-byte-swapping.patch
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
From a3ed9b781cb0e1fa4ae3b1cedcd63bd394903db7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Egbert Eich <eich@suse.de>
|
||||||
|
Date: Tue, 18 Mar 2014 18:29:02 +0100
|
||||||
|
Subject: [PATCH] [xcb/xsettings] Add support for byte swapping
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
The XSettings protocol is not endian neutral. Instead it holds
|
||||||
|
information about endianness in the first byte. It uses the same
|
||||||
|
convention as X11/X.h does.
|
||||||
|
So far byte order handling was missing leading to nasty crashes
|
||||||
|
when byte order between clients setting and reading XSettings
|
||||||
|
differed. This patch fixes this.
|
||||||
|
Using the X11/X.h conventions seems to be an 'established standard',
|
||||||
|
this piece is missing from the Xsettings specifications. Therefore
|
||||||
|
this fix may introduce spurious regressions as other Xsettings
|
||||||
|
'providers' may use a different convention. To detect this and
|
||||||
|
to avoid crashes the fix also adds checks to avoid reading past
|
||||||
|
the end of the of the Xsettings data blob. If problems are
|
||||||
|
encountered: warn and bail.
|
||||||
|
|
||||||
|
Change-Id: If8acb23cca2478369633129af2d99e122a84cede
|
||||||
|
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
|
||||||
|
---
|
||||||
|
src/plugins/platforms/xcb/qxcbxsettings.cpp | 43 +++++++++++++++++++++--------
|
||||||
|
1 file changed, 32 insertions(+), 11 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/plugins/platforms/xcb/qxcbxsettings.cpp b/src/plugins/platforms/xcb/qxcbxsettings.cpp
|
||||||
|
index 141a6cc..26d95e9 100644
|
||||||
|
--- a/src/plugins/platforms/xcb/qxcbxsettings.cpp
|
||||||
|
+++ b/src/plugins/platforms/xcb/qxcbxsettings.cpp
|
||||||
|
@@ -42,6 +42,7 @@
|
||||||
|
#include "qxcbxsettings.h"
|
||||||
|
|
||||||
|
#include <QtCore/QByteArray>
|
||||||
|
+#include <QtCore/QtEndian>
|
||||||
|
|
||||||
|
#include <X11/extensions/XIproto.h>
|
||||||
|
|
||||||
|
@@ -149,47 +150,67 @@ public:
|
||||||
|
{
|
||||||
|
if (xSettings.length() < 12)
|
||||||
|
return;
|
||||||
|
- // we ignore byteorder for now
|
||||||
|
char byteOrder = xSettings.at(1);
|
||||||
|
- Q_UNUSED(byteOrder);
|
||||||
|
- uint number_of_settings = *reinterpret_cast<const uint *>(xSettings.mid(8,4).constData());
|
||||||
|
+ if (byteOrder != LSBFirst && byteOrder != MSBFirst) {
|
||||||
|
+ qWarning("%s ByteOrder byte %d not 0 or 1", Q_FUNC_INFO , byteOrder);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+#define ADJUST_BO(b, t, x) \
|
||||||
|
+ ((b == LSBFirst) ? \
|
||||||
|
+ qFromLittleEndian<t>((const uchar *)(x)) : \
|
||||||
|
+ qFromBigEndian<t>((const uchar *)(x)))
|
||||||
|
+#define VALIDATE_LENGTH(x) \
|
||||||
|
+ if ((size_t)xSettings.length() < (offset + local_offset + 12 + x)) { \
|
||||||
|
+ qWarning("%s Length %d runs past end of data", Q_FUNC_INFO , x); \
|
||||||
|
+ return; \
|
||||||
|
+ }
|
||||||
|
|
||||||
|
+ uint number_of_settings = ADJUST_BO(byteOrder, quint32, xSettings.mid(8,4).constData());
|
||||||
|
const char *data = xSettings.constData() + 12;
|
||||||
|
size_t offset = 0;
|
||||||
|
for (uint i = 0; i < number_of_settings; i++) {
|
||||||
|
int local_offset = 0;
|
||||||
|
+ VALIDATE_LENGTH(2);
|
||||||
|
XSettingsType type = static_cast<XSettingsType>(*reinterpret_cast<const quint8 *>(data + offset));
|
||||||
|
local_offset += 2;
|
||||||
|
|
||||||
|
- quint16 name_len = *reinterpret_cast<const quint16 *>(data + offset + local_offset);
|
||||||
|
+ VALIDATE_LENGTH(2);
|
||||||
|
+ quint16 name_len = ADJUST_BO(byteOrder, quint16, data + offset + local_offset);
|
||||||
|
local_offset += 2;
|
||||||
|
|
||||||
|
+ VALIDATE_LENGTH(name_len);
|
||||||
|
QByteArray name(data + offset + local_offset, name_len);
|
||||||
|
local_offset += round_to_nearest_multiple_of_4(name_len);
|
||||||
|
|
||||||
|
- int last_change_serial = *reinterpret_cast<const int *>(data + offset + local_offset);
|
||||||
|
+ VALIDATE_LENGTH(4);
|
||||||
|
+ int last_change_serial = ADJUST_BO(byteOrder, qint32, data + offset + local_offset);
|
||||||
|
Q_UNUSED(last_change_serial);
|
||||||
|
local_offset += 4;
|
||||||
|
|
||||||
|
QVariant value;
|
||||||
|
if (type == XSettingsTypeString) {
|
||||||
|
- int value_length = *reinterpret_cast<const int *>(data + offset + local_offset);
|
||||||
|
+ VALIDATE_LENGTH(4);
|
||||||
|
+ int value_length = ADJUST_BO(byteOrder, qint32, data + offset + local_offset);
|
||||||
|
local_offset+=4;
|
||||||
|
+ VALIDATE_LENGTH(value_length);
|
||||||
|
QByteArray value_string(data + offset + local_offset, value_length);
|
||||||
|
value.setValue(value_string);
|
||||||
|
local_offset += round_to_nearest_multiple_of_4(value_length);
|
||||||
|
} else if (type == XSettingsTypeInteger) {
|
||||||
|
- int value_length = *reinterpret_cast<const int *>(data + offset + local_offset);
|
||||||
|
+ VALIDATE_LENGTH(4);
|
||||||
|
+ int value_length = ADJUST_BO(byteOrder, qint32, data + offset + local_offset);
|
||||||
|
local_offset += 4;
|
||||||
|
value.setValue(value_length);
|
||||||
|
} else if (type == XSettingsTypeColor) {
|
||||||
|
- quint16 red = *reinterpret_cast<const quint16 *>(data + offset + local_offset);
|
||||||
|
+ VALIDATE_LENGTH(2*4);
|
||||||
|
+ quint16 red = ADJUST_BO(byteOrder, quint16, data + offset + local_offset);
|
||||||
|
local_offset += 2;
|
||||||
|
- quint16 green = *reinterpret_cast<const quint16 *>(data + offset + local_offset);
|
||||||
|
+ quint16 green = ADJUST_BO(byteOrder, quint16, data + offset + local_offset);
|
||||||
|
local_offset += 2;
|
||||||
|
- quint16 blue = *reinterpret_cast<const quint16 *>(data + offset + local_offset);
|
||||||
|
+ quint16 blue = ADJUST_BO(byteOrder, quint16, data + offset + local_offset);
|
||||||
|
local_offset += 2;
|
||||||
|
- quint16 alpha= *reinterpret_cast<const quint16 *>(data + offset + local_offset);
|
||||||
|
+ quint16 alpha= ADJUST_BO(byteOrder, quint16, data + offset + local_offset);
|
||||||
|
local_offset += 2;
|
||||||
|
QColor color_value(red,green,blue,alpha);
|
||||||
|
value.setValue(color_value);
|
||||||
|
--
|
||||||
|
1.8.4.5
|
||||||
|
|
35
libqt5-byte-order-byte-is-address0.patch
Normal file
35
libqt5-byte-order-byte-is-address0.patch
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
From 5819ffe492cf3cd98718819b1bd837819318d82e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Egbert Eich <eich@suse.de>
|
||||||
|
Date: Sun, 6 Apr 2014 16:54:03 +0200
|
||||||
|
Subject: [PATCH] [xcb/xsettings] Byte order byte is at address 0
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Accoring to
|
||||||
|
http://standards.freedesktop.org\
|
||||||
|
/xsettings-spec/xsettings-spec-0.5.html
|
||||||
|
the byte order byte is address 0 (not 1).
|
||||||
|
|
||||||
|
Change-Id: I441084a7f24908dd8a504648bfc50ba2d486a586
|
||||||
|
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
|
||||||
|
---
|
||||||
|
src/plugins/platforms/xcb/qxcbxsettings.cpp | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/plugins/platforms/xcb/qxcbxsettings.cpp b/src/plugins/platforms/xcb/qxcbxsettings.cpp
|
||||||
|
index 26d95e9..17b40a4 100644
|
||||||
|
--- a/src/plugins/platforms/xcb/qxcbxsettings.cpp
|
||||||
|
+++ b/src/plugins/platforms/xcb/qxcbxsettings.cpp
|
||||||
|
@@ -150,7 +150,7 @@ public:
|
||||||
|
{
|
||||||
|
if (xSettings.length() < 12)
|
||||||
|
return;
|
||||||
|
- char byteOrder = xSettings.at(1);
|
||||||
|
+ char byteOrder = xSettings.at(0);
|
||||||
|
if (byteOrder != LSBFirst && byteOrder != MSBFirst) {
|
||||||
|
qWarning("%s ByteOrder byte %d not 0 or 1", Q_FUNC_INFO , byteOrder);
|
||||||
|
return;
|
||||||
|
--
|
||||||
|
1.8.4.5
|
||||||
|
|
92
libqt5-fix-build-failure-xcb.patch
Normal file
92
libqt5-fix-build-failure-xcb.patch
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
From ee3dea8d3fdc9477f3a54e5457e19be1d0c61de9 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Gatis Paeglis <gatis.paeglis@digia.com>
|
||||||
|
Date: Mon, 31 Mar 2014 14:48:29 +0200
|
||||||
|
Subject: [PATCH] [xcb] Fix build failure
|
||||||
|
|
||||||
|
Build failure was introduced by 9bb634a6176c639bd6b52d58151e9927c30919d0.
|
||||||
|
|
||||||
|
When linking with systems provided libxkbcommon, then DFLT_XKB_CONFIG_ROOT
|
||||||
|
can't be accessed directly.
|
||||||
|
|
||||||
|
The reason that this slip through CI is that on CI machines Qt
|
||||||
|
is build with bundled version of libxkbcommon.
|
||||||
|
|
||||||
|
In addition this patch improves keymap error message, by making it more explicit for
|
||||||
|
users what could be the reasons for "keymap compilation" failures and what should
|
||||||
|
be done to make input work. As it turns out this is a common issue on old systems,
|
||||||
|
servers and some VNC clients.
|
||||||
|
|
||||||
|
Task-number: QTBUG-37971
|
||||||
|
|
||||||
|
Change-Id: I77667a404150ee7ab8465a065e23ca5eea63c33b
|
||||||
|
Reviewed-by: Uli Schlachter <psychon@znc.in>
|
||||||
|
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
||||||
|
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
||||||
|
---
|
||||||
|
src/plugins/platforms/xcb/qxcbkeyboard.cpp | 28 +++++++++-------------------
|
||||||
|
src/plugins/platforms/xcb/qxcbkeyboard.h | 2 +-
|
||||||
|
2 files changed, 10 insertions(+), 20 deletions(-)
|
||||||
|
|
||||||
|
--- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp
|
||||||
|
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
|
||||||
|
@@ -663,23 +663,14 @@ void QXcbKeyboard::clearXKBConfig()
|
||||||
|
memset(&xkb_names, 0, sizeof(xkb_names));
|
||||||
|
}
|
||||||
|
|
||||||
|
-void QXcbKeyboard::printKeymapError(const QString &error) const
|
||||||
|
+void QXcbKeyboard::printKeymapError(const char *error) const
|
||||||
|
{
|
||||||
|
- qWarning() << "Qt: " << error;
|
||||||
|
- // check if XKB config root is a valid path
|
||||||
|
- const QDir xkbRoot = qEnvironmentVariableIsSet("QT_XKB_CONFIG_ROOT")
|
||||||
|
- ? QString::fromLocal8Bit(qgetenv("QT_XKB_CONFIG_ROOT"))
|
||||||
|
- : DFLT_XKB_CONFIG_ROOT;
|
||||||
|
- if (!xkbRoot.exists() || xkbRoot.dirName() != "xkb") {
|
||||||
|
- qWarning() << "Set QT_XKB_CONFIG_ROOT to provide a valid XKB configuration data path, current search paths: "
|
||||||
|
- << xkbRoot.path() << ". Use ':' as separator to provide several search paths.";
|
||||||
|
- return;
|
||||||
|
- }
|
||||||
|
- qWarning() << "_XKB_RULES_NAMES property contains:" << "\nrules : " << xkb_names.rules <<
|
||||||
|
- "\nmodel : " << xkb_names.model << "\nlayout : " << xkb_names.layout <<
|
||||||
|
- "\nvariant : " << xkb_names.variant << "\noptions : " << xkb_names.options <<
|
||||||
|
- "\nIf this looks like a valid keyboard layout information then you might need to "
|
||||||
|
- "update XKB configuration data on the system (http://cgit.freedesktop.org/xkeyboard-config/).";
|
||||||
|
+ qWarning() << error << "Current XKB configuration data search paths are: ";
|
||||||
|
+ for (unsigned int i = 0; i < xkb_context_num_include_paths(xkb_context); ++i)
|
||||||
|
+ qWarning() << xkb_context_include_path_get(xkb_context, i);
|
||||||
|
+ qWarning() << "Use QT_XKB_CONFIG_ROOT environmental variable to provide an additional search path, "
|
||||||
|
+ "add ':' as separator to provide several search paths and/or make sure that XKB configuration data "
|
||||||
|
+ "directory contains recent enough contents, to update please see http://cgit.freedesktop.org/xkeyboard-config/ .";
|
||||||
|
}
|
||||||
|
|
||||||
|
void QXcbKeyboard::updateKeymap()
|
||||||
|
@@ -696,7 +687,7 @@ void QXcbKeyboard::updateKeymap()
|
||||||
|
xkb_context = xkb_context_new((xkb_context_flags)0);
|
||||||
|
}
|
||||||
|
if (!xkb_context) {
|
||||||
|
- printKeymapError("Failed to create XKB context!");
|
||||||
|
+ printKeymapError("Qt: Failed to create XKB context!");
|
||||||
|
m_config = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
@@ -731,8 +722,7 @@ void QXcbKeyboard::updateKeymap()
|
||||||
|
if (xkb_keymap) {
|
||||||
|
new_state = xkb_state_new(xkb_keymap);
|
||||||
|
} else {
|
||||||
|
- // failed to compile from RMLVO, give a verbose error message
|
||||||
|
- printKeymapError("Qt: Failed to compile a keymap!");
|
||||||
|
+ printKeymapError("Failed to compile a keymap!");
|
||||||
|
m_config = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
--- a/src/plugins/platforms/xcb/qxcbkeyboard.h
|
||||||
|
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.h
|
||||||
|
@@ -92,7 +92,7 @@ protected:
|
||||||
|
QString keysymToUnicode(xcb_keysym_t sym) const;
|
||||||
|
int keysymToQtKey(xcb_keysym_t keysym) const;
|
||||||
|
int keysymToQtKey(xcb_keysym_t keysym, Qt::KeyboardModifiers &modifiers, QString text) const;
|
||||||
|
- void printKeymapError(const QString &error) const;
|
||||||
|
+ void printKeymapError(const char *error) const;
|
||||||
|
|
||||||
|
void readXKBConfig();
|
||||||
|
void clearXKBConfig();
|
86
libqt5-fix-regression-in-key-handling.patch
Normal file
86
libqt5-fix-regression-in-key-handling.patch
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
From 6ad458bc93162753e448eea28499e778e2946d2c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Gatis Paeglis <gatis.paeglis@digia.com>
|
||||||
|
Date: Mon, 31 Mar 2014 17:13:20 +0200
|
||||||
|
Subject: [PATCH] Fix regression in key handling.
|
||||||
|
|
||||||
|
libxkbcommon 0.4.1 added two new functions, xkb_state_key_get_utf{8,32}(). They
|
||||||
|
combine the operations of xkb_state_key_get_syms() and xkb_keysym_to_utf{8,32}().
|
||||||
|
|
||||||
|
The xkb_state_key_get_utf{8,32}() functions now apply Control transformation: when
|
||||||
|
the Control modifier is active, the string is converted to an appropriate control
|
||||||
|
character. This matches the behavior of libX11's XLookupString(3), and is required by
|
||||||
|
the XKB specification:
|
||||||
|
|
||||||
|
http://www.x.org/releases/current/doc/kbproto/xkbproto.html#Interpreting_the_Control_Modifier
|
||||||
|
|
||||||
|
Task-number: QTBUG-36281
|
||||||
|
Change-Id: Ib45f45d801291c171640600384107a35d7d56b9b
|
||||||
|
Reviewed-by: Ran Benita <ran234@gmail.com>
|
||||||
|
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
||||||
|
---
|
||||||
|
src/plugins/platforms/xcb/qxcbkeyboard.cpp | 19 ++++++++-----------
|
||||||
|
src/plugins/platforms/xcb/qxcbkeyboard.h | 2 +-
|
||||||
|
2 files changed, 9 insertions(+), 12 deletions(-)
|
||||||
|
|
||||||
|
--- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp
|
||||||
|
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
|
||||||
|
@@ -853,7 +853,7 @@ QList<int> QXcbKeyboard::possibleKeys(co
|
||||||
|
return QList<int>();
|
||||||
|
|
||||||
|
QList<int> result;
|
||||||
|
- int baseQtKey = keysymToQtKey(sym, modifiers, keysymToUnicode(sym));
|
||||||
|
+ int baseQtKey = keysymToQtKey(sym, modifiers, lookupString(kb_state, event->nativeScanCode()));
|
||||||
|
result += (baseQtKey + modifiers); // The base key is _always_ valid, of course
|
||||||
|
|
||||||
|
xkb_mod_index_t shiftMod = xkb_keymap_mod_get_index(xkb_keymap, "Shift");
|
||||||
|
@@ -900,7 +900,7 @@ QList<int> QXcbKeyboard::possibleKeys(co
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Qt::KeyboardModifiers mods = modifiers & ~neededMods;
|
||||||
|
- qtKey = keysymToQtKey(sym, mods, keysymToUnicode(sym));
|
||||||
|
+ qtKey = keysymToQtKey(sym, mods, lookupString(kb_state, event->nativeScanCode()));
|
||||||
|
|
||||||
|
if (qtKey == baseQtKey)
|
||||||
|
continue;
|
||||||
|
@@ -1316,7 +1316,8 @@ void QXcbKeyboard::handleKeyEvent(QWindo
|
||||||
|
}
|
||||||
|
|
||||||
|
Qt::KeyboardModifiers modifiers = translateModifiers(state);
|
||||||
|
- QString string = keysymToUnicode(sym);
|
||||||
|
+
|
||||||
|
+ QString string = lookupString(xkb_state, code);
|
||||||
|
int count = string.size();
|
||||||
|
string.truncate(count);
|
||||||
|
|
||||||
|
@@ -1379,16 +1380,12 @@ void QXcbKeyboard::handleKeyEvent(QWindo
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-QString QXcbKeyboard::keysymToUnicode(xcb_keysym_t sym) const
|
||||||
|
+QString QXcbKeyboard::lookupString(struct xkb_state *state, xcb_keycode_t code) const
|
||||||
|
{
|
||||||
|
QByteArray chars;
|
||||||
|
- int bytes;
|
||||||
|
- chars.resize(7);
|
||||||
|
- bytes = xkb_keysym_to_utf8(sym, chars.data(), chars.size());
|
||||||
|
- if (bytes == -1)
|
||||||
|
- qWarning("QXcbKeyboard::handleKeyEvent - buffer too small");
|
||||||
|
- chars.resize(bytes-1);
|
||||||
|
-
|
||||||
|
+ chars.resize(1 + xkb_state_key_get_utf8(state, code, 0, 0));
|
||||||
|
+ // equivalent of XLookupString
|
||||||
|
+ xkb_state_key_get_utf8(state, code, chars.data(), chars.size());
|
||||||
|
return QString::fromUtf8(chars);
|
||||||
|
}
|
||||||
|
|
||||||
|
--- a/src/plugins/platforms/xcb/qxcbkeyboard.h
|
||||||
|
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.h
|
||||||
|
@@ -86,7 +86,7 @@ protected:
|
||||||
|
void handleKeyEvent(QWindow *window, QEvent::Type type, xcb_keycode_t code, quint16 state, xcb_timestamp_t time);
|
||||||
|
|
||||||
|
void resolveMaskConflicts();
|
||||||
|
- QString keysymToUnicode(xcb_keysym_t sym) const;
|
||||||
|
+ QString lookupString(struct xkb_state *state, xcb_keycode_t code) const;
|
||||||
|
int keysymToQtKey(xcb_keysym_t keysym) const;
|
||||||
|
int keysymToQtKey(xcb_keysym_t keysym, Qt::KeyboardModifiers &modifiers, QString text) const;
|
||||||
|
void printKeymapError(const char *error) const;
|
158
libqt5-improve-keymap-error-handling.patch
Normal file
158
libqt5-improve-keymap-error-handling.patch
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
From 9bb634a6176c639bd6b52d58151e9927c30919d0 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Gatis Paeglis <gatis.paeglis@digia.com>
|
||||||
|
Date: Mon, 3 Mar 2014 18:00:33 +0100
|
||||||
|
Subject: [PATCH] Improve keymap error handling
|
||||||
|
|
||||||
|
- add QT_XKB_CONFIG_ROOT envvar, this can be used to provide an alternative
|
||||||
|
XKB configuration search paths (default XKB configuration root is detected when
|
||||||
|
building Qt library). At runtime these paths might change - when dropping Qt
|
||||||
|
application binary into a system with different setup.
|
||||||
|
|
||||||
|
Change-Id: Ia21a3e7f0339c95793c1f543d1a95b1591e5d8df
|
||||||
|
Reviewed-by: Uli Schlachter <psychon@znc.in>
|
||||||
|
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
||||||
|
---
|
||||||
|
src/plugins/platforms/xcb/qxcbkeyboard.cpp | 77 ++++++++++++++++++++++-------
|
||||||
|
src/plugins/platforms/xcb/qxcbkeyboard.h | 1
|
||||||
|
2 files changed, 61 insertions(+), 17 deletions(-)
|
||||||
|
|
||||||
|
--- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp
|
||||||
|
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
|
||||||
|
@@ -38,20 +38,22 @@
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
-
|
||||||
|
#include "qxcbkeyboard.h"
|
||||||
|
#include "qxcbwindow.h"
|
||||||
|
#include "qxcbscreen.h"
|
||||||
|
-#include <X11/keysym.h>
|
||||||
|
+
|
||||||
|
#include <qpa/qwindowsysteminterface.h>
|
||||||
|
+#include <qpa/qplatforminputcontext.h>
|
||||||
|
+#include <qpa/qplatformintegration.h>
|
||||||
|
+#include <qpa/qplatformcursor.h>
|
||||||
|
+
|
||||||
|
#include <QtCore/QTextCodec>
|
||||||
|
#include <QtCore/QMetaMethod>
|
||||||
|
+#include <QtCore/QDir>
|
||||||
|
#include <private/qguiapplication_p.h>
|
||||||
|
-#include <stdio.h>
|
||||||
|
|
||||||
|
-#include <qpa/qplatforminputcontext.h>
|
||||||
|
-#include <qpa/qplatformintegration.h>
|
||||||
|
-#include <qpa/qplatformcursor.h>
|
||||||
|
+#include <stdio.h>
|
||||||
|
+#include <X11/keysym.h>
|
||||||
|
|
||||||
|
#ifndef XK_ISO_Left_Tab
|
||||||
|
#define XK_ISO_Left_Tab 0xFE20
|
||||||
|
@@ -619,6 +621,12 @@ void QXcbKeyboard::readXKBConfig()
|
||||||
|
char *xkb_config = (char *)xcb_get_property_value(config_reply);
|
||||||
|
int length = xcb_get_property_value_length(config_reply);
|
||||||
|
|
||||||
|
+ // on old X servers xkb_config can be 0 even if config_reply indicates a succesfull read
|
||||||
|
+ if (!xkb_config || length == 0)
|
||||||
|
+ return;
|
||||||
|
+ // ### TODO some X servers don't set _XKB_RULES_NAMES at all, in these cases it is filled
|
||||||
|
+ // with gibberish, we would need to do some kind of sanity check
|
||||||
|
+
|
||||||
|
char *names[5] = { 0, 0, 0, 0, 0 };
|
||||||
|
char *p = xkb_config, *end = p + length;
|
||||||
|
int i = 0;
|
||||||
|
@@ -655,17 +663,45 @@ void QXcbKeyboard::clearXKBConfig()
|
||||||
|
memset(&xkb_names, 0, sizeof(xkb_names));
|
||||||
|
}
|
||||||
|
|
||||||
|
+void QXcbKeyboard::printKeymapError(const QString &error) const
|
||||||
|
+{
|
||||||
|
+ qWarning() << "Qt: " << error;
|
||||||
|
+ // check if XKB config root is a valid path
|
||||||
|
+ const QDir xkbRoot = qEnvironmentVariableIsSet("QT_XKB_CONFIG_ROOT")
|
||||||
|
+ ? QString::fromLocal8Bit(qgetenv("QT_XKB_CONFIG_ROOT"))
|
||||||
|
+ : DFLT_XKB_CONFIG_ROOT;
|
||||||
|
+ if (!xkbRoot.exists() || xkbRoot.dirName() != "xkb") {
|
||||||
|
+ qWarning() << "Set QT_XKB_CONFIG_ROOT to provide a valid XKB configuration data path, current search paths: "
|
||||||
|
+ << xkbRoot.path() << ". Use ':' as separator to provide several search paths.";
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ qWarning() << "_XKB_RULES_NAMES property contains:" << "\nrules : " << xkb_names.rules <<
|
||||||
|
+ "\nmodel : " << xkb_names.model << "\nlayout : " << xkb_names.layout <<
|
||||||
|
+ "\nvariant : " << xkb_names.variant << "\noptions : " << xkb_names.options <<
|
||||||
|
+ "\nIf this looks like a valid keyboard layout information then you might need to "
|
||||||
|
+ "update XKB configuration data on the system (http://cgit.freedesktop.org/xkeyboard-config/).";
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void QXcbKeyboard::updateKeymap()
|
||||||
|
{
|
||||||
|
m_config = true;
|
||||||
|
// set xkb context object
|
||||||
|
if (!xkb_context) {
|
||||||
|
- xkb_context = xkb_context_new((xkb_context_flags)0);
|
||||||
|
+ if (qEnvironmentVariableIsSet("QT_XKB_CONFIG_ROOT")) {
|
||||||
|
+ xkb_context = xkb_context_new((xkb_context_flags)XKB_CONTEXT_NO_DEFAULT_INCLUDES);
|
||||||
|
+ QList<QByteArray> xkbRootList = QByteArray(qgetenv("QT_XKB_CONFIG_ROOT")).split(':');
|
||||||
|
+ foreach (QByteArray xkbRoot, xkbRootList)
|
||||||
|
+ xkb_context_include_path_append(xkb_context, xkbRoot.constData());
|
||||||
|
+ } else {
|
||||||
|
+ xkb_context = xkb_context_new((xkb_context_flags)0);
|
||||||
|
+ }
|
||||||
|
if (!xkb_context) {
|
||||||
|
- qWarning("Qt: Failed to create XKB context");
|
||||||
|
+ printKeymapError("Failed to create XKB context!");
|
||||||
|
m_config = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
+ // log only critical errors, we do our own error logging from printKeymapError()
|
||||||
|
+ xkb_context_set_log_level(xkb_context, (xkb_log_level)XKB_LOG_LEVEL_CRITICAL);
|
||||||
|
}
|
||||||
|
// update xkb keymap object
|
||||||
|
xkb_keymap_unref(xkb_keymap);
|
||||||
|
@@ -685,21 +721,28 @@ void QXcbKeyboard::updateKeymap()
|
||||||
|
// Compile a keymap from RMLVO (rules, models, layouts, variants and options) names
|
||||||
|
readXKBConfig();
|
||||||
|
xkb_keymap = xkb_keymap_new_from_names(xkb_context, &xkb_names, (xkb_keymap_compile_flags)0);
|
||||||
|
- if (xkb_keymap)
|
||||||
|
+ if (!xkb_keymap) {
|
||||||
|
+ // last fallback is to used hard-coded keymap name, see DEFAULT_XKB_* in xkbcommon.pri
|
||||||
|
+ qWarning() << "Qt: Could not determine keyboard configuration data"
|
||||||
|
+ " from X server, will use hard-coded keymap configuration.";
|
||||||
|
+ clearXKBConfig();
|
||||||
|
+ xkb_keymap = xkb_keymap_new_from_names(xkb_context, &xkb_names, (xkb_keymap_compile_flags)0);
|
||||||
|
+ }
|
||||||
|
+ if (xkb_keymap) {
|
||||||
|
new_state = xkb_state_new(xkb_keymap);
|
||||||
|
- }
|
||||||
|
+ } else {
|
||||||
|
+ // failed to compile from RMLVO, give a verbose error message
|
||||||
|
+ printKeymapError("Qt: Failed to compile a keymap!");
|
||||||
|
+ m_config = false;
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
- if (!xkb_keymap) {
|
||||||
|
- qWarning("Qt: Failed to compile a keymap");
|
||||||
|
- m_config = false;
|
||||||
|
}
|
||||||
|
if (!new_state) {
|
||||||
|
- qWarning("Qt: Failed to create xkb state");
|
||||||
|
+ qWarning("Qt: Failed to create xkb state!");
|
||||||
|
m_config = false;
|
||||||
|
- }
|
||||||
|
- if (!m_config)
|
||||||
|
return;
|
||||||
|
-
|
||||||
|
+ }
|
||||||
|
// update xkb state object
|
||||||
|
xkb_state_unref(xkb_state);
|
||||||
|
xkb_state = new_state;
|
||||||
|
--- a/src/plugins/platforms/xcb/qxcbkeyboard.h
|
||||||
|
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.h
|
||||||
|
@@ -92,6 +92,7 @@ protected:
|
||||||
|
QString keysymToUnicode(xcb_keysym_t sym) const;
|
||||||
|
int keysymToQtKey(xcb_keysym_t keysym) const;
|
||||||
|
int keysymToQtKey(xcb_keysym_t keysym, Qt::KeyboardModifiers &modifiers, QString text) const;
|
||||||
|
+ void printKeymapError(const QString &error) const;
|
||||||
|
|
||||||
|
void readXKBConfig();
|
||||||
|
void clearXKBConfig();
|
@ -1,3 +1,22 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Apr 8 06:56:21 UTC 2014 - mlin@suse.com
|
||||||
|
|
||||||
|
- Add support for byte swapping, bnc#866709
|
||||||
|
* Add libqt5-add-support-for-byte-swapping.patch
|
||||||
|
* Add libqt5-byte-order-byte-is-address0.patch
|
||||||
|
- Fix keyboard remapping not applied on Qt5, bnc#866051
|
||||||
|
* Add backported libqt5-add-better-support-for-keymap-update-handling.patch
|
||||||
|
* Add backported libqt5-improve-keymap-error-handling.patch
|
||||||
|
* Add backported libqt5-fix-build-failure-xcb.patch
|
||||||
|
* Add backported libqt5-update-bundled-libxkbcommon-version-to-041.patch
|
||||||
|
* Add backported libqt5-fix-regression-in-key-handling.patch
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Mar 28 08:22:53 UTC 2014 - hrvoje.senjan@gmail.com
|
||||||
|
|
||||||
|
- The no-neon switch no longer exists with 5.3, so drop it: fixes
|
||||||
|
build on arm/aarch64
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Mar 25 11:44:16 UTC 2014 - hrvoje.senjan@gmail.com
|
Tue Mar 25 11:44:16 UTC 2014 - hrvoje.senjan@gmail.com
|
||||||
|
|
||||||
|
@ -46,6 +46,20 @@ Patch131: qmake-add-usr-include.diff
|
|||||||
Patch132: use-freetype-default.patch
|
Patch132: use-freetype-default.patch
|
||||||
# PATCH-FIX-UPSTREAM f1ee10f81ac18789e9a7dc715b464415ba2bc2b8.patch -- prefer QPA implementation in qsystemtrayicon_x11 if available
|
# PATCH-FIX-UPSTREAM f1ee10f81ac18789e9a7dc715b464415ba2bc2b8.patch -- prefer QPA implementation in qsystemtrayicon_x11 if available
|
||||||
Patch133: f1ee10f81ac18789e9a7dc715b464415ba2bc2b8.patch
|
Patch133: f1ee10f81ac18789e9a7dc715b464415ba2bc2b8.patch
|
||||||
|
# PATCH-FIX-UPSTREAM libqt5-add-better-support-for-keymap-update-handling.patch -- fixed keyboard remapping not applied(bnc#866051, qtbug#31527)
|
||||||
|
Patch134: libqt5-add-better-support-for-keymap-update-handling.patch
|
||||||
|
# PATCH-FIX-UPSTREAM libqt5-improve-keymap-error-handling.patch -- improve keymap error handling
|
||||||
|
Patch135: libqt5-improve-keymap-error-handling.patch
|
||||||
|
# PATCH-FIX-UPSTREAM libqt5-fix-build-failure-xcb.patch -- fix build failure in xcb(qtbug#37971)
|
||||||
|
Patch136: libqt5-fix-build-failure-xcb.patch
|
||||||
|
# PATCH-FIX-UPSTREAM libqt5-update-bundled-libxkbcommon-version-to-041.patch -- updated bundled libxkbcommon also updated the minimal requirement version at build(qtbug#36281)
|
||||||
|
Patch137: libqt5-update-bundled-libxkbcommon-version-to-041.patch
|
||||||
|
# PATCH-FIX-UPSTREAM libqt5-fix-regression-in-key-handling.patch -- introduced new function from libxkbcommon 0.4.1 to fix key handling regression(qtbug#36281)
|
||||||
|
Patch138: libqt5-fix-regression-in-key-handling.patch
|
||||||
|
# PATCH-FIX-UPSTREAM libqt5-add-support-for-byte-swapping.patch -- add support for byte swapping(bnc#866709), currently it's at the upstream dev branch
|
||||||
|
Patch139: libqt5-add-support-for-byte-swapping.patch
|
||||||
|
# PATCH-FIX-UPSTREAM libqt5-byte-order-byte-is-address0.patch -- the byte order byte is at address 0(bnc#866709), currently it's at the upstream dev branch
|
||||||
|
Patch140: libqt5-byte-order-byte-is-address0.patch
|
||||||
BuildRequires: alsa-devel
|
BuildRequires: alsa-devel
|
||||||
BuildRequires: cups-devel
|
BuildRequires: cups-devel
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
@ -91,9 +105,9 @@ BuildRequires: pkgconfig(harfbuzz)
|
|||||||
%endif
|
%endif
|
||||||
BuildRequires: pkgconfig(ice)
|
BuildRequires: pkgconfig(ice)
|
||||||
BuildRequires: pkgconfig(sm)
|
BuildRequires: pkgconfig(sm)
|
||||||
%if 0%{?suse_version} >= 1320
|
%if 0%{?suse_version} >= 1315
|
||||||
BuildRequires: pkgconfig(xkbcommon)
|
BuildRequires: pkgconfig(xkbcommon) >= 0.4.1
|
||||||
BuildRequires: pkgconfig(xkbcommon-x11)
|
BuildRequires: pkgconfig(xkbcommon-x11) >= 0.4.1
|
||||||
%else
|
%else
|
||||||
BuildRequires: xkeyboard-config
|
BuildRequires: xkeyboard-config
|
||||||
%endif
|
%endif
|
||||||
@ -130,6 +144,13 @@ handling.
|
|||||||
%patch131 -p1
|
%patch131 -p1
|
||||||
%patch132 -p1
|
%patch132 -p1
|
||||||
%patch133 -p1
|
%patch133 -p1
|
||||||
|
%patch134 -p1
|
||||||
|
%patch135 -p1
|
||||||
|
%patch136 -p1
|
||||||
|
%patch137 -p1
|
||||||
|
%patch138 -p1
|
||||||
|
%patch139 -p1
|
||||||
|
%patch140 -p1
|
||||||
|
|
||||||
# be sure not to use them
|
# be sure not to use them
|
||||||
rm -r src/3rdparty/{libjpeg,freetype,libpng,zlib}
|
rm -r src/3rdparty/{libjpeg,freetype,libpng,zlib}
|
||||||
@ -640,7 +661,7 @@ echo yes | ./configure $platform \
|
|||||||
-no-separate-debug-info \
|
-no-separate-debug-info \
|
||||||
-shared \
|
-shared \
|
||||||
-xkb \
|
-xkb \
|
||||||
%if 0%{?suse_version} >= 1320
|
%if 0%{?suse_version} >= 1315
|
||||||
-system-xkbcommon \
|
-system-xkbcommon \
|
||||||
%else
|
%else
|
||||||
-qt-xkbcommon \
|
-qt-xkbcommon \
|
||||||
@ -686,9 +707,6 @@ echo yes | ./configure $platform \
|
|||||||
-opengl desktop \
|
-opengl desktop \
|
||||||
%endif
|
%endif
|
||||||
-release \
|
-release \
|
||||||
%ifarch %arm aarch64
|
|
||||||
-no-neon \
|
|
||||||
%endif
|
|
||||||
-plugin-sql-sqlite -nomake tests \
|
-plugin-sql-sqlite -nomake tests \
|
||||||
-plugin-sql-psql -I/usr/include -I/usr/include/pgsql/ -I/usr/include/pgsql/server \
|
-plugin-sql-psql -I/usr/include -I/usr/include/pgsql/ -I/usr/include/pgsql/server \
|
||||||
-plugin-sql-odbc \
|
-plugin-sql-odbc \
|
||||||
|
7085
libqt5-update-bundled-libxkbcommon-version-to-041.patch
Normal file
7085
libqt5-update-bundled-libxkbcommon-version-to-041.patch
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user