From 0f4e9514006799244c896c2d1506811b5f23fcb9 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 13 May 2016 09:15:00 +0200 Subject: Rename private headers to _p.h Change-Id: I0f0d1bd8efabc39325eec7dba4166ae0bccbf6ff Reviewed-by: Johan Helsing Reviewed-by: Giulio Camuffo --- src/shared/qwaylandinputmethodeventbuilder.cpp | 2 +- src/shared/qwaylandinputmethodeventbuilder.h | 88 ---------------- src/shared/qwaylandinputmethodeventbuilder_p.h | 88 ++++++++++++++++ src/shared/qwaylandmimehelper.cpp | 2 +- src/shared/qwaylandmimehelper.h | 57 ----------- src/shared/qwaylandmimehelper_p.h | 57 +++++++++++ src/shared/qwaylandshmformathelper.h | 136 ------------------------- src/shared/qwaylandshmformathelper_p.h | 136 +++++++++++++++++++++++++ src/shared/qwaylandxkb.cpp | 2 +- src/shared/qwaylandxkb.h | 69 ------------- src/shared/qwaylandxkb_p.h | 69 +++++++++++++ 11 files changed, 353 insertions(+), 353 deletions(-) delete mode 100644 src/shared/qwaylandinputmethodeventbuilder.h create mode 100644 src/shared/qwaylandinputmethodeventbuilder_p.h delete mode 100644 src/shared/qwaylandmimehelper.h create mode 100644 src/shared/qwaylandmimehelper_p.h delete mode 100644 src/shared/qwaylandshmformathelper.h create mode 100644 src/shared/qwaylandshmformathelper_p.h delete mode 100644 src/shared/qwaylandxkb.h create mode 100644 src/shared/qwaylandxkb_p.h (limited to 'src/shared') diff --git a/src/shared/qwaylandinputmethodeventbuilder.cpp b/src/shared/qwaylandinputmethodeventbuilder.cpp index fe93f514..0e2d1a40 100644 --- a/src/shared/qwaylandinputmethodeventbuilder.cpp +++ b/src/shared/qwaylandinputmethodeventbuilder.cpp @@ -37,7 +37,7 @@ ** ****************************************************************************/ -#include "qwaylandinputmethodeventbuilder.h" +#include "qwaylandinputmethodeventbuilder_p.h" #include #include diff --git a/src/shared/qwaylandinputmethodeventbuilder.h b/src/shared/qwaylandinputmethodeventbuilder.h deleted file mode 100644 index 3912afc0..00000000 --- a/src/shared/qwaylandinputmethodeventbuilder.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com -** Contact: http://www.qt-project.org/legal -** -** This file is part of the plugins 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDINPUTMETHODEVENTBUILDER_H -#define QWAYLANDINPUTMETHODEVENTBUILDER_H - -#include - -QT_BEGIN_NAMESPACE - -class QWaylandInputMethodEventBuilder -{ -public: - QWaylandInputMethodEventBuilder(); - ~QWaylandInputMethodEventBuilder(); - - void reset(); - - void setCursorPosition(int32_t index, int32_t anchor); - void setDeleteSurroundingText(uint32_t beforeLength, uint32_t afterLength); - - void addPreeditStyling(uint32_t index, uint32_t length, uint32_t style); - void setPreeditCursor(int32_t index); - - QInputMethodEvent buildCommit(const QString &text); - QInputMethodEvent buildPreedit(const QString &text); - - static int indexFromWayland(const QString &text, int length, int base = 0); - static int indexToWayland(const QString &text, int length, int base = 0); -private: - QPair replacementForDeleteSurrounding(); - - int32_t m_anchor; - int32_t m_cursor; - uint32_t m_deleteBefore; - uint32_t m_deleteAfter; - - int32_t m_preeditCursor; - QList m_preeditStyles; -}; - -struct QWaylandInputMethodContentType { - uint32_t hint; - uint32_t purpose; - - static QWaylandInputMethodContentType convert(Qt::InputMethodHints hints); -}; - - -QT_END_NAMESPACE - -#endif // QWAYLANDINPUTMETHODEVENTBUILDER_H diff --git a/src/shared/qwaylandinputmethodeventbuilder_p.h b/src/shared/qwaylandinputmethodeventbuilder_p.h new file mode 100644 index 00000000..3912afc0 --- /dev/null +++ b/src/shared/qwaylandinputmethodeventbuilder_p.h @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/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 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDINPUTMETHODEVENTBUILDER_H +#define QWAYLANDINPUTMETHODEVENTBUILDER_H + +#include + +QT_BEGIN_NAMESPACE + +class QWaylandInputMethodEventBuilder +{ +public: + QWaylandInputMethodEventBuilder(); + ~QWaylandInputMethodEventBuilder(); + + void reset(); + + void setCursorPosition(int32_t index, int32_t anchor); + void setDeleteSurroundingText(uint32_t beforeLength, uint32_t afterLength); + + void addPreeditStyling(uint32_t index, uint32_t length, uint32_t style); + void setPreeditCursor(int32_t index); + + QInputMethodEvent buildCommit(const QString &text); + QInputMethodEvent buildPreedit(const QString &text); + + static int indexFromWayland(const QString &text, int length, int base = 0); + static int indexToWayland(const QString &text, int length, int base = 0); +private: + QPair replacementForDeleteSurrounding(); + + int32_t m_anchor; + int32_t m_cursor; + uint32_t m_deleteBefore; + uint32_t m_deleteAfter; + + int32_t m_preeditCursor; + QList m_preeditStyles; +}; + +struct QWaylandInputMethodContentType { + uint32_t hint; + uint32_t purpose; + + static QWaylandInputMethodContentType convert(Qt::InputMethodHints hints); +}; + + +QT_END_NAMESPACE + +#endif // QWAYLANDINPUTMETHODEVENTBUILDER_H diff --git a/src/shared/qwaylandmimehelper.cpp b/src/shared/qwaylandmimehelper.cpp index c223efbe..a5fdd34d 100644 --- a/src/shared/qwaylandmimehelper.cpp +++ b/src/shared/qwaylandmimehelper.cpp @@ -37,7 +37,7 @@ ** ****************************************************************************/ -#include "qwaylandmimehelper.h" +#include "qwaylandmimehelper_p.h" #include #include #include diff --git a/src/shared/qwaylandmimehelper.h b/src/shared/qwaylandmimehelper.h deleted file mode 100644 index 80487705..00000000 --- a/src/shared/qwaylandmimehelper.h +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDMIMEHELPER_H -#define QWAYLANDMIMEHELPER_H - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QWaylandMimeHelper -{ -public: - static QByteArray getByteArray(QMimeData *mimeData, const QString &mimeType); -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/shared/qwaylandmimehelper_p.h b/src/shared/qwaylandmimehelper_p.h new file mode 100644 index 00000000..80487705 --- /dev/null +++ b/src/shared/qwaylandmimehelper_p.h @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/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 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDMIMEHELPER_H +#define QWAYLANDMIMEHELPER_H + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QWaylandMimeHelper +{ +public: + static QByteArray getByteArray(QMimeData *mimeData, const QString &mimeType); +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/shared/qwaylandshmformathelper.h b/src/shared/qwaylandshmformathelper.h deleted file mode 100644 index 58db42e2..00000000 --- a/src/shared/qwaylandshmformathelper.h +++ /dev/null @@ -1,136 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDSHMFORMATHELPER_H -#define QWAYLANDSHMFORMATHELPER_H - -#include - -//the correct protocol header for the wayland server or wayland client has to be -//included before this file is included - -QT_BEGIN_NAMESPACE - -class QWaylandShmFormatHelper -{ -public: - static inline wl_shm_format fromQImageFormat(QImage::Format format); - static inline QImage::Format fromWaylandShmFormat(wl_shm_format format); - static inline QVector supportedWaylandFormats(); - -private: -//IMPLEMENTATION (which has to be inline in the header because of the include trick) - struct Array - { - Array(const size_t size, const wl_shm_format *data) - : size(size) - , data(data) - { } - const size_t size; - const wl_shm_format *data; - }; - - static const Array getData() - { - static wl_shm_format formats_array[] = { - wl_shm_format(INT_MIN), //Format_Invalid, - wl_shm_format(INT_MIN), //Format_Mono, - wl_shm_format(INT_MIN), //Format_MonoLSB, - wl_shm_format(INT_MIN), //Format_Indexed8, - WL_SHM_FORMAT_XRGB8888, //Format_RGB32, - WL_SHM_FORMAT_ARGB8888, //Format_ARGB32, - WL_SHM_FORMAT_ARGB8888, //Format_ARGB32_Premultiplied, - WL_SHM_FORMAT_RGB565, //Format_RGB16, - wl_shm_format(INT_MIN), //Format_ARGB8565_Premultiplied, - wl_shm_format(INT_MIN), //Format_RGB666, - wl_shm_format(INT_MIN), //Format_ARGB6666_Premultiplied, - WL_SHM_FORMAT_XRGB1555, //Format_RGB555, - wl_shm_format(INT_MIN), //Format_ARGB8555_Premultiplied, - WL_SHM_FORMAT_RGB888, //Format_RGB888, - WL_SHM_FORMAT_XRGB4444, //Format_RGB444, - WL_SHM_FORMAT_ARGB4444, //Format_ARGB4444_Premultiplied, - WL_SHM_FORMAT_XBGR8888, //Format_RGBX8888, - WL_SHM_FORMAT_ABGR8888, //Format_RGBA8888, - WL_SHM_FORMAT_ABGR8888, //Format_RGBA8888_Premultiplied, - WL_SHM_FORMAT_XBGR2101010, //Format_BGR30, - WL_SHM_FORMAT_ARGB2101010, //Format_A2BGR30_Premultiplied, - WL_SHM_FORMAT_XRGB2101010, //Format_RGB30, - WL_SHM_FORMAT_ARGB2101010, //Format_A2RGB30_Premultiplied, - WL_SHM_FORMAT_C8, //Format_Alpha8, - WL_SHM_FORMAT_C8 //Format_Grayscale8, - }; - const size_t size = sizeof(formats_array) / sizeof(*formats_array); - return Array(size, formats_array); - } -}; - -wl_shm_format QWaylandShmFormatHelper::fromQImageFormat(QImage::Format format) -{ - Array array = getData(); - if (array.size <= size_t(format)) - return wl_shm_format(INT_MIN); - return array.data[format]; -} - -QImage::Format QWaylandShmFormatHelper::fromWaylandShmFormat(wl_shm_format format) -{ - Array array = getData(); - for (size_t i = 0; i < array.size; i++) { - if (array.data[i] == format) - return QImage::Format(i); - } - return QImage::Format_Invalid; -} - -QVector QWaylandShmFormatHelper::supportedWaylandFormats() -{ - QVector retFormats; - Array array = getData(); - for (size_t i = 0; i < array.size; i++) { - if (int(array.data[i]) != INT_MIN - && !retFormats.contains(array.data[i])) { - retFormats.append(array.data[i]); - } - } - return retFormats; -} - -QT_END_NAMESPACE - -#endif //QWAYLANDSHMFORMATHELPER_H diff --git a/src/shared/qwaylandshmformathelper_p.h b/src/shared/qwaylandshmformathelper_p.h new file mode 100644 index 00000000..58db42e2 --- /dev/null +++ b/src/shared/qwaylandshmformathelper_p.h @@ -0,0 +1,136 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/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 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDSHMFORMATHELPER_H +#define QWAYLANDSHMFORMATHELPER_H + +#include + +//the correct protocol header for the wayland server or wayland client has to be +//included before this file is included + +QT_BEGIN_NAMESPACE + +class QWaylandShmFormatHelper +{ +public: + static inline wl_shm_format fromQImageFormat(QImage::Format format); + static inline QImage::Format fromWaylandShmFormat(wl_shm_format format); + static inline QVector supportedWaylandFormats(); + +private: +//IMPLEMENTATION (which has to be inline in the header because of the include trick) + struct Array + { + Array(const size_t size, const wl_shm_format *data) + : size(size) + , data(data) + { } + const size_t size; + const wl_shm_format *data; + }; + + static const Array getData() + { + static wl_shm_format formats_array[] = { + wl_shm_format(INT_MIN), //Format_Invalid, + wl_shm_format(INT_MIN), //Format_Mono, + wl_shm_format(INT_MIN), //Format_MonoLSB, + wl_shm_format(INT_MIN), //Format_Indexed8, + WL_SHM_FORMAT_XRGB8888, //Format_RGB32, + WL_SHM_FORMAT_ARGB8888, //Format_ARGB32, + WL_SHM_FORMAT_ARGB8888, //Format_ARGB32_Premultiplied, + WL_SHM_FORMAT_RGB565, //Format_RGB16, + wl_shm_format(INT_MIN), //Format_ARGB8565_Premultiplied, + wl_shm_format(INT_MIN), //Format_RGB666, + wl_shm_format(INT_MIN), //Format_ARGB6666_Premultiplied, + WL_SHM_FORMAT_XRGB1555, //Format_RGB555, + wl_shm_format(INT_MIN), //Format_ARGB8555_Premultiplied, + WL_SHM_FORMAT_RGB888, //Format_RGB888, + WL_SHM_FORMAT_XRGB4444, //Format_RGB444, + WL_SHM_FORMAT_ARGB4444, //Format_ARGB4444_Premultiplied, + WL_SHM_FORMAT_XBGR8888, //Format_RGBX8888, + WL_SHM_FORMAT_ABGR8888, //Format_RGBA8888, + WL_SHM_FORMAT_ABGR8888, //Format_RGBA8888_Premultiplied, + WL_SHM_FORMAT_XBGR2101010, //Format_BGR30, + WL_SHM_FORMAT_ARGB2101010, //Format_A2BGR30_Premultiplied, + WL_SHM_FORMAT_XRGB2101010, //Format_RGB30, + WL_SHM_FORMAT_ARGB2101010, //Format_A2RGB30_Premultiplied, + WL_SHM_FORMAT_C8, //Format_Alpha8, + WL_SHM_FORMAT_C8 //Format_Grayscale8, + }; + const size_t size = sizeof(formats_array) / sizeof(*formats_array); + return Array(size, formats_array); + } +}; + +wl_shm_format QWaylandShmFormatHelper::fromQImageFormat(QImage::Format format) +{ + Array array = getData(); + if (array.size <= size_t(format)) + return wl_shm_format(INT_MIN); + return array.data[format]; +} + +QImage::Format QWaylandShmFormatHelper::fromWaylandShmFormat(wl_shm_format format) +{ + Array array = getData(); + for (size_t i = 0; i < array.size; i++) { + if (array.data[i] == format) + return QImage::Format(i); + } + return QImage::Format_Invalid; +} + +QVector QWaylandShmFormatHelper::supportedWaylandFormats() +{ + QVector retFormats; + Array array = getData(); + for (size_t i = 0; i < array.size; i++) { + if (int(array.data[i]) != INT_MIN + && !retFormats.contains(array.data[i])) { + retFormats.append(array.data[i]); + } + } + return retFormats; +} + +QT_END_NAMESPACE + +#endif //QWAYLANDSHMFORMATHELPER_H diff --git a/src/shared/qwaylandxkb.cpp b/src/shared/qwaylandxkb.cpp index 32d24bd6..49925700 100644 --- a/src/shared/qwaylandxkb.cpp +++ b/src/shared/qwaylandxkb.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include "qwaylandxkb.h" +#include "qwaylandxkb_p.h" #include #include diff --git a/src/shared/qwaylandxkb.h b/src/shared/qwaylandxkb.h deleted file mode 100644 index 9b5c935a..00000000 --- a/src/shared/qwaylandxkb.h +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 Jolla Ltd -** Contact: http://www.qt-project.org/legal -** -** This file is part of the plugins 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDXKB_H -#define QWAYLANDXKB_H - -#ifndef QT_NO_WAYLAND_XKB - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QKeyEvent; - -class QWaylandXkb -{ -public: - static int keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers &modifiers, const QString &text); - static Qt::KeyboardModifiers modifiers(struct xkb_state *state); - - static QEvent::Type toQtEventType(uint32_t state); - static QString textFromKeysym(uint32_t keysym, Qt::KeyboardModifiers modifiers); - static QVector toKeysym(QKeyEvent *event); -}; - -QT_END_NAMESPACE - -#endif // QT_NO_WAYLAND_XKB - -#endif diff --git a/src/shared/qwaylandxkb_p.h b/src/shared/qwaylandxkb_p.h new file mode 100644 index 00000000..9b5c935a --- /dev/null +++ b/src/shared/qwaylandxkb_p.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2016 Jolla Ltd +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/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 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDXKB_H +#define QWAYLANDXKB_H + +#ifndef QT_NO_WAYLAND_XKB + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QKeyEvent; + +class QWaylandXkb +{ +public: + static int keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers &modifiers, const QString &text); + static Qt::KeyboardModifiers modifiers(struct xkb_state *state); + + static QEvent::Type toQtEventType(uint32_t state); + static QString textFromKeysym(uint32_t keysym, Qt::KeyboardModifiers modifiers); + static QVector toKeysym(QKeyEvent *event); +}; + +QT_END_NAMESPACE + +#endif // QT_NO_WAYLAND_XKB + +#endif -- cgit v1.2.1