Add xcb-xkb to 3rd party libs
1) -qt-xcb a) Use xkb from the 3rd party libs. As it is done for the other xcb dependencies when qt configure with -qt-xcb. 2) -system-xcb (default) a) If xkb found then use xkb from the system. (Currenly xkb is not enabled by default when configuring libxcb library). b) If xkb can't be found on the system then keyboard state will be updated from X11 core events. Change-Id: I7c3dbce6daa2cec52067cd5af80f19040233a0db Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
This commit is contained in:
parent
2122e731ab
commit
9c1d62cc95
60
config.tests/qpa/xcb-xkb/xcb-xkb.cpp
Normal file
60
config.tests/qpa/xcb-xkb/xcb-xkb.cpp
Normal file
@ -0,0 +1,60 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the config.tests of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <xcb/xcb.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++ */
|
||||
#define explicit dont_use_cxx_explicit
|
||||
#include <xcb/xkb.h>
|
||||
#undef explicit
|
||||
|
||||
int main(int, char **)
|
||||
{
|
||||
int primaryScreen = 0;
|
||||
|
||||
xcb_connection_t *connection = xcb_connect("", &primaryScreen);
|
||||
|
||||
// This won't compile unless libxcb >= 1.5 which defines XCB_ATOM_PRIMARY.
|
||||
int xcbAtomPrimary = XCB_ATOM_PRIMARY;
|
||||
|
||||
return 0;
|
||||
}
|
5
config.tests/qpa/xcb-xkb/xcb-xkb.pro
Normal file
5
config.tests/qpa/xcb-xkb/xcb-xkb.pro
Normal file
@ -0,0 +1,5 @@
|
||||
SOURCES = xcb-xkb.cpp
|
||||
CONFIG -= qt
|
||||
|
||||
LIBS += -lxcb -lxcb-xkb
|
||||
|
10
configure
vendored
10
configure
vendored
@ -5170,6 +5170,16 @@ if [ "$CFG_XCB" != "no" ]; then
|
||||
XCB_PACKAGES="xcb xcb-shm xcb-sync xcb-xfixes xcb-randr xcb-image xcb-keysyms xcb-icccm"
|
||||
QMAKE_CFLAGS_XCB="`$PKG_CONFIG --cflags $XCB_PACKAGES 2>/dev/null`"
|
||||
QMAKE_LIBS_XCB="`$PKG_CONFIG --libs $XCB_PACKAGES 2>/dev/null`"
|
||||
# for xcb-xkb tests
|
||||
QMAKE_CFLAGS_XKB="`$PKG_CONFIG --cflags xcb xcb-xkb 2>/dev/null`"
|
||||
QMAKE_LIBS_XKB="`$PKG_CONFIG --libs xcb xcb-xkb 2>/dev/null`"
|
||||
fi
|
||||
|
||||
if compileTest qpa/xcb-xkb "xcb-xkb" $QMAKE_CFLAGS_XKB $QMAKE_LIBS_XKB; then
|
||||
CFG_XKB=yes
|
||||
else
|
||||
CFG_XKB=no
|
||||
QMakeVar add DEFINES QT_NO_XKB
|
||||
fi
|
||||
|
||||
if compileTest qpa/xcb-syslibs "xcb-syslibs" $QMAKE_CFLAGS_XCB $QMAKE_LIBS_XCB; then
|
||||
|
1
src/3rdparty/xcb/README
vendored
1
src/3rdparty/xcb/README
vendored
@ -1,6 +1,7 @@
|
||||
Contains the header and sources files from selected xcb libraries:
|
||||
|
||||
libxcb-1.5 together with xcb-proto-1.6 (sync, xfixes, randr sources)
|
||||
libxcb-1.8.1 together with xcb-proto-1.8 (xkb sources)
|
||||
libxcb-util-image-0.3.9
|
||||
libxcb-util-keysyms-0.3.9
|
||||
libxcb-util-renderutil-0.3.8
|
||||
|
14871
src/3rdparty/xcb/include/xcb/xkb.h
vendored
Normal file
14871
src/3rdparty/xcb/include/xcb/xkb.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
22021
src/3rdparty/xcb/libxcb/xkb.c
vendored
Normal file
22021
src/3rdparty/xcb/libxcb/xkb.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
172
src/3rdparty/xcb/libxcb/xkb.patch
vendored
Normal file
172
src/3rdparty/xcb/libxcb/xkb.patch
vendored
Normal file
@ -0,0 +1,172 @@
|
||||
diff --git src/3rdparty/xcb/libxcb/xkb.c src/3rdparty/xcb/libxcb/xkb.c
|
||||
index cd09226..3e07d6d 100644
|
||||
--- src/3rdparty/xcb/libxcb/xkb.c
|
||||
+++ src/3rdparty/xcb/libxcb/xkb.c
|
||||
@@ -15,6 +15,15 @@
|
||||
|
||||
xcb_extension_t xcb_xkb_id = { "XKEYBOARD", 0 };
|
||||
|
||||
+int qt_xcb_sumof(uint8_t *list, int len)
|
||||
+{
|
||||
+ int i, s = 0;
|
||||
+ for(i=0; i<len; i++) {
|
||||
+ s += *list;
|
||||
+ list++;
|
||||
+ }
|
||||
+ return s;
|
||||
+}
|
||||
|
||||
/*****************************************************************************
|
||||
**
|
||||
@@ -9622,7 +9631,7 @@ int
|
||||
xcb_xkb_get_names_value_list_kt_level_names_length (const xcb_xkb_get_names_reply_t *R /**< */,
|
||||
const xcb_xkb_get_names_value_list_t *S /**< */)
|
||||
{
|
||||
- return xcb_sumof(/* valueList */ S->nLevelsPerType, R->nTypes);
|
||||
+ return qt_xcb_sumof(/* valueList */ S->nLevelsPerType, R->nTypes);
|
||||
}
|
||||
|
||||
|
||||
@@ -9640,7 +9649,7 @@ xcb_xkb_get_names_value_list_kt_level_names_end (const xcb_xkb_get_names_reply_t
|
||||
const xcb_xkb_get_names_value_list_t *S /**< */)
|
||||
{
|
||||
xcb_generic_iterator_t i;
|
||||
- i.data = /* valueList */ S->ktLevelNames + xcb_sumof(/* valueList */ S->nLevelsPerType, R->nTypes);
|
||||
+ i.data = /* valueList */ S->ktLevelNames + qt_xcb_sumof(/* valueList */ S->nLevelsPerType, R->nTypes);
|
||||
i.rem = 0;
|
||||
i.index = (char *) i.data - (char *) S;
|
||||
return i;
|
||||
@@ -10089,8 +10098,8 @@ xcb_xkb_get_names_value_list_serialize (void **_
|
||||
xcb_block_len = 0;
|
||||
/* ktLevelNames */
|
||||
xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->ktLevelNames;
|
||||
- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t);
|
||||
- xcb_parts[xcb_parts_idx].iov_len = xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t);
|
||||
+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t);
|
||||
+ xcb_parts[xcb_parts_idx].iov_len = qt_xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t);
|
||||
xcb_parts_idx++;
|
||||
xcb_align_to = ALIGNOF(xcb_atom_t);
|
||||
}
|
||||
@@ -10330,7 +10339,7 @@ xcb_xkb_get_names_value_list_unpack (const void *_buffer /
|
||||
xcb_block_len = 0;
|
||||
/* ktLevelNames */
|
||||
_aux->ktLevelNames = (xcb_atom_t *)xcb_tmp;
|
||||
- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t);
|
||||
+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t);
|
||||
xcb_tmp += xcb_block_len;
|
||||
xcb_align_to = ALIGNOF(xcb_atom_t);
|
||||
}
|
||||
@@ -10707,7 +10716,7 @@ int
|
||||
xcb_xkb_set_names_values_kt_level_names_length (const xcb_xkb_set_names_request_t *R /**< */,
|
||||
const xcb_xkb_set_names_values_t *S /**< */)
|
||||
{
|
||||
- return xcb_sumof(/* values */ S->nLevelsPerType, R->nKTLevels);
|
||||
+ return qt_xcb_sumof(/* values */ S->nLevelsPerType, R->nKTLevels);
|
||||
}
|
||||
|
||||
|
||||
@@ -10725,7 +10734,7 @@ xcb_xkb_set_names_values_kt_level_names_end (const xcb_xkb_set_names_request_t *
|
||||
const xcb_xkb_set_names_values_t *S /**< */)
|
||||
{
|
||||
xcb_generic_iterator_t i;
|
||||
- i.data = /* values */ S->ktLevelNames + xcb_sumof(/* values */ S->nLevelsPerType, R->nKTLevels);
|
||||
+ i.data = /* values */ S->ktLevelNames + qt_xcb_sumof(/* values */ S->nLevelsPerType, R->nKTLevels);
|
||||
i.rem = 0;
|
||||
i.index = (char *) i.data - (char *) S;
|
||||
return i;
|
||||
@@ -11175,8 +11184,8 @@ xcb_xkb_set_names_values_serialize (void **_buffer
|
||||
xcb_block_len = 0;
|
||||
/* ktLevelNames */
|
||||
xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->ktLevelNames;
|
||||
- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
|
||||
- xcb_parts[xcb_parts_idx].iov_len = xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
|
||||
+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
|
||||
+ xcb_parts[xcb_parts_idx].iov_len = qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
|
||||
xcb_parts_idx++;
|
||||
xcb_align_to = ALIGNOF(xcb_atom_t);
|
||||
}
|
||||
@@ -11417,7 +11426,7 @@ xcb_xkb_set_names_values_unpack (const void *_buffer /**< */,
|
||||
xcb_block_len = 0;
|
||||
/* ktLevelNames */
|
||||
_aux->ktLevelNames = (xcb_atom_t *)xcb_tmp;
|
||||
- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
|
||||
+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
|
||||
xcb_tmp += xcb_block_len;
|
||||
xcb_align_to = ALIGNOF(xcb_atom_t);
|
||||
}
|
||||
@@ -16654,7 +16663,7 @@ int
|
||||
xcb_xkb_get_kbd_by_name_replies_key_names_value_list_kt_level_names_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */,
|
||||
const xcb_xkb_get_kbd_by_name_replies_t *S /**< */)
|
||||
{
|
||||
- return xcb_sumof(/* replies */ S->key_names.valueList.nLevelsPerType, /* replies */ S->key_names.nKTLevels);
|
||||
+ return qt_xcb_sumof(/* replies */ S->key_names.valueList.nLevelsPerType, /* replies */ S->key_names.nKTLevels);
|
||||
}
|
||||
|
||||
|
||||
@@ -16672,7 +16681,7 @@ xcb_xkb_get_kbd_by_name_replies_key_names_value_list_kt_level_names_end (const x
|
||||
const xcb_xkb_get_kbd_by_name_replies_t *S /**< */)
|
||||
{
|
||||
xcb_generic_iterator_t i;
|
||||
- i.data = /* replies */ S->key_names.valueList.ktLevelNames + xcb_sumof(/* replies */ S->key_names.valueList.nLevelsPerType, /* replies */ S->key_names.nKTLevels);
|
||||
+ i.data = /* replies */ S->key_names.valueList.ktLevelNames + qt_xcb_sumof(/* replies */ S->key_names.valueList.nLevelsPerType, /* replies */ S->key_names.nKTLevels);
|
||||
i.rem = 0;
|
||||
i.index = (char *) i.data - (char *) S;
|
||||
return i;
|
||||
@@ -17122,8 +17131,8 @@ xcb_xkb_get_kbd_by_name_replies_key_names_value_list_serialize (void
|
||||
xcb_block_len = 0;
|
||||
/* ktLevelNames */
|
||||
xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->ktLevelNames;
|
||||
- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
|
||||
- xcb_parts[xcb_parts_idx].iov_len = xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
|
||||
+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
|
||||
+ xcb_parts[xcb_parts_idx].iov_len = qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
|
||||
xcb_parts_idx++;
|
||||
xcb_align_to = ALIGNOF(xcb_atom_t);
|
||||
}
|
||||
@@ -17364,7 +17373,7 @@ xcb_xkb_get_kbd_by_name_replies_key_names_value_list_unpack (const void
|
||||
xcb_block_len = 0;
|
||||
/* ktLevelNames */
|
||||
_aux->ktLevelNames = (xcb_atom_t *)xcb_tmp;
|
||||
- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
|
||||
+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
|
||||
xcb_tmp += xcb_block_len;
|
||||
xcb_align_to = ALIGNOF(xcb_atom_t);
|
||||
}
|
||||
@@ -17624,7 +17633,7 @@ int
|
||||
xcb_xkb_get_kbd_by_name_replies_other_names_value_list_kt_level_names_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */,
|
||||
const xcb_xkb_get_kbd_by_name_replies_t *S /**< */)
|
||||
{
|
||||
- return xcb_sumof(/* replies */ S->other_names.valueList.nLevelsPerType, /* replies */ S->other_names.nKTLevels);
|
||||
+ return qt_xcb_sumof(/* replies */ S->other_names.valueList.nLevelsPerType, /* replies */ S->other_names.nKTLevels);
|
||||
}
|
||||
|
||||
|
||||
@@ -17642,7 +17651,7 @@ xcb_xkb_get_kbd_by_name_replies_other_names_value_list_kt_level_names_end (const
|
||||
const xcb_xkb_get_kbd_by_name_replies_t *S /**< */)
|
||||
{
|
||||
xcb_generic_iterator_t i;
|
||||
- i.data = /* replies */ S->other_names.valueList.ktLevelNames + xcb_sumof(/* replies */ S->other_names.valueList.nLevelsPerType, /* replies */ S->other_names.nKTLevels);
|
||||
+ i.data = /* replies */ S->other_names.valueList.ktLevelNames + qt_xcb_sumof(/* replies */ S->other_names.valueList.nLevelsPerType, /* replies */ S->other_names.nKTLevels);
|
||||
i.rem = 0;
|
||||
i.index = (char *) i.data - (char *) S;
|
||||
return i;
|
||||
@@ -18092,8 +18101,8 @@ xcb_xkb_get_kbd_by_name_replies_other_names_value_list_serialize (void
|
||||
xcb_block_len = 0;
|
||||
/* ktLevelNames */
|
||||
xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->ktLevelNames;
|
||||
- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
|
||||
- xcb_parts[xcb_parts_idx].iov_len = xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
|
||||
+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
|
||||
+ xcb_parts[xcb_parts_idx].iov_len = qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
|
||||
xcb_parts_idx++;
|
||||
xcb_align_to = ALIGNOF(xcb_atom_t);
|
||||
}
|
||||
@@ -18334,7 +18343,7 @@ xcb_xkb_get_kbd_by_name_replies_other_names_value_list_unpack (const void
|
||||
xcb_block_len = 0;
|
||||
/* ktLevelNames */
|
||||
_aux->ktLevelNames = (xcb_atom_t *)xcb_tmp;
|
||||
- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
|
||||
+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
|
||||
xcb_tmp += xcb_block_len;
|
||||
xcb_align_to = ALIGNOF(xcb_atom_t);
|
||||
}
|
@ -113,6 +113,7 @@ contains(QT_CONFIG, xcb-qt) {
|
||||
} else {
|
||||
LIBS += -lxcb -lxcb-image -lxcb-keysyms -lxcb-icccm -lxcb-sync -lxcb-xfixes -lxcb-shm -lxcb-randr
|
||||
!contains(DEFINES, QT_NO_SHAPE):LIBS += -lxcb-shape
|
||||
!contains(DEFINES, QT_NO_XKB):LIBS += -lxcb-xkb
|
||||
}
|
||||
|
||||
# libxkbcommon
|
||||
|
@ -24,7 +24,8 @@ SOURCES += \
|
||||
$$LIBXCB_DIR/shm.c \
|
||||
$$LIBXCB_DIR/sync.c \
|
||||
$$LIBXCB_DIR/render.c \
|
||||
$$LIBXCB_DIR/shape.c
|
||||
$$LIBXCB_DIR/shape.c \
|
||||
$$LIBXCB_DIR/xkb.c
|
||||
|
||||
#
|
||||
# xcb-util
|
||||
|
Loading…
Reference in New Issue
Block a user