Merge remote-tracking branch 'qt/5.8' into dev
Change-Id: I8a9455105e8e3519f6a860f58820382d7e337b1e
This commit is contained in:
commit
50b875e12c
@ -15,26 +15,10 @@ use_gold_linker: CONFIG += no_linker_version_script
|
||||
CONFIG -= precompile_header
|
||||
CONFIG += link_pkgconfig wayland-scanner
|
||||
|
||||
contains(QT_CONFIG, opengl) {
|
||||
DEFINES += QT_WAYLAND_GL_SUPPORT
|
||||
}
|
||||
qtConfig(xkbcommon-evdev): \
|
||||
QMAKE_USE_PRIVATE += xkbcommon_evdev
|
||||
|
||||
config_xkbcommon {
|
||||
!contains(QT_CONFIG, no-pkg-config) {
|
||||
PKGCONFIG_PRIVATE += xkbcommon
|
||||
} else {
|
||||
LIBS_PRIVATE += -lxkbcommon
|
||||
}
|
||||
} else {
|
||||
DEFINES += QT_NO_WAYLAND_XKB
|
||||
}
|
||||
|
||||
!contains(QT_CONFIG, no-pkg-config) {
|
||||
PKGCONFIG_PRIVATE += wayland-client wayland-cursor
|
||||
contains(QT_CONFIG, glib): PKGCONFIG_PRIVATE += glib-2.0
|
||||
} else {
|
||||
LIBS_PRIVATE += -lwayland-client -lwayland-cursor $$QT_LIBS_GLIB
|
||||
}
|
||||
QMAKE_USE += wayland-client wayland-cursor
|
||||
|
||||
INCLUDEPATH += $$PWD/../shared
|
||||
|
||||
@ -66,7 +50,7 @@ SOURCES += qwaylandintegration.cpp \
|
||||
qwaylandwlshellintegration.cpp \
|
||||
qwaylandxdgshell.cpp \
|
||||
qwaylandxdgsurface.cpp \
|
||||
qwaylandxdgpopup_p.cpp \
|
||||
qwaylandxdgpopup.cpp \
|
||||
qwaylandxdgshellintegration.cpp \
|
||||
qwaylandextendedsurface.cpp \
|
||||
qwaylandsubsurface.cpp \
|
||||
@ -117,7 +101,8 @@ HEADERS += qwaylandintegration_p.h \
|
||||
qwaylandinputcontext_p.h \
|
||||
qwaylanddatadevice_p.h \
|
||||
qwaylandshm_p.h \
|
||||
qwaylandclientexport.h \
|
||||
qtwaylandclientglobal.h \
|
||||
qtwaylandclientglobal_p.h \
|
||||
../shared/qwaylandinputmethodeventbuilder_p.h \
|
||||
../shared/qwaylandmimehelper_p.h \
|
||||
../shared/qwaylandxkb_p.h \
|
||||
|
134
src/plugins/platforms/wayland/configure.json
Normal file
134
src/plugins/platforms/wayland/configure.json
Normal file
@ -0,0 +1,134 @@
|
||||
{
|
||||
"module": "waylandclient",
|
||||
"depends": [
|
||||
"gui-private"
|
||||
],
|
||||
"testDir": "../../config.tests",
|
||||
|
||||
"libraries": {
|
||||
"wayland-client": {
|
||||
"label": "Wayland client library",
|
||||
"test": "wayland",
|
||||
"sources": [
|
||||
{ "type": "pkgConfig", "args": "wayland-client" },
|
||||
"-lwayland-client"
|
||||
]
|
||||
},
|
||||
"wayland-cursor": {
|
||||
"label": "Wayland cursor library",
|
||||
"test": "wayland_cursor",
|
||||
"use": "wayland-client",
|
||||
"sources": [
|
||||
{ "type": "pkgConfig", "args": "wayland-cursor" },
|
||||
"-lwayland-cursor"
|
||||
]
|
||||
},
|
||||
"wayland-egl": {
|
||||
"label": "Wayland EGL library",
|
||||
"test": "wayland_egl",
|
||||
"sources": [
|
||||
{ "type": "pkgConfig", "args": "wayland-egl" },
|
||||
"-lwayland-egl"
|
||||
]
|
||||
},
|
||||
"xcomposite": {
|
||||
"label": "XComposite",
|
||||
"test": "xcomposite",
|
||||
"sources": [
|
||||
{ "type": "pkgConfig", "args": "xcomposite" },
|
||||
"-lxcomposite"
|
||||
]
|
||||
},
|
||||
"glx": {
|
||||
"label": "GLX",
|
||||
"test": "glx",
|
||||
"sources": [
|
||||
{ "type": "pkgConfig", "args": "x11 gl" },
|
||||
"-lX11 -lGl"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
"tests": {
|
||||
"wayland-scanner": {
|
||||
"label": "wayland-scanner",
|
||||
"type": "compile",
|
||||
"test": "wayland_scanner",
|
||||
"use": "wayland-client"
|
||||
},
|
||||
"drm-egl-server": {
|
||||
"label": "DRM EGL Server",
|
||||
"type": "compile",
|
||||
"test": "drm_egl_server",
|
||||
"use": "egl"
|
||||
},
|
||||
"libhybris-egl-server": {
|
||||
"label": "libhybris EGL Server",
|
||||
"type": "compile",
|
||||
"test": "libhybris_egl_server",
|
||||
"use": "egl"
|
||||
}
|
||||
},
|
||||
|
||||
"features": {
|
||||
"wayland-client": {
|
||||
"label": "Qt Wayland Client",
|
||||
"condition": "!config.win32 && libs.wayland-client && libs.wayland-cursor && tests.wayland-scanner",
|
||||
"output": [ "privateFeature" ]
|
||||
},
|
||||
"wayland-egl": {
|
||||
"label": "EGL",
|
||||
"condition": "features.wayland-client && features.opengl && features.egl && libs.wayland-egl",
|
||||
"output": [ "privateFeature" ]
|
||||
},
|
||||
"wayland-brcm": {
|
||||
"label": "Rasberry Pi",
|
||||
"condition": "features.wayland-client && features.eglfs_brcm",
|
||||
"output": [ "privateFeature" ]
|
||||
},
|
||||
"xcomposite-egl": {
|
||||
"label": "XComposite EGL",
|
||||
"condition": "features.wayland-client && features.opengl && features.egl && libs.xcomposite",
|
||||
"output": [ "privateFeature" ]
|
||||
},
|
||||
"xcomposite-glx": {
|
||||
"label": "XComposite GLX",
|
||||
"condition": "features.wayland-client && features.opengl && !features.opengles2 && libs.xcomposite && libs.glx",
|
||||
"output": [ "privateFeature" ]
|
||||
},
|
||||
"drm-egl-server": {
|
||||
"label": "DRM EGL",
|
||||
"condition": "features.wayland-client && features.opengl && features.egl && tests.drm-egl-server",
|
||||
"output": [ "privateFeature" ]
|
||||
},
|
||||
"libhybris-egl-server": {
|
||||
"label": "libhybris EGL",
|
||||
"condition": "features.wayland-client && features.opengl && features.egl && tests.libhybris-egl-server",
|
||||
"output": [ "privateFeature" ]
|
||||
}
|
||||
},
|
||||
|
||||
"report": [
|
||||
{
|
||||
"type": "note",
|
||||
"condition": "!libs.wayland-egl",
|
||||
"message": "No wayland-egl support detected. Cross-toolkit compatibility disabled."
|
||||
}
|
||||
],
|
||||
|
||||
"summary": [
|
||||
{
|
||||
"section": "Qt Wayland Drivers",
|
||||
"condition": "features.wayland-client",
|
||||
"entries": [
|
||||
"wayland-egl",
|
||||
"wayland-brcm",
|
||||
"xcomposite-egl",
|
||||
"xcomposite-glx",
|
||||
"drm-egl-server",
|
||||
"libhybris-egl-server"
|
||||
]
|
||||
},
|
||||
"wayland-client"
|
||||
]
|
||||
}
|
@ -38,7 +38,7 @@
|
||||
#define QWAYLANDCLIENTEXTENSION_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
|
||||
struct wl_registry;
|
||||
|
||||
|
@ -52,7 +52,7 @@
|
||||
//
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace QtWaylandClient {
|
||||
|
||||
#ifndef QT_NO_LIBRARY
|
||||
#if QT_CONFIG(library)
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
|
||||
(QWaylandClientBufferIntegrationFactoryInterface_iid, QLatin1String("/wayland-graphics-integration-client"), Qt::CaseInsensitive))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
|
||||
@ -57,7 +57,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
|
||||
|
||||
QStringList QWaylandClientBufferIntegrationFactory::keys(const QString &pluginPath)
|
||||
{
|
||||
#ifndef QT_NO_LIBRARY
|
||||
#if QT_CONFIG(library)
|
||||
QStringList list;
|
||||
if (!pluginPath.isEmpty()) {
|
||||
QCoreApplication::addLibraryPath(pluginPath);
|
||||
@ -80,7 +80,7 @@ QStringList QWaylandClientBufferIntegrationFactory::keys(const QString &pluginPa
|
||||
|
||||
QWaylandClientBufferIntegration *QWaylandClientBufferIntegrationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath)
|
||||
{
|
||||
#ifndef QT_NO_LIBRARY
|
||||
#if QT_CONFIG(library)
|
||||
// Try loading the plugin from platformPluginPath first:
|
||||
if (!pluginPath.isEmpty()) {
|
||||
QCoreApplication::addLibraryPath(pluginPath);
|
||||
|
@ -51,7 +51,7 @@
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
#include <QtCore/QStringList>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
@ -51,7 +51,7 @@
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
|
||||
#include <QtCore/qplugin.h>
|
||||
#include <QtCore/qfactoryinterface.h>
|
||||
|
@ -52,7 +52,7 @@
|
||||
//
|
||||
|
||||
#include <QtWaylandClient/private/qwayland-hardware-integration.h>
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
@ -55,7 +55,7 @@
|
||||
#include <QtGui/qopengl.h>
|
||||
|
||||
#include <QtWaylandClient/private/qwayland-server-buffer-extension.h>
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace QtWaylandClient {
|
||||
|
||||
#ifndef QT_NO_LIBRARY
|
||||
#if QT_CONFIG(library)
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
|
||||
(QWaylandServerBufferIntegrationFactoryInterface_iid, QLatin1String("/wayland-graphics-integration-client"), Qt::CaseInsensitive))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
|
||||
@ -57,7 +57,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
|
||||
|
||||
QStringList QWaylandServerBufferIntegrationFactory::keys(const QString &pluginPath)
|
||||
{
|
||||
#ifndef QT_NO_LIBRARY
|
||||
#if QT_CONFIG(library)
|
||||
QStringList list;
|
||||
if (!pluginPath.isEmpty()) {
|
||||
QCoreApplication::addLibraryPath(pluginPath);
|
||||
@ -80,7 +80,7 @@ QStringList QWaylandServerBufferIntegrationFactory::keys(const QString &pluginPa
|
||||
|
||||
QWaylandServerBufferIntegration *QWaylandServerBufferIntegrationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath)
|
||||
{
|
||||
#ifndef QT_NO_LIBRARY
|
||||
#if QT_CONFIG(library)
|
||||
// Try loading the plugin from platformPluginPath first:
|
||||
if (!pluginPath.isEmpty()) {
|
||||
QCoreApplication::addLibraryPath(pluginPath);
|
||||
|
@ -51,7 +51,7 @@
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
#include <QtCore/QStringList>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
@ -51,7 +51,7 @@
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
|
||||
#include <QtCore/qplugin.h>
|
||||
#include <QtCore/qfactoryinterface.h>
|
||||
|
@ -52,7 +52,7 @@
|
||||
//
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace QtWaylandClient {
|
||||
|
||||
#ifndef QT_NO_LIBRARY
|
||||
#if QT_CONFIG(library)
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
|
||||
(QWaylandInputDeviceIntegrationFactoryInterface_iid, QLatin1String("/wayland-inputdevice-integration"), Qt::CaseInsensitive))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
|
||||
@ -57,7 +57,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
|
||||
|
||||
QStringList QWaylandInputDeviceIntegrationFactory::keys(const QString &pluginPath)
|
||||
{
|
||||
#ifndef QT_NO_LIBRARY
|
||||
#if QT_CONFIG(library)
|
||||
QStringList list;
|
||||
if (!pluginPath.isEmpty()) {
|
||||
QCoreApplication::addLibraryPath(pluginPath);
|
||||
@ -80,7 +80,7 @@ QStringList QWaylandInputDeviceIntegrationFactory::keys(const QString &pluginPat
|
||||
|
||||
QWaylandInputDeviceIntegration *QWaylandInputDeviceIntegrationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath)
|
||||
{
|
||||
#ifndef QT_NO_LIBRARY
|
||||
#if QT_CONFIG(library)
|
||||
// Try loading the plugin from platformPluginPath first:
|
||||
if (!pluginPath.isEmpty()) {
|
||||
QCoreApplication::addLibraryPath(pluginPath);
|
||||
|
@ -51,7 +51,7 @@
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
#include <QtCore/QStringList>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
@ -51,7 +51,7 @@
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
|
||||
#include <QtCore/qplugin.h>
|
||||
#include <QtCore/qfactoryinterface.h>
|
||||
|
@ -5,12 +5,7 @@ OTHER_FILES += \
|
||||
|
||||
SOURCES += main.cpp
|
||||
|
||||
contains(QT_CONFIG, no-pkg-config) {
|
||||
LIBS += -lwayland-client
|
||||
} else {
|
||||
CONFIG += link_pkgconfig
|
||||
PKGCONFIG += wayland-client
|
||||
}
|
||||
QMAKE_USE += wayland-client
|
||||
|
||||
PLUGIN_TYPE = wayland-decoration-client
|
||||
load(qt_plugin)
|
||||
|
@ -56,7 +56,7 @@ namespace QtWaylandClient {
|
||||
|
||||
#define BUTTON_SPACING 5
|
||||
|
||||
#ifndef QT_NO_IMAGEFORMAT_XPM
|
||||
#if QT_CONFIG(imageformat_xpm)
|
||||
# define BUTTON_WIDTH 10
|
||||
|
||||
static const char * const qt_close_xpm[] = {
|
||||
@ -265,7 +265,7 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device)
|
||||
p.restore();
|
||||
}
|
||||
|
||||
#ifndef QT_NO_IMAGEFORMAT_XPM
|
||||
#if QT_CONFIG(imageformat_xpm)
|
||||
p.save();
|
||||
|
||||
// Close button
|
||||
|
@ -1,21 +1,15 @@
|
||||
TEMPLATE=subdirs
|
||||
QT_FOR_CONFIG += waylandclient-private
|
||||
|
||||
config_wayland_egl: \
|
||||
qtConfig(wayland-egl): \
|
||||
SUBDIRS += wayland-egl
|
||||
|
||||
config_brcm_egl: \
|
||||
qtConfig(wayland-brcm): \
|
||||
SUBDIRS += brcm-egl
|
||||
|
||||
config_xcomposite {
|
||||
contains(QT_CONFIG, egl): \
|
||||
SUBDIRS += xcomposite-egl
|
||||
|
||||
!contains(QT_CONFIG, opengles2):config_glx: \
|
||||
SUBDIRS += xcomposite-glx
|
||||
}
|
||||
|
||||
config_drm_egl_server: \
|
||||
qtConfig(xcomposite-egl): \
|
||||
SUBDIRS += xcomposite-egl
|
||||
qtConfig(xcomposite-glx): \
|
||||
SUBDIRS += xcomposite-glx
|
||||
qtConfig(drm-egl-server): \
|
||||
SUBDIRS += drm-egl-server
|
||||
|
||||
config_libhybris_egl_server: \
|
||||
qtConfig(libhybris-egl-server): \
|
||||
SUBDIRS += libhybris-egl-server
|
||||
|
@ -37,8 +37,8 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QWAYLANDCLIENTEXPORT_H
|
||||
#define QWAYLANDCLIENTEXPORT_H
|
||||
#ifndef QWAYLANDCLIENTGLOBAL_H
|
||||
#define QWAYLANDCLIENTGLOBAL_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
@ -51,7 +51,8 @@
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
#include <QtGui/qtguiglobal.h>
|
||||
#include <QtWaylandClient/qtwaylandclient-config.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -65,5 +66,5 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif //QWAYLANDCLIENTEXPORT_H
|
||||
#endif //QWAYLANDCLIENTGLOBAL_H
|
||||
|
59
src/plugins/platforms/wayland/qtwaylandclientglobal_p.h
Normal file
59
src/plugins/platforms/wayland/qtwaylandclientglobal_p.h
Normal file
@ -0,0 +1,59 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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 QWAYLANDCLIENTGLOBAL_P_H
|
||||
#define QWAYLANDCLIENTGLOBAL_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
#include <QtGui/private/qtguiglobal_p.h>
|
||||
#include <QtWaylandClient/private/qtwaylandclient-config_p.h>
|
||||
|
||||
#endif //QWAYLANDCLIENTGLOBAL_P_H
|
||||
|
@ -59,7 +59,7 @@
|
||||
#include <QtGui/QColor>
|
||||
#include <QtGui/QStaticText>
|
||||
#include <QtGui/QImage>
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
|
||||
#include <wayland-client.h>
|
||||
|
||||
|
@ -51,7 +51,7 @@
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
|
||||
#include <QtCore/QSize>
|
||||
#include <QtCore/QRect>
|
||||
|
@ -44,6 +44,8 @@
|
||||
#include "qwaylanddatasource_p.h"
|
||||
#include "qwaylanddatadevice_p.h"
|
||||
|
||||
#if QT_CONFIG(draganddrop)
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace QtWaylandClient {
|
||||
@ -60,11 +62,11 @@ QWaylandClipboard::~QWaylandClipboard()
|
||||
QMimeData *QWaylandClipboard::mimeData(QClipboard::Mode mode)
|
||||
{
|
||||
if (mode != QClipboard::Clipboard)
|
||||
return 0;
|
||||
return &m_emptyData;
|
||||
|
||||
QWaylandInputDevice *inputDevice = mDisplay->currentInputDevice();
|
||||
if (!inputDevice || !inputDevice->dataDevice())
|
||||
return 0;
|
||||
return &m_emptyData;
|
||||
|
||||
QWaylandDataSource *source = inputDevice->dataDevice()->selectionSource();
|
||||
if (source) {
|
||||
@ -74,7 +76,7 @@ QMimeData *QWaylandClipboard::mimeData(QClipboard::Mode mode)
|
||||
if (inputDevice->dataDevice()->selectionOffer())
|
||||
return inputDevice->dataDevice()->selectionOffer()->mimeData();
|
||||
|
||||
return 0;
|
||||
return &m_emptyData;
|
||||
}
|
||||
|
||||
void QWaylandClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode)
|
||||
@ -115,3 +117,5 @@ bool QWaylandClipboard::ownsMode(QClipboard::Mode mode) const
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // draganddrop
|
||||
|
@ -53,9 +53,11 @@
|
||||
|
||||
#include <qpa/qplatformclipboard.h>
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtCore/QMimeData>
|
||||
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
|
||||
#if QT_CONFIG(draganddrop)
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace QtWaylandClient {
|
||||
@ -76,10 +78,13 @@ public:
|
||||
|
||||
private:
|
||||
QWaylandDisplay *mDisplay;
|
||||
QMimeData m_emptyData;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // draganddrop
|
||||
|
||||
#endif // QWAYLANDCLIPBOARD_H
|
||||
|
@ -53,7 +53,7 @@
|
||||
|
||||
#include <qpa/qplatformcursor.h>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
|
||||
struct wl_cursor;
|
||||
struct wl_cursor_image;
|
||||
|
@ -56,6 +56,8 @@
|
||||
#include <qpa/qplatformdrag.h>
|
||||
#include <qpa/qwindowsysteminterface.h>
|
||||
|
||||
#if QT_CONFIG(draganddrop)
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace QtWaylandClient {
|
||||
@ -268,3 +270,5 @@ QPoint QWaylandDataDevice::calculateDragPosition(int x, int y, QWindow *wnd) con
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // draganddrop
|
||||
|
@ -52,12 +52,15 @@
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <qtwaylandclientglobal.h>
|
||||
#include <QObject>
|
||||
#include <QPointer>
|
||||
#include <QPoint>
|
||||
|
||||
#include <QtWaylandClient/private/qwayland-wayland.h>
|
||||
|
||||
#if QT_CONFIG(draganddrop)
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QMimeData;
|
||||
@ -120,4 +123,6 @@ private:
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // draganddrop
|
||||
|
||||
#endif // QWAYLANDDATADEVICE_H
|
||||
|
@ -46,6 +46,8 @@
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
#if QT_CONFIG(draganddrop)
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace QtWaylandClient {
|
||||
@ -80,3 +82,5 @@ QWaylandDisplay *QWaylandDataDeviceManager::display() const
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // draganddrop
|
||||
|
@ -51,9 +51,11 @@
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
#include <QtWaylandClient/private/qwayland-wayland.h>
|
||||
|
||||
#if QT_CONFIG(draganddrop)
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace QtWaylandClient {
|
||||
@ -81,4 +83,6 @@ private:
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // draganddrop
|
||||
|
||||
#endif // QWAYLANDDATADEVICEMANAGER_H
|
||||
|
@ -47,6 +47,8 @@
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
#if QT_CONFIG(draganddrop)
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace QtWaylandClient {
|
||||
@ -181,3 +183,5 @@ int QWaylandMimeData::readData(int fd, QByteArray &data) const
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // draganddrop
|
||||
|
@ -53,9 +53,10 @@
|
||||
|
||||
#include <QtGui/private/qdnd_p.h>
|
||||
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
#include <QtWaylandClient/private/qwayland-wayland.h>
|
||||
|
||||
#if QT_CONFIG(draganddrop)
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace QtWaylandClient {
|
||||
@ -105,5 +106,5 @@ private:
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // draganddrop
|
||||
#endif
|
||||
|
@ -49,6 +49,8 @@
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#if QT_CONFIG(draganddrop)
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace QtWaylandClient {
|
||||
@ -96,3 +98,5 @@ void QWaylandDataSource::data_source_target(const QString &mime_type)
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // draganddrop
|
||||
|
@ -54,7 +54,9 @@
|
||||
#include <QObject>
|
||||
|
||||
#include <QtWaylandClient/private/qwayland-wayland.h>
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
|
||||
#if QT_CONFIG(draganddrop)
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -92,4 +94,6 @@ private:
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // draganddrop
|
||||
|
||||
#endif // QWAYLANDDATASOURCE_H
|
||||
|
@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace QtWaylandClient {
|
||||
|
||||
#ifndef QT_NO_LIBRARY
|
||||
#if QT_CONFIG(library)
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
|
||||
(QWaylandDecorationFactoryInterface_iid, QLatin1String("/wayland-decoration-client"), Qt::CaseInsensitive))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
|
||||
@ -57,7 +57,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
|
||||
|
||||
QStringList QWaylandDecorationFactory::keys(const QString &pluginPath)
|
||||
{
|
||||
#ifndef QT_NO_LIBRARY
|
||||
#if QT_CONFIG(library)
|
||||
QStringList list;
|
||||
if (!pluginPath.isEmpty()) {
|
||||
QCoreApplication::addLibraryPath(pluginPath);
|
||||
@ -80,7 +80,7 @@ QStringList QWaylandDecorationFactory::keys(const QString &pluginPath)
|
||||
|
||||
QWaylandAbstractDecoration *QWaylandDecorationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath)
|
||||
{
|
||||
#ifndef QT_NO_LIBRARY
|
||||
#if QT_CONFIG(library)
|
||||
// Try loading the plugin from platformPluginPath first:
|
||||
if (!pluginPath.isEmpty()) {
|
||||
QCoreApplication::addLibraryPath(pluginPath);
|
||||
|
@ -51,7 +51,7 @@
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
#include <QtCore/QStringList>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
@ -51,7 +51,7 @@
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
|
||||
#include <QtCore/qplugin.h>
|
||||
#include <QtCore/qfactoryinterface.h>
|
||||
|
@ -120,7 +120,9 @@ QWaylandWindowManagerIntegration *QWaylandDisplay::windowManagerIntegration() co
|
||||
|
||||
QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration)
|
||||
: mWaylandIntegration(waylandIntegration)
|
||||
#if QT_CONFIG(draganddrop)
|
||||
, mDndSelectionHandler(0)
|
||||
#endif
|
||||
, mWindowExtension(0)
|
||||
, mSubCompositor(0)
|
||||
, mTouchExtension(0)
|
||||
@ -158,7 +160,9 @@ QWaylandDisplay::~QWaylandDisplay(void)
|
||||
mWaylandIntegration->destroyScreen(screen);
|
||||
}
|
||||
mScreens.clear();
|
||||
#if QT_CONFIG(draganddrop)
|
||||
delete mDndSelectionHandler.take();
|
||||
#endif
|
||||
wl_display_disconnect(mDisplay);
|
||||
}
|
||||
|
||||
@ -251,8 +255,10 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
|
||||
} else if (interface == QStringLiteral("wl_seat")) {
|
||||
QWaylandInputDevice *inputDevice = mWaylandIntegration->createInputDevice(this, version, id);
|
||||
mInputDevices.append(inputDevice);
|
||||
#if QT_CONFIG(draganddrop)
|
||||
} else if (interface == QStringLiteral("wl_data_device_manager")) {
|
||||
mDndSelectionHandler.reset(new QWaylandDataDeviceManager(this, id));
|
||||
#endif
|
||||
} else if (interface == QStringLiteral("qt_surface_extension")) {
|
||||
mWindowExtension.reset(new QtWayland::qt_surface_extension(registry, id, 1));
|
||||
} else if (interface == QStringLiteral("wl_subcompositor")) {
|
||||
@ -413,11 +419,7 @@ void QWaylandDisplay::handleKeyboardFocusChanged(QWaylandInputDevice *inputDevic
|
||||
if (mLastKeyboardFocus == keyboardFocus)
|
||||
return;
|
||||
|
||||
if (keyboardFocus && !keyboardFocus->shellManagesActiveState())
|
||||
handleWindowActivated(keyboardFocus);
|
||||
|
||||
if (mLastKeyboardFocus && !mLastKeyboardFocus->shellManagesActiveState())
|
||||
handleWindowDeactivated(mLastKeyboardFocus);
|
||||
mWaylandIntegration->mShellIntegration->handleKeyboardFocusChanged(keyboardFocus, mLastKeyboardFocus);
|
||||
|
||||
mLastKeyboardFocus = keyboardFocus;
|
||||
}
|
||||
|
@ -61,7 +61,7 @@
|
||||
#include <wayland-client.h>
|
||||
|
||||
#include <QtWaylandClient/private/qwayland-wayland.h>
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
#include <QtWaylandClient/private/qwayland-xdg-shell.h>
|
||||
#include <QtWaylandClient/private/qwaylandshm_p.h>
|
||||
|
||||
@ -137,9 +137,9 @@ public:
|
||||
QList<QWaylandInputDevice *> inputDevices() const { return mInputDevices; }
|
||||
QWaylandInputDevice *defaultInputDevice() const;
|
||||
QWaylandInputDevice *currentInputDevice() const { return defaultInputDevice(); }
|
||||
|
||||
#if QT_CONFIG(draganddrop)
|
||||
QWaylandDataDeviceManager *dndSelectionHandler() const { return mDndSelectionHandler.data(); }
|
||||
|
||||
#endif
|
||||
QtWayland::qt_surface_extension *windowExtension() const { return mWindowExtension.data(); }
|
||||
QWaylandTouchExtension *touchExtension() const { return mTouchExtension.data(); }
|
||||
QtWayland::zwp_text_input_manager_v2 *textInputManager() const { return mTextInputManager.data(); }
|
||||
@ -202,7 +202,9 @@ private:
|
||||
QList<QWaylandInputDevice *> mInputDevices;
|
||||
QList<Listener> mRegistryListeners;
|
||||
QWaylandIntegration *mWaylandIntegration;
|
||||
#if QT_CONFIG(draganddrop)
|
||||
QScopedPointer<QWaylandDataDeviceManager> mDndSelectionHandler;
|
||||
#endif
|
||||
QScopedPointer<QtWayland::qt_surface_extension> mWindowExtension;
|
||||
QScopedPointer<QtWayland::wl_subcompositor> mSubCompositor;
|
||||
QScopedPointer<QWaylandTouchExtension> mTouchExtension;
|
||||
|
@ -50,7 +50,7 @@
|
||||
#include <QDebug>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#if QT_CONFIG(draganddrop)
|
||||
namespace QtWaylandClient {
|
||||
|
||||
QWaylandDrag::QWaylandDrag(QWaylandDisplay *display)
|
||||
@ -98,7 +98,7 @@ void QWaylandDrag::drop(const QPoint &globalPos)
|
||||
|
||||
void QWaylandDrag::endDrag()
|
||||
{
|
||||
// Do nothing
|
||||
m_display->currentInputDevice()->handleEndDrag();
|
||||
}
|
||||
|
||||
void QWaylandDrag::updateTarget(const QString &mimeType)
|
||||
@ -131,5 +131,5 @@ void QWaylandDrag::finishDrag(const QPlatformDropQtResponse &response)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // draganddrop
|
||||
QT_END_NAMESPACE
|
||||
|
@ -57,14 +57,14 @@
|
||||
#include <QtGui/QDrag>
|
||||
#include <QtCore/QMimeData>
|
||||
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace QtWaylandClient {
|
||||
|
||||
class QWaylandDisplay;
|
||||
|
||||
#if QT_CONFIG(draganddrop)
|
||||
class Q_WAYLAND_CLIENT_EXPORT QWaylandDrag : public QBasicDrag
|
||||
{
|
||||
public:
|
||||
@ -88,7 +88,7 @@ protected:
|
||||
private:
|
||||
QWaylandDisplay *m_display;
|
||||
};
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -54,7 +54,7 @@
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QVariant>
|
||||
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
|
||||
#include <wayland-client.h>
|
||||
#include <QtWaylandClient/private/qwayland-surface-extension.h>
|
||||
|
@ -73,7 +73,7 @@ namespace QtWaylandClient {
|
||||
QWaylandInputDevice::Keyboard::Keyboard(QWaylandInputDevice *p)
|
||||
: mParent(p)
|
||||
, mFocus(0)
|
||||
#ifndef QT_NO_WAYLAND_XKB
|
||||
#if QT_CONFIG(xkbcommon_evdev)
|
||||
, mXkbContext(0)
|
||||
, mXkbMap(0)
|
||||
, mXkbState(0)
|
||||
@ -83,7 +83,7 @@ QWaylandInputDevice::Keyboard::Keyboard(QWaylandInputDevice *p)
|
||||
connect(&mRepeatTimer, SIGNAL(timeout()), this, SLOT(repeatKey()));
|
||||
}
|
||||
|
||||
#ifndef QT_NO_WAYLAND_XKB
|
||||
#if QT_CONFIG(xkbcommon_evdev)
|
||||
bool QWaylandInputDevice::Keyboard::createDefaultKeyMap()
|
||||
{
|
||||
if (mXkbContext && mXkbMap && mXkbState) {
|
||||
@ -125,7 +125,7 @@ void QWaylandInputDevice::Keyboard::releaseKeyMap()
|
||||
|
||||
QWaylandInputDevice::Keyboard::~Keyboard()
|
||||
{
|
||||
#ifndef QT_NO_WAYLAND_XKB
|
||||
#if QT_CONFIG(xkbcommon_evdev)
|
||||
releaseKeyMap();
|
||||
#endif
|
||||
if (mFocus)
|
||||
@ -147,6 +147,8 @@ QWaylandInputDevice::Pointer::Pointer(QWaylandInputDevice *p)
|
||||
, mEnterSerial(0)
|
||||
, mCursorSerial(0)
|
||||
, mButtons(0)
|
||||
, mCursorBuffer(nullptr)
|
||||
, mCursorShape(Qt::BitmapCursor)
|
||||
{
|
||||
}
|
||||
|
||||
@ -188,9 +190,11 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version,
|
||||
, mSerial(0)
|
||||
, mTouchDevice(0)
|
||||
{
|
||||
#if QT_CONFIG(draganddrop)
|
||||
if (mQDisplay->dndSelectionHandler()) {
|
||||
mDataDevice = mQDisplay->dndSelectionHandler()->getDataDevice(this);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (mQDisplay->textInputManager()) {
|
||||
mTextInput = new QWaylandTextInput(mQDisplay, mQDisplay->textInputManager()->get_text_input(wl_seat()));
|
||||
@ -268,6 +272,14 @@ void QWaylandInputDevice::handleWindowDestroyed(QWaylandWindow *window)
|
||||
mTouch->mFocus = 0;
|
||||
}
|
||||
|
||||
void QWaylandInputDevice::handleEndDrag()
|
||||
{
|
||||
if (mTouch)
|
||||
mTouch->releasePoints();
|
||||
if (mPointer)
|
||||
mPointer->releaseButtons();
|
||||
}
|
||||
|
||||
void QWaylandInputDevice::setDataDevice(QWaylandDataDevice *device)
|
||||
{
|
||||
mDataDevice = device;
|
||||
@ -322,7 +334,7 @@ Qt::KeyboardModifiers QWaylandInputDevice::Keyboard::modifiers() const
|
||||
{
|
||||
Qt::KeyboardModifiers ret = Qt::NoModifier;
|
||||
|
||||
#ifndef QT_NO_WAYLAND_XKB
|
||||
#if QT_CONFIG(xkbcommon_evdev)
|
||||
if (!mXkbState)
|
||||
return ret;
|
||||
|
||||
@ -352,6 +364,10 @@ void QWaylandInputDevice::setCursor(Qt::CursorShape newShape, QWaylandScreen *sc
|
||||
|
||||
void QWaylandInputDevice::setCursor(const QCursor &cursor, QWaylandScreen *screen)
|
||||
{
|
||||
if (cursor.shape() != Qt::BitmapCursor && cursor.shape() == mPointer->mCursorShape)
|
||||
return;
|
||||
|
||||
mPointer->mCursorShape = cursor.shape();
|
||||
if (cursor.shape() == Qt::BitmapCursor) {
|
||||
setCursor(screen->waylandCursor()->cursorBitmapImage(&cursor), cursor.hotSpot());
|
||||
return;
|
||||
@ -369,8 +385,16 @@ void QWaylandInputDevice::setCursor(struct wl_buffer *buffer, struct wl_cursor_i
|
||||
void QWaylandInputDevice::setCursor(struct wl_buffer *buffer, const QPoint &hotSpot, const QSize &size)
|
||||
{
|
||||
if (mCaps & WL_SEAT_CAPABILITY_POINTER) {
|
||||
bool force = mPointer->mEnterSerial > mPointer->mCursorSerial;
|
||||
|
||||
if (!force && mPointer->mCursorBuffer == buffer)
|
||||
return;
|
||||
|
||||
mPixmapCursor.clear();
|
||||
mPointer->mCursorSerial = mPointer->mEnterSerial;
|
||||
|
||||
mPointer->mCursorBuffer = buffer;
|
||||
|
||||
/* Hide cursor */
|
||||
if (!buffer)
|
||||
{
|
||||
@ -532,6 +556,14 @@ void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time
|
||||
}
|
||||
}
|
||||
|
||||
void QWaylandInputDevice::Pointer::releaseButtons()
|
||||
{
|
||||
mButtons = Qt::NoButton;
|
||||
MotionEvent e(mParent->mTime, mSurfacePos, mGlobalPos, mButtons, mParent->modifiers());
|
||||
if (mFocus)
|
||||
mFocus->handleMouse(mParent, e);
|
||||
}
|
||||
|
||||
class WheelEvent : public QWaylandPointerEvent
|
||||
{
|
||||
public:
|
||||
@ -570,7 +602,7 @@ void QWaylandInputDevice::Pointer::pointer_axis(uint32_t time, uint32_t axis, in
|
||||
|
||||
void QWaylandInputDevice::Keyboard::keyboard_keymap(uint32_t format, int32_t fd, uint32_t size)
|
||||
{
|
||||
#ifndef QT_NO_WAYLAND_XKB
|
||||
#if QT_CONFIG(xkbcommon_evdev)
|
||||
if (format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) {
|
||||
close(fd);
|
||||
return;
|
||||
@ -670,7 +702,7 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time,
|
||||
if (isDown)
|
||||
mParent->mQDisplay->setLastInputDevice(mParent, serial, window);
|
||||
|
||||
#ifndef QT_NO_WAYLAND_XKB
|
||||
#if QT_CONFIG(xkbcommon_evdev)
|
||||
if (!createDefaultKeyMap()) {
|
||||
return;
|
||||
}
|
||||
@ -688,7 +720,7 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time,
|
||||
#endif
|
||||
|
||||
if (state == WL_KEYBOARD_KEY_STATE_PRESSED
|
||||
#ifndef QT_NO_WAYLAND_XKB
|
||||
#if QT_CONFIG(xkbcommon_evdev)
|
||||
&& xkb_keymap_key_repeats(mXkbMap, code)
|
||||
#endif
|
||||
) {
|
||||
@ -696,7 +728,7 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time,
|
||||
mRepeatCode = code;
|
||||
mRepeatTime = time;
|
||||
mRepeatText = text;
|
||||
#ifndef QT_NO_WAYLAND_XKB
|
||||
#if QT_CONFIG(xkbcommon_evdev)
|
||||
mRepeatSym = sym;
|
||||
#endif
|
||||
mRepeatTimer.setInterval(400);
|
||||
@ -710,7 +742,7 @@ void QWaylandInputDevice::Keyboard::repeatKey()
|
||||
{
|
||||
mRepeatTimer.setInterval(25);
|
||||
sendKey(mFocus->window(), mRepeatTime, QEvent::KeyRelease, mRepeatKey, modifiers(), mRepeatCode,
|
||||
#ifndef QT_NO_WAYLAND_XKB
|
||||
#if QT_CONFIG(xkbcommon_evdev)
|
||||
mRepeatSym, mNativeModifiers,
|
||||
#else
|
||||
0, 0,
|
||||
@ -718,7 +750,7 @@ void QWaylandInputDevice::Keyboard::repeatKey()
|
||||
mRepeatText, true);
|
||||
|
||||
sendKey(mFocus->window(), mRepeatTime, QEvent::KeyPress, mRepeatKey, modifiers(), mRepeatCode,
|
||||
#ifndef QT_NO_WAYLAND_XKB
|
||||
#if QT_CONFIG(xkbcommon_evdev)
|
||||
mRepeatSym, mNativeModifiers,
|
||||
#else
|
||||
0, 0,
|
||||
@ -733,7 +765,7 @@ void QWaylandInputDevice::Keyboard::keyboard_modifiers(uint32_t serial,
|
||||
uint32_t group)
|
||||
{
|
||||
Q_UNUSED(serial);
|
||||
#ifndef QT_NO_WAYLAND_XKB
|
||||
#if QT_CONFIG(xkbcommon_evdev)
|
||||
if (mXkbState)
|
||||
xkb_state_update_mask(mXkbState,
|
||||
mods_depressed, mods_latched, mods_locked,
|
||||
@ -845,6 +877,16 @@ bool QWaylandInputDevice::Touch::allTouchPointsReleased()
|
||||
return true;
|
||||
}
|
||||
|
||||
void QWaylandInputDevice::Touch::releasePoints()
|
||||
{
|
||||
Q_FOREACH (const QWindowSystemInterface::TouchPoint &previousPoint, mPrevTouchPoints) {
|
||||
QWindowSystemInterface::TouchPoint tp = previousPoint;
|
||||
tp.state = Qt::TouchPointReleased;
|
||||
mTouchPoints.append(tp);
|
||||
}
|
||||
touch_frame();
|
||||
}
|
||||
|
||||
void QWaylandInputDevice::Touch::touch_frame()
|
||||
{
|
||||
// Copy all points, that are in the previous but not in the current list, as stationary.
|
||||
|
@ -51,6 +51,7 @@
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtWaylandClient/private/qtwaylandclientglobal_p.h>
|
||||
#include <QtWaylandClient/private/qwaylandwindow_p.h>
|
||||
|
||||
#include <QSocketNotifier>
|
||||
@ -64,7 +65,7 @@
|
||||
|
||||
#include <QtWaylandClient/private/qwayland-wayland.h>
|
||||
|
||||
#ifndef QT_NO_WAYLAND_XKB
|
||||
#if QT_CONFIG(xkbcommon_evdev)
|
||||
#include <xkbcommon/xkbcommon.h>
|
||||
#include <xkbcommon/xkbcommon-keysyms.h>
|
||||
#endif
|
||||
@ -99,12 +100,12 @@ public:
|
||||
|
||||
struct ::wl_seat *wl_seat() { return QtWayland::wl_seat::object(); }
|
||||
|
||||
void setCursor(Qt::CursorShape cursor, QWaylandScreen *screen);
|
||||
void setCursor(const QCursor &cursor, QWaylandScreen *screen);
|
||||
void setCursor(struct wl_buffer *buffer, struct ::wl_cursor_image *image);
|
||||
void setCursor(struct wl_buffer *buffer, const QPoint &hotSpot, const QSize &size);
|
||||
void setCursor(const QSharedPointer<QWaylandBuffer> &buffer, const QPoint &hotSpot);
|
||||
void handleWindowDestroyed(QWaylandWindow *window);
|
||||
void handleEndDrag();
|
||||
|
||||
void setDataDevice(QWaylandDataDevice *device);
|
||||
QWaylandDataDevice *dataDevice() const;
|
||||
@ -128,6 +129,8 @@ public:
|
||||
virtual Touch *createTouch(QWaylandInputDevice *device);
|
||||
|
||||
private:
|
||||
void setCursor(Qt::CursorShape cursor, QWaylandScreen *screen);
|
||||
|
||||
QWaylandDisplay *mQDisplay;
|
||||
struct wl_display *mDisplay;
|
||||
|
||||
@ -192,7 +195,7 @@ public:
|
||||
|
||||
QWaylandInputDevice *mParent;
|
||||
QWaylandWindow *mFocus;
|
||||
#ifndef QT_NO_WAYLAND_XKB
|
||||
#if QT_CONFIG(xkbcommon_evdev)
|
||||
xkb_context *mXkbContext;
|
||||
xkb_keymap *mXkbMap;
|
||||
xkb_state *mXkbState;
|
||||
@ -203,7 +206,7 @@ public:
|
||||
uint32_t mRepeatCode;
|
||||
uint32_t mRepeatTime;
|
||||
QString mRepeatText;
|
||||
#ifndef QT_NO_WAYLAND_XKB
|
||||
#if QT_CONFIG(xkbcommon_evdev)
|
||||
xkb_keysym_t mRepeatSym;
|
||||
#endif
|
||||
QTimer mRepeatTimer;
|
||||
@ -214,7 +217,7 @@ private slots:
|
||||
void repeatKey();
|
||||
|
||||
private:
|
||||
#ifndef QT_NO_WAYLAND_XKB
|
||||
#if QT_CONFIG(xkbcommon_evdev)
|
||||
bool createDefaultKeyMap();
|
||||
void releaseKeyMap();
|
||||
#endif
|
||||
@ -239,6 +242,8 @@ public:
|
||||
uint32_t axis,
|
||||
wl_fixed_t value) Q_DECL_OVERRIDE;
|
||||
|
||||
void releaseButtons();
|
||||
|
||||
QWaylandInputDevice *mParent;
|
||||
QWaylandWindow *mFocus;
|
||||
uint32_t mEnterSerial;
|
||||
@ -246,6 +251,8 @@ public:
|
||||
QPointF mSurfacePos;
|
||||
QPointF mGlobalPos;
|
||||
Qt::MouseButtons mButtons;
|
||||
wl_buffer *mCursorBuffer;
|
||||
Qt::CursorShape mCursorShape;
|
||||
};
|
||||
|
||||
class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice::Touch : public QtWayland::wl_touch
|
||||
@ -271,6 +278,7 @@ public:
|
||||
void touch_cancel() Q_DECL_OVERRIDE;
|
||||
|
||||
bool allTouchPointsReleased();
|
||||
void releasePoints();
|
||||
|
||||
QWaylandInputDevice *mParent;
|
||||
QWaylandWindow *mFocus;
|
||||
|
@ -96,7 +96,7 @@ public:
|
||||
const QByteArray desktopEnvironment = QGuiApplicationPrivate::platformIntegration()->services()->desktopEnvironment();
|
||||
|
||||
if (desktopEnvironment == QByteArrayLiteral("KDE")) {
|
||||
#ifndef QT_NO_SETTINGS
|
||||
#if QT_CONFIG(settings)
|
||||
result.push_back(QStringLiteral("kde"));
|
||||
#endif
|
||||
} else if (!desktopEnvironment.isEmpty() &&
|
||||
@ -122,7 +122,7 @@ QWaylandIntegration::QWaylandIntegration()
|
||||
, mInputDeviceIntegration(Q_NULLPTR)
|
||||
, mFontDb(new QGenericUnixFontDatabase())
|
||||
, mNativeInterface(new QWaylandNativeInterface(this))
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
#if QT_CONFIG(accessibility)
|
||||
, mAccessibility(new QPlatformAccessibility())
|
||||
#endif
|
||||
, mClientBufferIntegrationInitialized(false)
|
||||
@ -131,9 +131,10 @@ QWaylandIntegration::QWaylandIntegration()
|
||||
{
|
||||
initializeInputDeviceIntegration();
|
||||
mDisplay.reset(new QWaylandDisplay(this));
|
||||
#if QT_CONFIG(draganddrop)
|
||||
mClipboard.reset(new QWaylandClipboard(mDisplay.data()));
|
||||
mDrag.reset(new QWaylandDrag(mDisplay.data()));
|
||||
|
||||
#endif
|
||||
QString icStr = QPlatformInputContextFactory::requested();
|
||||
if (!icStr.isNull()) {
|
||||
mInputContext.reset(QPlatformInputContextFactory::create(icStr));
|
||||
@ -187,14 +188,14 @@ QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWindow *window) cons
|
||||
return new QWaylandShmWindow(window);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_OPENGL
|
||||
#if QT_CONFIG(opengl)
|
||||
QPlatformOpenGLContext *QWaylandIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const
|
||||
{
|
||||
if (mDisplay->clientBufferIntegration())
|
||||
return mDisplay->clientBufferIntegration()->createPlatformOpenGLContext(context->format(), context->shareHandle());
|
||||
return 0;
|
||||
}
|
||||
#endif // QT_NO_OPENGL
|
||||
#endif // opengl
|
||||
|
||||
QPlatformBackingStore *QWaylandIntegration::createPlatformBackingStore(QWindow *window) const
|
||||
{
|
||||
@ -222,6 +223,7 @@ QPlatformFontDatabase *QWaylandIntegration::fontDatabase() const
|
||||
return mFontDb.data();
|
||||
}
|
||||
|
||||
#if QT_CONFIG(draganddrop)
|
||||
QPlatformClipboard *QWaylandIntegration::clipboard() const
|
||||
{
|
||||
return mClipboard.data();
|
||||
@ -231,6 +233,7 @@ QPlatformDrag *QWaylandIntegration::drag() const
|
||||
{
|
||||
return mDrag.data();
|
||||
}
|
||||
#endif // draganddrop
|
||||
|
||||
QPlatformInputContext *QWaylandIntegration::inputContext() const
|
||||
{
|
||||
@ -252,7 +255,7 @@ QVariant QWaylandIntegration::styleHint(StyleHint hint) const
|
||||
return QPlatformIntegration::styleHint(hint);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
#if QT_CONFIG(accessibility)
|
||||
QPlatformAccessibility *QWaylandIntegration::accessibility() const
|
||||
{
|
||||
return mAccessibility.data();
|
||||
|
@ -51,9 +51,8 @@
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
#include <qpa/qplatformintegration.h>
|
||||
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtCore/QScopedPointer>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -76,7 +75,7 @@ public:
|
||||
|
||||
bool hasCapability(QPlatformIntegration::Capability cap) const Q_DECL_OVERRIDE;
|
||||
QPlatformWindow *createPlatformWindow(QWindow *window) const Q_DECL_OVERRIDE;
|
||||
#ifndef QT_NO_OPENGL
|
||||
#if QT_CONFIG(opengl)
|
||||
QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const Q_DECL_OVERRIDE;
|
||||
#endif
|
||||
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE;
|
||||
@ -87,16 +86,15 @@ public:
|
||||
QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE;
|
||||
|
||||
QPlatformNativeInterface *nativeInterface() const Q_DECL_OVERRIDE;
|
||||
|
||||
#if QT_CONFIG(draganddrop)
|
||||
QPlatformClipboard *clipboard() const Q_DECL_OVERRIDE;
|
||||
|
||||
QPlatformDrag *drag() const Q_DECL_OVERRIDE;
|
||||
|
||||
#endif
|
||||
QPlatformInputContext *inputContext() const Q_DECL_OVERRIDE;
|
||||
|
||||
QVariant styleHint(StyleHint hint) const Q_DECL_OVERRIDE;
|
||||
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
#if QT_CONFIG(accessibility)
|
||||
QPlatformAccessibility *accessibility() const Q_DECL_OVERRIDE;
|
||||
#endif
|
||||
|
||||
@ -114,6 +112,11 @@ public:
|
||||
virtual QWaylandServerBufferIntegration *serverBufferIntegration() const;
|
||||
virtual QWaylandShellIntegration *shellIntegration() const;
|
||||
|
||||
private:
|
||||
// NOTE: mDisplay *must* be destructed after mDrag and mClientBufferIntegration.
|
||||
// Do not move this definition into the private section at the bottom.
|
||||
QScopedPointer<QWaylandDisplay> mDisplay;
|
||||
|
||||
protected:
|
||||
QScopedPointer<QWaylandClientBufferIntegration> mClientBufferIntegration;
|
||||
QScopedPointer<QWaylandServerBufferIntegration> mServerBufferIntegration;
|
||||
@ -128,12 +131,13 @@ private:
|
||||
QWaylandShellIntegration *createShellIntegration(const QString& interfaceName);
|
||||
|
||||
QScopedPointer<QPlatformFontDatabase> mFontDb;
|
||||
#if QT_CONFIG(draganddrop)
|
||||
QScopedPointer<QPlatformClipboard> mClipboard;
|
||||
QScopedPointer<QPlatformDrag> mDrag;
|
||||
QScopedPointer<QWaylandDisplay> mDisplay;
|
||||
#endif
|
||||
QScopedPointer<QPlatformNativeInterface> mNativeInterface;
|
||||
QScopedPointer<QPlatformInputContext> mInputContext;
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
#if QT_CONFIG(accessibility)
|
||||
QScopedPointer<QPlatformAccessibility> mAccessibility;
|
||||
#endif
|
||||
bool mClientBufferIntegrationInitialized;
|
||||
|
@ -116,9 +116,10 @@ void *QWaylandNativeInterface::nativeResourceForScreen(const QByteArray &resourc
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#if QT_CONFIG(opengl)
|
||||
void *QWaylandNativeInterface::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context)
|
||||
{
|
||||
#ifdef QT_WAYLAND_GL_SUPPORT
|
||||
#if QT_CONFIG(opengl)
|
||||
QByteArray lowerCaseResource = resource.toLower();
|
||||
|
||||
if (lowerCaseResource == "eglconfig" && m_integration->clientBufferIntegration())
|
||||
@ -133,6 +134,7 @@ void *QWaylandNativeInterface::nativeResourceForContext(const QByteArray &resour
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
#endif // opengl
|
||||
|
||||
QVariantMap QWaylandNativeInterface::windowProperties(QPlatformWindow *window) const
|
||||
{
|
||||
|
@ -54,7 +54,7 @@
|
||||
#include <QVariantMap>
|
||||
#include <qpa/qplatformnativeinterface.h>
|
||||
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -72,8 +72,9 @@ public:
|
||||
QWindow *window) Q_DECL_OVERRIDE;
|
||||
void *nativeResourceForScreen(const QByteArray &resourceString,
|
||||
QScreen *screen) Q_DECL_OVERRIDE;
|
||||
#if QT_CONFIG(opengl)
|
||||
void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) Q_DECL_OVERRIDE;
|
||||
|
||||
#endif
|
||||
QVariantMap windowProperties(QPlatformWindow *window) const Q_DECL_OVERRIDE;
|
||||
QVariant windowProperty(QPlatformWindow *window, const QString &name) const Q_DECL_OVERRIDE;
|
||||
QVariant windowProperty(QPlatformWindow *window, const QString &name, const QVariant &defaultValue) const Q_DECL_OVERRIDE;
|
||||
|
@ -53,7 +53,7 @@
|
||||
|
||||
#include <qpa/qwindowsysteminterface.h>
|
||||
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
#include <QtWaylandClient/private/qwayland-qtkey-extension.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
@ -52,7 +52,7 @@
|
||||
//
|
||||
|
||||
#include <qpa/qplatformscreen.h>
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
|
||||
#include <QtWaylandClient/private/qwayland-wayland.h>
|
||||
|
||||
|
@ -57,7 +57,7 @@
|
||||
#include <wayland-client.h>
|
||||
|
||||
#include <QtWaylandClient/private/qwayland-wayland.h>
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -91,19 +91,17 @@ public:
|
||||
virtual void setContentOrientationMask(Qt::ScreenOrientations orientation) { Q_UNUSED(orientation) }
|
||||
|
||||
virtual void sendProperty(const QString &name, const QVariant &value);
|
||||
virtual bool shellManagesActiveState() const { return false; }
|
||||
|
||||
inline QWaylandWindow *window() { return m_window; }
|
||||
|
||||
virtual void setType(Qt::WindowType type, QWaylandWindow *transientParent) = 0;
|
||||
|
||||
protected:
|
||||
virtual void setMaximized() {}
|
||||
virtual void setFullscreen() {}
|
||||
virtual void setNormal() {}
|
||||
virtual void setMinimized() {}
|
||||
|
||||
virtual void setTopLevel() {}
|
||||
virtual void updateTransientParent(QWindow * /*parent*/) {}
|
||||
|
||||
private:
|
||||
QWaylandWindow *m_window;
|
||||
friend class QWaylandWindow;
|
||||
|
@ -54,7 +54,7 @@
|
||||
#include <QVector>
|
||||
#include <QImage>
|
||||
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
#include <QtWaylandClient/private/qwayland-wayland.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
@ -185,10 +185,6 @@ void QWaylandShmBackingStore::endPaint()
|
||||
waylandWindow()->setCanResize(true);
|
||||
}
|
||||
|
||||
void QWaylandShmBackingStore::hidden()
|
||||
{
|
||||
}
|
||||
|
||||
void QWaylandShmBackingStore::ensureSize()
|
||||
{
|
||||
waylandWindow()->setBackingStore(this);
|
||||
@ -215,13 +211,7 @@ void QWaylandShmBackingStore::flush(QWindow *window, const QRegion ®ion, cons
|
||||
|
||||
QMargins margins = windowDecorationMargins();
|
||||
|
||||
waylandWindow()->attachOffset(mFrontBuffer);
|
||||
mFrontBuffer->setBusy();
|
||||
|
||||
QVector<QRect> rects = region.rects();
|
||||
foreach (const QRect &rect, rects)
|
||||
waylandWindow()->damage(rect.translated(margins.left(), margins.top()));
|
||||
waylandWindow()->commit();
|
||||
waylandWindow()->commit(mFrontBuffer, region.translated(margins.left(), margins.top()));
|
||||
}
|
||||
|
||||
void QWaylandShmBackingStore::resize(const QSize &size, const QRegion &)
|
||||
@ -358,7 +348,7 @@ QWaylandWindow *QWaylandShmBackingStore::waylandWindow() const
|
||||
return static_cast<QWaylandWindow *>(window()->handle());
|
||||
}
|
||||
|
||||
#ifndef QT_NO_OPENGL
|
||||
#if QT_CONFIG(opengl)
|
||||
QImage QWaylandShmBackingStore::toImage() const
|
||||
{
|
||||
// Invoked from QPlatformBackingStore::composeAndFlush() that is called
|
||||
@ -367,7 +357,7 @@ QImage QWaylandShmBackingStore::toImage() const
|
||||
|
||||
return *contentSurface();
|
||||
}
|
||||
#endif // QT_NO_OPENGL
|
||||
#endif // opengl
|
||||
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,6 @@ public:
|
||||
void resize(const QSize &size);
|
||||
void beginPaint(const QRegion &) Q_DECL_OVERRIDE;
|
||||
void endPaint() Q_DECL_OVERRIDE;
|
||||
void hidden();
|
||||
|
||||
QWaylandAbstractDecoration *windowDecoration() const;
|
||||
|
||||
@ -108,7 +107,7 @@ public:
|
||||
QWaylandWindow *waylandWindow() const;
|
||||
void iterateBuffer();
|
||||
|
||||
#ifndef QT_NO_OPENGL
|
||||
#if QT_CONFIG(opengl)
|
||||
QImage toImage() const Q_DECL_OVERRIDE;
|
||||
#endif
|
||||
|
||||
|
@ -56,7 +56,7 @@
|
||||
#include <QtCore/qglobal.h>
|
||||
#include <QtCore/qmutex.h>
|
||||
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
#include <QtWaylandClient/private/qwayland-wayland.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
@ -54,7 +54,7 @@
|
||||
#include <qpa/qwindowsysteminterface.h>
|
||||
|
||||
#include <QtWaylandClient/private/qwayland-touch-extension.h>
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
@ -81,7 +81,6 @@ QWaylandWindow::QWaylandWindow(QWindow *window)
|
||||
, mWindowDecoration(0)
|
||||
, mMouseEventsInContentArea(false)
|
||||
, mMousePressedInContentArea(Qt::NoButton)
|
||||
, m_cursor(Qt::ArrowCursor)
|
||||
, mWaitingForFrameSync(false)
|
||||
, mFrameCallback(nullptr)
|
||||
, mRequestResizeSent(false)
|
||||
@ -96,8 +95,6 @@ QWaylandWindow::QWaylandWindow(QWindow *window)
|
||||
{
|
||||
static WId id = 1;
|
||||
mWindowId = id++;
|
||||
if (window->type() != Qt::Desktop)
|
||||
initWindow();
|
||||
}
|
||||
|
||||
QWaylandWindow::~QWaylandWindow()
|
||||
@ -126,20 +123,30 @@ QWaylandWindow::~QWaylandWindow()
|
||||
|
||||
void QWaylandWindow::initWindow()
|
||||
{
|
||||
init(mDisplay->createSurface(static_cast<QtWayland::wl_surface *>(this)));
|
||||
if (window()->type() == Qt::Desktop)
|
||||
return;
|
||||
|
||||
if (!isInitialized())
|
||||
init(mDisplay->createSurface(static_cast<QtWayland::wl_surface *>(this)));
|
||||
|
||||
if (shouldCreateSubSurface()) {
|
||||
Q_ASSERT(!mSubSurfaceWindow);
|
||||
|
||||
QWaylandWindow *p = static_cast<QWaylandWindow *>(QPlatformWindow::parent());
|
||||
if (::wl_subsurface *ss = mDisplay->createSubSurface(this, p)) {
|
||||
mSubSurfaceWindow = new QWaylandSubSurface(this, p, ss);
|
||||
}
|
||||
} else if (shouldCreateShellSurface()) {
|
||||
mShellSurface = mDisplay->createShellSurface(this);
|
||||
}
|
||||
Q_ASSERT(!mShellSurface);
|
||||
|
||||
mShellSurface = mDisplay->createShellSurface(this);
|
||||
if (!mShellSurface)
|
||||
qFatal("Could not create a shell surface object.");
|
||||
|
||||
mShellSurface->setType(window()->type(), transientParent());
|
||||
|
||||
if (mShellSurface) {
|
||||
// Set initial surface title
|
||||
mShellSurface->setTitle(window()->title());
|
||||
setWindowTitle(window()->title());
|
||||
|
||||
// The appId is the desktop entry identifier that should follow the
|
||||
// reverse DNS convention (see http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s02.html).
|
||||
@ -171,17 +178,6 @@ void QWaylandWindow::initWindow()
|
||||
}
|
||||
}
|
||||
|
||||
if (mShellSurface) {
|
||||
if (window()->transientParent()) {
|
||||
if (window()->type() != Qt::Popup) {
|
||||
mShellSurface->updateTransientParent(window()->transientParent());
|
||||
}
|
||||
} else {
|
||||
if (window()->type() != Qt::ToolTip)
|
||||
mShellSurface->setTopLevel();
|
||||
}
|
||||
}
|
||||
|
||||
// Enable high-dpi rendering. Scale() returns the screen scale factor and will
|
||||
// typically be integer 1 (normal-dpi) or 2 (high-dpi). Call set_buffer_scale()
|
||||
// to inform the compositor that high-resolution buffers will be provided.
|
||||
@ -244,6 +240,9 @@ WId QWaylandWindow::winId() const
|
||||
|
||||
void QWaylandWindow::setParent(const QPlatformWindow *parent)
|
||||
{
|
||||
if (!window()->isVisible())
|
||||
return;
|
||||
|
||||
QWaylandWindow *oldparent = mSubSurfaceWindow ? mSubSurfaceWindow->parent() : 0;
|
||||
if (oldparent == parent)
|
||||
return;
|
||||
@ -261,7 +260,8 @@ void QWaylandWindow::setParent(const QPlatformWindow *parent)
|
||||
void QWaylandWindow::setWindowTitle(const QString &title)
|
||||
{
|
||||
if (mShellSurface) {
|
||||
mShellSurface->setTitle(title);
|
||||
const QString separator = QString::fromUtf8(" \xe2\x80\x94 "); // unicode character U+2014, EM DASH
|
||||
mShellSurface->setTitle(formatWindowTitle(title, separator));
|
||||
}
|
||||
|
||||
if (mWindowDecoration && window()->isVisible())
|
||||
@ -285,8 +285,8 @@ void QWaylandWindow::setGeometry_helper(const QRect &rect)
|
||||
if (mSubSurfaceWindow) {
|
||||
QMargins m = QPlatformWindow::parent()->frameMargins();
|
||||
mSubSurfaceWindow->set_position(rect.x() + m.left(), rect.y() + m.top());
|
||||
} else if (shellSurface() && window()->transientParent() && window()->type() != Qt::Popup)
|
||||
shellSurface()->updateTransientParent(window()->transientParent());
|
||||
mSubSurfaceWindow->parent()->window()->requestUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
void QWaylandWindow::setGeometry(const QRect &rect)
|
||||
@ -311,20 +311,8 @@ void QWaylandWindow::setGeometry(const QRect &rect)
|
||||
void QWaylandWindow::setVisible(bool visible)
|
||||
{
|
||||
if (visible) {
|
||||
if (mShellSurface) {
|
||||
if (window()->type() == Qt::Popup) {
|
||||
QWaylandWindow *parent = transientParent();
|
||||
if (parent) {
|
||||
QWaylandWlShellSurface *wlshellSurface = qobject_cast<QWaylandWlShellSurface*>(mShellSurface);
|
||||
if (wlshellSurface)
|
||||
wlshellSurface->setPopup(parent, mDisplay->lastInputDevice(), mDisplay->lastInputSerial());
|
||||
}
|
||||
} else if (window()->type() == Qt::ToolTip) {
|
||||
if (QWaylandWindow *parent = transientParent()) {
|
||||
mShellSurface->updateTransientParent(parent->window());
|
||||
}
|
||||
}
|
||||
}
|
||||
initWindow();
|
||||
mDisplay->flushRequests();
|
||||
|
||||
setGeometry(window()->geometry());
|
||||
// Don't flush the events here, or else the newly visible window may start drawing, but since
|
||||
@ -336,13 +324,8 @@ void QWaylandWindow::setVisible(bool visible)
|
||||
// case 'this' will be deleted. When that happens, we must abort right away.
|
||||
QPointer<QWaylandWindow> deleteGuard(this);
|
||||
QWindowSystemInterface::flushWindowSystemEvents();
|
||||
if (!deleteGuard.isNull()) {
|
||||
attach(static_cast<QWaylandBuffer *>(0), 0, 0);
|
||||
commit();
|
||||
if (mBackingStore) {
|
||||
mBackingStore->hidden();
|
||||
}
|
||||
}
|
||||
if (!deleteGuard.isNull())
|
||||
reset();
|
||||
}
|
||||
}
|
||||
|
||||
@ -375,7 +358,7 @@ void QWaylandWindow::setMask(const QRegion &mask)
|
||||
wl_region_destroy(region);
|
||||
}
|
||||
|
||||
commit();
|
||||
wl_surface::commit();
|
||||
}
|
||||
|
||||
void QWaylandWindow::configure(uint32_t edges, int32_t width, int32_t height)
|
||||
@ -462,6 +445,7 @@ void QWaylandWindow::attach(QWaylandBuffer *buffer, int x, int y)
|
||||
wl_callback_add_listener(callback, &QWaylandWindow::callbackListener, this);
|
||||
mFrameCallback = callback;
|
||||
mWaitingForFrameSync = true;
|
||||
buffer->setBusy();
|
||||
|
||||
attach(buffer->buffer(), x, y);
|
||||
} else {
|
||||
@ -480,6 +464,18 @@ void QWaylandWindow::damage(const QRect &rect)
|
||||
damage(rect.x(), rect.y(), rect.width(), rect.height());
|
||||
}
|
||||
|
||||
void QWaylandWindow::commit(QWaylandBuffer *buffer, const QRegion &damage)
|
||||
{
|
||||
if (!isInitialized())
|
||||
return;
|
||||
|
||||
attachOffset(buffer);
|
||||
const QVector<QRect> rects = damage.rects();
|
||||
for (const QRect &rect: rects)
|
||||
wl_surface::damage(rect.x(), rect.y(), rect.width(), rect.height());
|
||||
wl_surface::commit();
|
||||
}
|
||||
|
||||
const wl_callback_listener QWaylandWindow::callbackListener = {
|
||||
QWaylandWindow::frameCallback
|
||||
};
|
||||
@ -528,11 +524,6 @@ QWaylandSubSurface *QWaylandWindow::subSurfaceWindow() const
|
||||
return mSubSurfaceWindow;
|
||||
}
|
||||
|
||||
bool QWaylandWindow::shellManagesActiveState() const
|
||||
{
|
||||
return mShellSurface && mShellSurface->shellManagesActiveState();
|
||||
}
|
||||
|
||||
void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation)
|
||||
{
|
||||
if (mDisplay->compositorVersion() < 2)
|
||||
@ -561,7 +552,7 @@ void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orient
|
||||
}
|
||||
set_buffer_transform(transform);
|
||||
// set_buffer_transform is double buffered, we need to commit.
|
||||
commit();
|
||||
wl_surface::commit();
|
||||
}
|
||||
|
||||
void QWaylandWindow::setOrientationMask(Qt::ScreenOrientations mask)
|
||||
@ -687,15 +678,13 @@ static QWindow *topLevelWindow(QWindow *window)
|
||||
|
||||
QWaylandWindow *QWaylandWindow::transientParent() const
|
||||
{
|
||||
if (window()->transientParent()) {
|
||||
// Take the top level window here, since the transient parent may be a QWidgetWindow
|
||||
// or some other window without a shell surface, which is then not able to get mouse
|
||||
// events.
|
||||
return static_cast<QWaylandWindow *>(topLevelWindow(window()->transientParent())->handle());
|
||||
}
|
||||
// Try with the current focus window. It should be the right one and anyway
|
||||
// better than having no parent at all.
|
||||
return mDisplay->lastInputWindow();
|
||||
// Take the top level window here, since the transient parent may be a QWidgetWindow
|
||||
// or some other window without a shell surface, which is then not able to get mouse
|
||||
// events.
|
||||
if (auto transientParent = window()->transientParent())
|
||||
return static_cast<QWaylandWindow *>(topLevelWindow(transientParent)->handle());
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e)
|
||||
@ -790,10 +779,7 @@ void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDe
|
||||
|
||||
void QWaylandWindow::setMouseCursor(QWaylandInputDevice *device, const QCursor &cursor)
|
||||
{
|
||||
if (device->serial() >= device->cursorSerial()) {
|
||||
device->setCursor(cursor, mScreen);
|
||||
m_cursor = cursor;
|
||||
}
|
||||
device->setCursor(cursor, mScreen);
|
||||
}
|
||||
|
||||
void QWaylandWindow::restoreMouseCursor(QWaylandInputDevice *device)
|
||||
@ -809,10 +795,12 @@ void QWaylandWindow::requestActivateWindow()
|
||||
|
||||
void QWaylandWindow::unfocus()
|
||||
{
|
||||
#if QT_CONFIG(draganddrop)
|
||||
QWaylandInputDevice *inputDevice = mDisplay->currentInputDevice();
|
||||
if (inputDevice && inputDevice->dataDevice()) {
|
||||
inputDevice->dataDevice()->invalidateSelectionOffer();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool QWaylandWindow::isExposed() const
|
||||
|
@ -60,7 +60,7 @@
|
||||
#include <qpa/qplatformwindow.h>
|
||||
|
||||
#include <QtWaylandClient/private/qwayland-wayland.h>
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
|
||||
struct wl_egl_window;
|
||||
|
||||
@ -132,6 +132,8 @@ public:
|
||||
using QtWayland::wl_surface::damage;
|
||||
void damage(const QRect &rect);
|
||||
|
||||
void commit(QWaylandBuffer *buffer, const QRegion &damage);
|
||||
|
||||
void waitForFrameSync();
|
||||
|
||||
QMargins frameMargins() const Q_DECL_OVERRIDE;
|
||||
@ -143,8 +145,6 @@ public:
|
||||
QWaylandSubSurface *subSurfaceWindow() const;
|
||||
QWaylandScreen *screen() const { return mScreen; }
|
||||
|
||||
bool shellManagesActiveState() const;
|
||||
|
||||
void handleContentOrientationChange(Qt::ScreenOrientation orientation) Q_DECL_OVERRIDE;
|
||||
void setOrientationMask(Qt::ScreenOrientations mask);
|
||||
|
||||
@ -217,7 +217,6 @@ protected:
|
||||
QWaylandAbstractDecoration *mWindowDecoration;
|
||||
bool mMouseEventsInContentArea;
|
||||
Qt::MouseButtons mMousePressedInContentArea;
|
||||
QCursor m_cursor;
|
||||
|
||||
WId mWindowId;
|
||||
bool mWaitingForFrameSync;
|
||||
|
@ -58,7 +58,7 @@
|
||||
#include <QtServiceSupport/private/qgenericunixservices_p.h>
|
||||
|
||||
#include <QtWaylandClient/private/qwayland-qt-windowmanager.h>
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
@ -52,6 +52,12 @@ QWaylandWlShellIntegration::QWaylandWlShellIntegration(QWaylandDisplay *display)
|
||||
}
|
||||
}
|
||||
|
||||
bool QWaylandWlShellIntegration::initialize(QWaylandDisplay *display)
|
||||
{
|
||||
QWaylandShellIntegration::initialize(display);
|
||||
return m_wlShell != nullptr;
|
||||
};
|
||||
|
||||
QWaylandShellSurface *QWaylandWlShellIntegration::createShellSurface(QWaylandWindow *window)
|
||||
{
|
||||
return new QWaylandWlShellSurface(m_wlShell->get_shell_surface(window->object()), window);
|
||||
|
@ -58,7 +58,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandWlShellIntegration : public QWaylandShellI
|
||||
{
|
||||
public:
|
||||
QWaylandWlShellIntegration(QWaylandDisplay* display);
|
||||
bool initialize(QWaylandDisplay *) Q_DECL_OVERRIDE { return m_wlShell != Q_NULLPTR; }
|
||||
bool initialize(QWaylandDisplay *) Q_DECL_OVERRIDE;
|
||||
QWaylandShellSurface *createShellSurface(QWaylandWindow *window) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
|
@ -215,6 +215,16 @@ void QWaylandWlShellSurface::setPopup(QWaylandWindow *parent, QWaylandInputDevic
|
||||
transientPos.x(), transientPos.y(), 0);
|
||||
}
|
||||
|
||||
void QWaylandWlShellSurface::setType(Qt::WindowType type, QWaylandWindow *transientParent)
|
||||
{
|
||||
if (type == Qt::Popup && transientParent)
|
||||
setPopup(transientParent, m_window->display()->lastInputDevice(), m_window->display()->lastInputSerial());
|
||||
else if (transientParent)
|
||||
updateTransientParent(transientParent->window());
|
||||
else
|
||||
setTopLevel();
|
||||
}
|
||||
|
||||
void QWaylandWlShellSurface::shell_surface_ping(uint32_t serial)
|
||||
{
|
||||
pong(serial);
|
||||
|
@ -55,7 +55,7 @@
|
||||
|
||||
#include <wayland-client.h>
|
||||
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
#include <QtWaylandClient/private/qwayland-wayland.h>
|
||||
#include <QtWaylandClient/private/qwaylandshellsurface_p.h>
|
||||
|
||||
@ -92,14 +92,16 @@ public:
|
||||
void setWindowFlags(Qt::WindowFlags flags) Q_DECL_OVERRIDE;
|
||||
void sendProperty(const QString &name, const QVariant &value) Q_DECL_OVERRIDE;
|
||||
|
||||
void setType(Qt::WindowType type, QWaylandWindow *transientParent) override;
|
||||
|
||||
private:
|
||||
void setMaximized() Q_DECL_OVERRIDE;
|
||||
void setFullscreen() Q_DECL_OVERRIDE;
|
||||
void setNormal() Q_DECL_OVERRIDE;
|
||||
void setMinimized() Q_DECL_OVERRIDE;
|
||||
|
||||
void setTopLevel() Q_DECL_OVERRIDE;
|
||||
void updateTransientParent(QWindow *parent) Q_DECL_OVERRIDE;
|
||||
void setTopLevel();
|
||||
void updateTransientParent(QWindow *parent);
|
||||
void setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial);
|
||||
|
||||
QWaylandWindow *m_window;
|
||||
|
@ -45,6 +45,7 @@ QWaylandXdgPopup::QWaylandXdgPopup(struct ::xdg_popup *popup, QWaylandWindow *wi
|
||||
: QWaylandShellSurface(window)
|
||||
, QtWayland::xdg_popup(popup)
|
||||
, m_extendedWindow(nullptr)
|
||||
, m_window(window)
|
||||
{
|
||||
if (window->display()->windowExtension())
|
||||
m_extendedWindow = new QWaylandExtendedSurface(window);
|
||||
@ -56,6 +57,17 @@ QWaylandXdgPopup::~QWaylandXdgPopup()
|
||||
delete m_extendedWindow;
|
||||
}
|
||||
|
||||
void QWaylandXdgPopup::setType(Qt::WindowType type, QWaylandWindow *transientParent)
|
||||
{
|
||||
Q_UNUSED(type);
|
||||
Q_UNUSED(transientParent);
|
||||
}
|
||||
|
||||
void QWaylandXdgPopup::xdg_popup_popup_done()
|
||||
{
|
||||
m_window->window()->close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
@ -47,7 +47,7 @@
|
||||
|
||||
#include <wayland-client.h>
|
||||
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
#include <QtWaylandClient/private/qwayland-xdg-shell.h>
|
||||
#include <QtWaylandClient/private/qwaylandshellsurface_p.h>
|
||||
|
||||
@ -68,8 +68,14 @@ public:
|
||||
QWaylandXdgPopup(struct ::xdg_popup *popup, QWaylandWindow *window);
|
||||
virtual ~QWaylandXdgPopup();
|
||||
|
||||
void setType(Qt::WindowType type, QWaylandWindow *transientParent) override;
|
||||
|
||||
protected:
|
||||
void xdg_popup_popup_done() override;
|
||||
|
||||
private:
|
||||
QWaylandExtendedSurface *m_extendedWindow;
|
||||
QWaylandWindow *m_window;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -54,11 +54,13 @@ namespace QtWaylandClient {
|
||||
|
||||
QWaylandXdgShell::QWaylandXdgShell(struct ::xdg_shell *shell)
|
||||
: QtWayland::xdg_shell(shell)
|
||||
, m_popupSerial(0)
|
||||
{
|
||||
}
|
||||
|
||||
QWaylandXdgShell::QWaylandXdgShell(struct ::wl_registry *registry, uint32_t id)
|
||||
: QtWayland::xdg_shell(registry, id, 1)
|
||||
, m_popupSerial(0)
|
||||
{
|
||||
use_unstable_version(QtWayland::xdg_shell::version_current);
|
||||
}
|
||||
@ -75,15 +77,26 @@ QWaylandXdgSurface *QWaylandXdgShell::createXdgSurface(QWaylandWindow *window)
|
||||
|
||||
QWaylandXdgPopup *QWaylandXdgShell::createXdgPopup(QWaylandWindow *window)
|
||||
{
|
||||
QWaylandWindow *parentWindow = window->transientParent();
|
||||
QWaylandWindow *parentWindow = m_popups.empty() ? window->transientParent() : m_popups.last();
|
||||
::wl_surface *parentSurface = parentWindow->object();
|
||||
|
||||
QWaylandInputDevice *inputDevice = window->display()->lastInputDevice();
|
||||
if (m_popupSerial == 0)
|
||||
m_popupSerial = inputDevice->serial();
|
||||
::wl_seat *seat = inputDevice->wl_seat();
|
||||
uint serial = inputDevice->serial();
|
||||
QPoint position = window->geometry().topLeft();
|
||||
|
||||
QPoint position = window->geometry().topLeft() - parentWindow->geometry().topLeft();
|
||||
int x = position.x() + parentWindow->frameMargins().left();
|
||||
int y = position.y() + parentWindow->frameMargins().top();
|
||||
return new QWaylandXdgPopup(get_xdg_popup(window->object(), parentSurface, seat, serial, x, y), window);
|
||||
|
||||
auto popup = new QWaylandXdgPopup(get_xdg_popup(window->object(), parentSurface, seat, m_popupSerial, x, y), window);
|
||||
m_popups.append(window);
|
||||
QObject::connect(popup, &QWaylandXdgPopup::destroyed, [this, window](){
|
||||
m_popups.removeOne(window);
|
||||
if (m_popups.empty())
|
||||
m_popupSerial = 0;
|
||||
});
|
||||
return popup;
|
||||
}
|
||||
|
||||
void QWaylandXdgShell::xdg_shell_ping(uint32_t serial)
|
||||
|
@ -52,11 +52,12 @@
|
||||
//
|
||||
|
||||
#include <QtCore/QSize>
|
||||
#include <QtCore/QVector>
|
||||
|
||||
#include <wayland-client.h>
|
||||
|
||||
#include <QtWaylandClient/private/qwayland-xdg-shell.h>
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
#include <QtWaylandClient/private/qwaylandshellsurface_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -82,6 +83,9 @@ public:
|
||||
|
||||
private:
|
||||
void xdg_shell_ping(uint32_t serial) Q_DECL_OVERRIDE;
|
||||
|
||||
QVector<QWaylandWindow *> m_popups;
|
||||
uint m_popupSerial;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -54,6 +54,12 @@ QWaylandXdgShellIntegration::QWaylandXdgShellIntegration(QWaylandDisplay *displa
|
||||
}
|
||||
}
|
||||
|
||||
bool QWaylandXdgShellIntegration::initialize(QWaylandDisplay *display)
|
||||
{
|
||||
QWaylandShellIntegration::initialize(display);
|
||||
return m_xdgShell != nullptr;
|
||||
}
|
||||
|
||||
QWaylandShellSurface *QWaylandXdgShellIntegration::createShellSurface(QWaylandWindow *window)
|
||||
{
|
||||
if (window->window()->type() == Qt::WindowType::Popup)
|
||||
@ -62,6 +68,13 @@ QWaylandShellSurface *QWaylandXdgShellIntegration::createShellSurface(QWaylandWi
|
||||
return m_xdgShell->createXdgSurface(window);
|
||||
}
|
||||
|
||||
void QWaylandXdgShellIntegration::handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) {
|
||||
if (newFocus && qobject_cast<QWaylandXdgPopup *>(newFocus->shellSurface()))
|
||||
m_display->handleWindowActivated(newFocus);
|
||||
if (oldFocus && qobject_cast<QWaylandXdgPopup *>(oldFocus->shellSurface()))
|
||||
m_display->handleWindowDeactivated(oldFocus);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -59,8 +59,9 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellIntegration : public QWaylandShell
|
||||
{
|
||||
public:
|
||||
QWaylandXdgShellIntegration(QWaylandDisplay *display);
|
||||
bool initialize(QWaylandDisplay *) Q_DECL_OVERRIDE { return m_xdgShell != Q_NULLPTR; }
|
||||
bool initialize(QWaylandDisplay *display) Q_DECL_OVERRIDE;
|
||||
QWaylandShellSurface *createShellSurface(QWaylandWindow *window) Q_DECL_OVERRIDE;
|
||||
void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
QWaylandXdgShell *m_xdgShell;
|
||||
|
@ -128,17 +128,13 @@ void QWaylandXdgSurface::setMinimized()
|
||||
set_minimized();
|
||||
}
|
||||
|
||||
void QWaylandXdgSurface::setTopLevel()
|
||||
void QWaylandXdgSurface::updateTransientParent(QWaylandWindow *parent)
|
||||
{
|
||||
// There's no xdg_shell_surface API for this, ignoring
|
||||
}
|
||||
|
||||
void QWaylandXdgSurface::updateTransientParent(QWindow *parent)
|
||||
{
|
||||
QWaylandWindow *parent_wayland_window = static_cast<QWaylandWindow *>(parent->handle());
|
||||
if (!parent_wayland_window)
|
||||
if (!parent)
|
||||
return;
|
||||
set_parent(m_shell->get_xdg_surface(parent_wayland_window->object()));
|
||||
auto parentXdgSurface = qobject_cast<QWaylandXdgSurface *>(parent->shellSurface());
|
||||
Q_ASSERT(parentXdgSurface);
|
||||
set_parent(parentXdgSurface->object());
|
||||
}
|
||||
|
||||
void QWaylandXdgSurface::setTitle(const QString & title)
|
||||
@ -181,6 +177,13 @@ void QWaylandXdgSurface::sendProperty(const QString &name, const QVariant &value
|
||||
m_extendedWindow->updateGenericProperty(name, value);
|
||||
}
|
||||
|
||||
void QWaylandXdgSurface::setType(Qt::WindowType type, QWaylandWindow *transientParent)
|
||||
{
|
||||
Q_UNUSED(type)
|
||||
if (transientParent)
|
||||
updateTransientParent(transientParent);
|
||||
}
|
||||
|
||||
void QWaylandXdgSurface::xdg_surface_configure(int32_t width, int32_t height, struct wl_array *states,uint32_t serial)
|
||||
{
|
||||
uint32_t *state = reinterpret_cast<uint32_t*>(states->data);
|
||||
|
@ -56,7 +56,7 @@
|
||||
|
||||
#include <wayland-client.h>
|
||||
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
#include <QtWaylandClient/private/qwayland-xdg-shell.h>
|
||||
#include <QtWaylandClient/private/qwaylandshellsurface_p.h>
|
||||
|
||||
@ -96,19 +96,18 @@ public:
|
||||
void setWindowFlags(Qt::WindowFlags flags) Q_DECL_OVERRIDE;
|
||||
void sendProperty(const QString &name, const QVariant &value) Q_DECL_OVERRIDE;
|
||||
|
||||
bool shellManagesActiveState() const Q_DECL_OVERRIDE { return true; }
|
||||
|
||||
bool isFullscreen() const { return m_fullscreen; }
|
||||
bool isMaximized() const { return m_maximized; }
|
||||
|
||||
void setType(Qt::WindowType type, QWaylandWindow *transientParent) override;
|
||||
|
||||
private:
|
||||
void setMaximized() Q_DECL_OVERRIDE;
|
||||
void setFullscreen() Q_DECL_OVERRIDE;
|
||||
void setNormal() Q_DECL_OVERRIDE;
|
||||
void setMinimized() Q_DECL_OVERRIDE;
|
||||
|
||||
void setTopLevel() Q_DECL_OVERRIDE;
|
||||
void updateTransientParent(QWindow *parent) Q_DECL_OVERRIDE;
|
||||
void updateTransientParent(QWaylandWindow *parent);
|
||||
|
||||
private:
|
||||
QWaylandWindow *m_window;
|
||||
|
@ -43,8 +43,6 @@
|
||||
#include <QKeyEvent>
|
||||
#include <QString>
|
||||
|
||||
#ifndef QT_NO_WAYLAND_XKB
|
||||
|
||||
#include <xkbcommon/xkbcommon-keysyms.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -377,5 +375,3 @@ QVector<xkb_keysym_t> QWaylandXkb::toKeysym(QKeyEvent *event)
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_WAYLAND_XKB
|
||||
|
@ -41,8 +41,6 @@
|
||||
#ifndef QWAYLANDXKB_H
|
||||
#define QWAYLANDXKB_H
|
||||
|
||||
#ifndef QT_NO_WAYLAND_XKB
|
||||
|
||||
#include <Qt>
|
||||
#include <QEvent>
|
||||
#include <xkbcommon/xkbcommon.h>
|
||||
@ -65,6 +63,4 @@ public:
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_WAYLAND_XKB
|
||||
|
||||
#endif
|
||||
|
@ -51,8 +51,8 @@
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -68,8 +68,20 @@ public:
|
||||
QWaylandShellIntegration() {}
|
||||
virtual ~QWaylandShellIntegration() {}
|
||||
|
||||
virtual bool initialize(QWaylandDisplay *display) = 0;
|
||||
virtual bool initialize(QWaylandDisplay *display) {
|
||||
m_display = display;
|
||||
return true;
|
||||
}
|
||||
virtual QWaylandShellSurface *createShellSurface(QWaylandWindow *window) = 0;
|
||||
virtual void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) {
|
||||
if (newFocus)
|
||||
m_display->handleWindowActivated(newFocus);
|
||||
if (oldFocus)
|
||||
m_display->handleWindowDeactivated(oldFocus);
|
||||
}
|
||||
|
||||
protected:
|
||||
QWaylandDisplay *m_display;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace QtWaylandClient {
|
||||
|
||||
#ifndef QT_NO_LIBRARY
|
||||
#if QT_CONFIG(library)
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
|
||||
(QWaylandShellIntegrationFactoryInterface_iid, QLatin1String("/wayland-shell-integration"), Qt::CaseInsensitive))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
|
||||
@ -57,7 +57,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
|
||||
|
||||
QStringList QWaylandShellIntegrationFactory::keys(const QString &pluginPath)
|
||||
{
|
||||
#ifndef QT_NO_LIBRARY
|
||||
#if QT_CONFIG(library)
|
||||
QStringList list;
|
||||
if (!pluginPath.isEmpty()) {
|
||||
QCoreApplication::addLibraryPath(pluginPath);
|
||||
@ -80,7 +80,7 @@ QStringList QWaylandShellIntegrationFactory::keys(const QString &pluginPath)
|
||||
|
||||
QWaylandShellIntegration *QWaylandShellIntegrationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath)
|
||||
{
|
||||
#ifndef QT_NO_LIBRARY
|
||||
#if QT_CONFIG(library)
|
||||
// Try loading the plugin from platformPluginPath first:
|
||||
if (!pluginPath.isEmpty()) {
|
||||
QCoreApplication::addLibraryPath(pluginPath);
|
||||
|
@ -51,7 +51,7 @@
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
#include <QtCore/QStringList>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
@ -51,7 +51,7 @@
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
|
||||
#include <QtCore/qplugin.h>
|
||||
#include <QtCore/qfactoryinterface.h>
|
||||
|
@ -4,11 +4,7 @@ TARGET = tst_client
|
||||
QT += testlib
|
||||
QT += core-private gui-private
|
||||
|
||||
!contains(QT_CONFIG, no-pkg-config) {
|
||||
PKGCONFIG += wayland-client wayland-server
|
||||
} else {
|
||||
LIBS += -lwayland-client -lwayland-server
|
||||
}
|
||||
QMAKE_USE += wayland-client wayland-server
|
||||
|
||||
CONFIG += wayland-scanner
|
||||
WAYLANDSERVERSOURCES += \
|
||||
|
@ -248,8 +248,8 @@ void tst_WaylandClient::backingStore()
|
||||
|
||||
window.hide();
|
||||
|
||||
// hiding the window should detach the buffer
|
||||
QTRY_VERIFY(surface->image.isNull());
|
||||
// hiding the window should destroy the surface
|
||||
QTRY_VERIFY(!compositor->surface());
|
||||
}
|
||||
|
||||
class DndWindow : public QWindow
|
||||
|
Loading…
x
Reference in New Issue
Block a user