diff options
Diffstat (limited to 'src/virtualkeyboard/desktopinputpanel.cpp')
-rw-r--r-- | src/virtualkeyboard/desktopinputpanel.cpp | 81 |
1 files changed, 7 insertions, 74 deletions
diff --git a/src/virtualkeyboard/desktopinputpanel.cpp b/src/virtualkeyboard/desktopinputpanel.cpp index cdaf1ffd..d578330f 100644 --- a/src/virtualkeyboard/desktopinputpanel.cpp +++ b/src/virtualkeyboard/desktopinputpanel.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtVirtualKeyboard/private/qvirtualkeyboard_global_p.h> #include <QtVirtualKeyboard/private/desktopinputpanel_p.h> @@ -38,10 +12,6 @@ #include <QQmlEngine> #include <QScreen> #include <QtVirtualKeyboard/private/virtualkeyboarddebug_p.h> -#if QT_CONFIG(vkb_xcb) -#include <xcb/xcb.h> -#include <xcb/xfixes.h> -#endif #include <qpa/qplatformnativeinterface.h> #include <QtCore/private/qobject_p.h> #include <QtCore/QLibraryInfo> @@ -155,7 +125,7 @@ void DesktopInputPanel::createView() break; } d->view->setColor(QColor(Qt::transparent)); - d->view->setSource(QUrl(QLatin1String("qrc:///QtQuick/VirtualKeyboard/content/InputPanel.qml"))); + d->view->setSource(QUrl(QLatin1String("qrc:///qt-project.org/imports/QtQuick/VirtualKeyboard/InputPanel.qml"))); if (QGuiApplication *app = qGuiApp) connect(app, SIGNAL(aboutToQuit()), SLOT(destroyView())); } @@ -226,18 +196,6 @@ void DesktopInputPanel::previewVisibleChanged() updateInputRegion(); } -#if QT_CONFIG(vkb_xcb) -static inline xcb_rectangle_t qRectToXCBRectangle(const QRect &r) -{ - xcb_rectangle_t result; - result.x = qMax(SHRT_MIN, r.x()); - result.y = qMax(SHRT_MIN, r.y()); - result.width = qMin((int)USHRT_MAX, r.width()); - result.height = qMin((int)USHRT_MAX, r.height()); - return result; -} -#endif - void DesktopInputPanel::updateInputRegion() { Q_D(DesktopInputPanel); @@ -249,36 +207,11 @@ void DesktopInputPanel::updateInputRegion() if (!d->view->handle()) d->view->create(); - switch (d->windowingSystem) { - case DesktopInputPanelPrivate::Xcb: -#if QT_CONFIG(vkb_xcb) - { - QList<xcb_rectangle_t> rects; - rects.push_back(qRectToXCBRectangle(d->keyboardRect.toRect())); - if (d->previewVisible && !d->previewRect.isEmpty()) - rects.push_back(qRectToXCBRectangle(d->previewRect.toRect())); - - QWindow *window = d->view.data(); - QPlatformNativeInterface *platformNativeInterface = QGuiApplication::platformNativeInterface(); - xcb_connection_t *xbcConnection = static_cast<xcb_connection_t *>(platformNativeInterface->nativeResourceForWindow("connection", window)); - xcb_xfixes_region_t xbcRegion = xcb_generate_id(xbcConnection); - xcb_xfixes_create_region(xbcConnection, xbcRegion, rects.size(), rects.constData()); - xcb_xfixes_set_window_shape_region(xbcConnection, window->winId(), XCB_SHAPE_SK_INPUT, 0, 0, xbcRegion); - xcb_xfixes_destroy_region(xbcConnection, xbcRegion); - } -#endif - break; + QRegion inputRegion(d->keyboardRect.toRect()); + if (d->previewVisible && !d->previewRect.isEmpty()) + inputRegion += d->previewRect.toRect(); - default: - { - QRegion inputRegion(d->keyboardRect.toRect()); - if (d->previewVisible && !d->previewRect.isEmpty()) - inputRegion += d->previewRect.toRect(); - - d->view->setMask(inputRegion); - break; - } - } + d->view->setMask(inputRegion); } } // namespace QtVirtualKeyboard |