summaryrefslogtreecommitdiffstats
path: root/src/compositor/wayland_wrapper
diff options
context:
space:
mode:
Diffstat (limited to 'src/compositor/wayland_wrapper')
-rw-r--r--src/compositor/wayland_wrapper/qwlcompositor.cpp618
-rw-r--r--src/compositor/wayland_wrapper/qwlcompositor_p.h253
-rw-r--r--src/compositor/wayland_wrapper/qwldatadevice.cpp161
-rw-r--r--src/compositor/wayland_wrapper/qwldatadevice_p.h81
-rw-r--r--src/compositor/wayland_wrapper/qwldatadevicemanager.cpp77
-rw-r--r--src/compositor/wayland_wrapper/qwldatadevicemanager_p.h64
-rw-r--r--src/compositor/wayland_wrapper/qwldataoffer.cpp50
-rw-r--r--src/compositor/wayland_wrapper/qwldataoffer_p.h52
-rw-r--r--src/compositor/wayland_wrapper/qwldatasource.cpp53
-rw-r--r--src/compositor/wayland_wrapper/qwldatasource_p.h52
-rw-r--r--src/compositor/wayland_wrapper/qwldisplay.cpp65
-rw-r--r--src/compositor/wayland_wrapper/qwldisplay_p.h79
-rw-r--r--src/compositor/wayland_wrapper/qwlextendedsurface.cpp201
-rw-r--r--src/compositor/wayland_wrapper/qwlextendedsurface_p.h143
-rw-r--r--src/compositor/wayland_wrapper/qwlinputdevice.cpp365
-rw-r--r--src/compositor/wayland_wrapper/qwlinputdevice_p.h168
-rw-r--r--src/compositor/wayland_wrapper/qwlinputmethod.cpp150
-rw-r--r--src/compositor/wayland_wrapper/qwlinputmethod_p.h105
-rw-r--r--src/compositor/wayland_wrapper/qwlinputmethodcontext.cpp139
-rw-r--r--src/compositor/wayland_wrapper/qwlinputmethodcontext_p.h94
-rw-r--r--src/compositor/wayland_wrapper/qwlinputpanel.cpp127
-rw-r--r--src/compositor/wayland_wrapper/qwlinputpanel_p.h105
-rw-r--r--src/compositor/wayland_wrapper/qwlinputpanelsurface.cpp91
-rw-r--r--src/compositor/wayland_wrapper/qwlinputpanelsurface_p.h98
-rw-r--r--src/compositor/wayland_wrapper/qwlkeyboard.cpp444
-rw-r--r--src/compositor/wayland_wrapper/qwlkeyboard_p.h176
-rw-r--r--src/compositor/wayland_wrapper/qwllistener.cpp62
-rw-r--r--src/compositor/wayland_wrapper/qwllistener_p.h78
-rw-r--r--src/compositor/wayland_wrapper/qwloutput.cpp271
-rw-r--r--src/compositor/wayland_wrapper/qwloutput_p.h149
-rw-r--r--src/compositor/wayland_wrapper/qwlpointer.cpp336
-rw-r--r--src/compositor/wayland_wrapper/qwlpointer_p.h159
-rw-r--r--src/compositor/wayland_wrapper/qwlqtkey.cpp81
-rw-r--r--src/compositor/wayland_wrapper/qwlqtkey_p.h84
-rw-r--r--src/compositor/wayland_wrapper/qwlqttouch.cpp161
-rw-r--r--src/compositor/wayland_wrapper/qwlqttouch_p.h93
-rw-r--r--src/compositor/wayland_wrapper/qwlregion.cpp52
-rw-r--r--src/compositor/wayland_wrapper/qwlregion_p.h54
-rw-r--r--src/compositor/wayland_wrapper/qwlshellsurface.cpp557
-rw-r--r--src/compositor/wayland_wrapper/qwlshellsurface_p.h238
-rw-r--r--src/compositor/wayland_wrapper/qwlsubsurface.cpp151
-rw-r--r--src/compositor/wayland_wrapper/qwlsubsurface_p.h103
-rw-r--r--src/compositor/wayland_wrapper/qwlsurface.cpp593
-rw-r--r--src/compositor/wayland_wrapper/qwlsurface_p.h307
-rw-r--r--src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp310
-rw-r--r--src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h129
-rw-r--r--src/compositor/wayland_wrapper/qwltextinput.cpp205
-rw-r--r--src/compositor/wayland_wrapper/qwltextinput_p.h108
-rw-r--r--src/compositor/wayland_wrapper/qwltextinputmanager.cpp67
-rw-r--r--src/compositor/wayland_wrapper/qwltextinputmanager_p.h80
-rw-r--r--src/compositor/wayland_wrapper/qwltouch.cpp187
-rw-r--r--src/compositor/wayland_wrapper/qwltouch_p.h131
-rw-r--r--src/compositor/wayland_wrapper/wayland_wrapper.pri46
53 files changed, 458 insertions, 8345 deletions
diff --git a/src/compositor/wayland_wrapper/qwlcompositor.cpp b/src/compositor/wayland_wrapper/qwlcompositor.cpp
deleted file mode 100644
index b1dd49dcd..000000000
--- a/src/compositor/wayland_wrapper/qwlcompositor.cpp
+++ /dev/null
@@ -1,618 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwlcompositor_p.h"
-
-#include "qwaylandinput.h"
-#include "qwldisplay_p.h"
-#include "qwloutput_p.h"
-#include "qwlsurface_p.h"
-#include "qwaylandclient.h"
-#include "qwaylandcompositor.h"
-#include "qwldatadevicemanager_p.h"
-#include "qwldatadevice_p.h"
-#include "qwlextendedsurface_p.h"
-#include "qwlsubsurface_p.h"
-#include "qwlshellsurface_p.h"
-#include "qwlqttouch_p.h"
-#include "qwlqtkey_p.h"
-#include "qwlinputdevice_p.h"
-#include "qwlinputpanel_p.h"
-#include "qwlregion_p.h"
-#include "qwlpointer_p.h"
-#include "qwltextinputmanager_p.h"
-#include "qwaylandglobalinterface.h"
-#include "qwaylandsurfaceview.h"
-#include "qwaylandshmformathelper.h"
-#include "qwaylandoutput.h"
-#include "qwlkeyboard_p.h"
-
-#include <QWindow>
-#include <QSocketNotifier>
-#include <QScreen>
-#include <qpa/qplatformscreen.h>
-#include <QGuiApplication>
-#include <QDebug>
-
-#include <QtCore/QAbstractEventDispatcher>
-#include <QtGui/private/qguiapplication_p.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stddef.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-#include <sys/mman.h>
-#include <sys/select.h>
-#include <sys/time.h>
-
-#include <wayland-server.h>
-
-#if defined (QT_COMPOSITOR_WAYLAND_GL)
-#include "hardware_integration/qwlhwintegration_p.h"
-#include "hardware_integration/qwlclientbufferintegration_p.h"
-#include "hardware_integration/qwlserverbufferintegration_p.h"
-#endif
-#include "windowmanagerprotocol/waylandwindowmanagerintegration_p.h"
-
-#include "hardware_integration/qwlclientbufferintegrationfactory_p.h"
-#include "hardware_integration/qwlserverbufferintegrationfactory_p.h"
-
-#include "../shared/qwaylandxkb.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWayland {
-
-static Compositor *compositor;
-
-class WindowSystemEventHandler : public QWindowSystemEventHandler
-{
-public:
- WindowSystemEventHandler(Compositor *c) : compositor(c) {}
- bool sendEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e) Q_DECL_OVERRIDE
- {
- if (e->type == QWindowSystemInterfacePrivate::Key) {
- QWindowSystemInterfacePrivate::KeyEvent *ke = static_cast<QWindowSystemInterfacePrivate::KeyEvent *>(e);
- Keyboard *keyb = compositor->defaultInputDevice()->keyboardDevice();
-
- uint32_t code = ke->nativeScanCode;
- bool isDown = ke->keyType == QEvent::KeyPress;
-
-#ifndef QT_NO_WAYLAND_XKB
- QString text;
- Qt::KeyboardModifiers modifiers = QWaylandXkb::modifiers(keyb->xkbState());
-
- const xkb_keysym_t sym = xkb_state_key_get_one_sym(keyb->xkbState(), code);
- uint utf32 = xkb_keysym_to_utf32(sym);
- if (utf32)
- text = QString::fromUcs4(&utf32, 1);
- int qtkey = QWaylandXkb::keysymToQtKey(sym, modifiers, text);
-
- ke->key = qtkey;
- ke->modifiers = modifiers;
- ke->nativeVirtualKey = sym;
- ke->nativeModifiers = keyb->xkbModsMask();
- ke->unicode = text;
-#endif
- if (!ke->repeat)
- keyb->keyEvent(code, isDown ? WL_KEYBOARD_KEY_STATE_PRESSED : WL_KEYBOARD_KEY_STATE_RELEASED);
-
- QWindowSystemEventHandler::sendEvent(e);
-
- if (!ke->repeat) {
- keyb->updateKeymap();
- keyb->updateModifierState(code, isDown ? WL_KEYBOARD_KEY_STATE_PRESSED : WL_KEYBOARD_KEY_STATE_RELEASED);
- }
- } else {
- QWindowSystemEventHandler::sendEvent(e);
- }
- return true;
- }
-
- Compositor *compositor;
-};
-
-Compositor *Compositor::instance()
-{
- return compositor;
-}
-
-Compositor::Compositor(QWaylandCompositor *qt_compositor, QWaylandCompositor::ExtensionFlags extensions)
- : m_extensions(extensions)
- , m_display(new Display)
- , m_current_frame(0)
- , m_last_queued_buf(-1)
- , m_qt_compositor(qt_compositor)
- , m_orientation(Qt::PrimaryOrientation)
-#if defined (QT_COMPOSITOR_WAYLAND_GL)
- , m_hw_integration(0)
- , m_client_buffer_integration(0)
- , m_server_buffer_integration(0)
-#endif
- , m_windowManagerIntegration(0)
- , m_surfaceExtension(0)
- , m_touchExtension(0)
- , m_qtkeyExtension(0)
- , m_textInputManager()
- , m_inputPanel()
- , m_eventHandler(new WindowSystemEventHandler(this))
- , m_retainSelection(false)
-{
- m_timer.start();
- compositor = this;
-
- QWindowSystemInterfacePrivate::installWindowSystemEventHandler(m_eventHandler.data());
-}
-
-void Compositor::init()
-{
- QStringList arguments = QCoreApplication::instance()->arguments();
-
- int socketArg = arguments.indexOf(QLatin1String("--wayland-socket-name"));
- if (socketArg != -1 && socketArg + 1 < arguments.size())
- m_socket_name = arguments.at(socketArg + 1).toLocal8Bit();
-
- wl_compositor::init(m_display->handle(), 3);
- wl_subcompositor::init(m_display->handle(), 1);
-
- m_data_device_manager = new DataDeviceManager(this);
-
- wl_display_init_shm(m_display->handle());
- QVector<wl_shm_format> formats = QWaylandShmFormatHelper::supportedWaylandFormats();
- foreach (wl_shm_format format, formats)
- wl_display_add_shm_format(m_display->handle(), format);
-
- if (wl_display_add_socket(m_display->handle(), m_qt_compositor->socketName())) {
- fprintf(stderr, "Fatal: Failed to open server socket\n");
- exit(EXIT_FAILURE);
- }
-
- m_loop = wl_display_get_event_loop(m_display->handle());
-
- int fd = wl_event_loop_get_fd(m_loop);
-
- QSocketNotifier *sockNot = new QSocketNotifier(fd, QSocketNotifier::Read, this);
- connect(sockNot, SIGNAL(activated(int)), this, SLOT(processWaylandEvents()));
-
- QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::eventDispatcher;
- connect(dispatcher, SIGNAL(aboutToBlock()), this, SLOT(processWaylandEvents()));
-
- qRegisterMetaType<SurfaceBuffer*>("SurfaceBuffer*");
- qRegisterMetaType<QWaylandClient*>("WaylandClient*");
- qRegisterMetaType<QWaylandSurface*>("WaylandSurface*");
- qRegisterMetaType<QWaylandSurfaceView*>("WaylandSurfaceView*");
- //initialize distancefieldglyphcache here
-
- initializeHardwareIntegration();
- initializeExtensions();
- initializeDefaultInputDevice();
-}
-
-Compositor::~Compositor()
-{
- if (!m_destroyed_surfaces.isEmpty())
- qWarning("QWaylandCompositor::cleanupGraphicsResources() must be called manually");
- qDeleteAll(m_clients);
-
- qDeleteAll(m_outputs);
-
- delete m_surfaceExtension;
- delete m_touchExtension;
- delete m_qtkeyExtension;
-
- removeInputDevice(m_default_wayland_input_device);
- delete m_default_wayland_input_device;
- delete m_data_device_manager;
-
- delete m_display;
-}
-
-void Compositor::sendFrameCallbacks(QList<QWaylandSurface *> visibleSurfaces)
-{
- foreach (QWaylandSurface *surface, visibleSurfaces) {
- surface->handle()->sendFrameCallback();
- }
- wl_display_flush_clients(m_display->handle());
-}
-
-uint Compositor::currentTimeMsecs() const
-{
- return m_timer.elapsed();
-}
-
-QList<QWaylandOutput *> Compositor::outputs() const
-{
- return m_outputs;
-}
-
-QWaylandOutput *Compositor::output(QWindow *window) const
-{
- Q_FOREACH (QWaylandOutput *output, m_outputs) {
- if (output->window() == window)
- return output;
- }
-
- return Q_NULLPTR;
-}
-
-void Compositor::addOutput(QWaylandOutput *output)
-{
- Q_ASSERT(output->handle());
-
- if (m_outputs.contains(output))
- return;
-
- m_outputs.append(output);
-}
-
-void Compositor::removeOutput(QWaylandOutput *output)
-{
- Q_ASSERT(output->handle());
-
- m_outputs.removeOne(output);
-}
-
-QWaylandOutput *Compositor::primaryOutput() const
-{
- if (m_outputs.size() == 0)
- return Q_NULLPTR;
- return m_outputs.at(0);
-}
-
-void Compositor::setPrimaryOutput(QWaylandOutput *output)
-{
- Q_ASSERT(output->handle());
-
- int i = m_outputs.indexOf(output);
- if (i <= 0)
- return;
-
- m_outputs.removeAt(i);
- m_outputs.prepend(output);
-}
-
-void Compositor::processWaylandEvents()
-{
- int ret = wl_event_loop_dispatch(m_loop, 0);
- if (ret)
- fprintf(stderr, "wl_event_loop_dispatch error: %d\n", ret);
- wl_display_flush_clients(m_display->handle());
-}
-
-void Compositor::destroySurface(Surface *surface)
-{
- m_surfaces.removeOne(surface);
-
- waylandCompositor()->surfaceAboutToBeDestroyed(surface->waylandSurface());
-
- surface->releaseSurfaces();
- m_destroyed_surfaces << surface->waylandSurface();
-}
-
-void Compositor::resetInputDevice(Surface *surface)
-{
- foreach (QWaylandInputDevice *dev, m_inputDevices) {
- if (dev->keyboardFocus() == surface->waylandSurface())
- dev->setKeyboardFocus(0);
- if (dev->mouseFocus() && dev->mouseFocus()->surface() == surface->waylandSurface())
- dev->setMouseFocus(0, QPointF(), QPointF());
- }
-}
-
-void Compositor::cleanupGraphicsResources()
-{
- qDeleteAll(m_destroyed_surfaces);
- m_destroyed_surfaces.clear();
-}
-
-void Compositor::compositor_create_surface(wl_compositor::Resource *resource, uint32_t id)
-{
- QWaylandSurface *surface = new QWaylandSurface(resource->client(), id, resource->version(), m_qt_compositor);
- m_surfaces << surface->handle();
- surface->handle()->addToOutput(primaryOutput()->handle());
- //BUG: This may not be an on-screen window surface though
- m_qt_compositor->surfaceCreated(surface);
-}
-
-void Compositor::compositor_create_region(wl_compositor::Resource *resource, uint32_t id)
-{
- Q_UNUSED(compositor);
- new Region(resource->client(), id);
-}
-
-void Compositor::destroyClient(QWaylandClient *client)
-{
- if (!client)
- return;
-
- if (m_windowManagerIntegration)
- m_windowManagerIntegration->sendQuitMessage(client->client());
-
- wl_client_destroy(client->client());
-}
-
-void Compositor::subcompositor_destroy(wl_subcompositor::Resource *resource)
-{
- wl_resource_destroy(resource->handle);
-}
-
-void Compositor::subcompositor_get_subsurface(wl_subcompositor::Resource *resource, uint32_t id, wl_resource *surface, wl_resource *parent)
-{
- Surface *s = Surface::fromResource(surface);
- Surface *p = Surface::fromResource(parent);
-
- static const char where[] = "get_subsurface: wl_subsurface@";
- if (s == p) {
- wl_resource_post_error(resource->handle, WL_SUBCOMPOSITOR_ERROR_BAD_SURFACE, "%s%d: wl_surface@%d cannot be its own parent", where, id, wl_resource_get_id(surface));
- return;
- }
- if (SubSurface::get(s)) {
- wl_resource_post_error(resource->handle, WL_SUBCOMPOSITOR_ERROR_BAD_SURFACE, "%s%d: wl_surface@%d is already a sub-surface", where, id, wl_resource_get_id(surface));
- return;
- }
-
- if (!s->setRole(SubSurface::role(), resource->handle, WL_SUBCOMPOSITOR_ERROR_BAD_SURFACE))
- return;
-
- SubSurface *ss = new SubSurface(s, p, resource->client(), id, resource->version());
- s->setRoleHandler(ss);
-}
-
-ClientBufferIntegration * Compositor::clientBufferIntegration() const
-{
-#ifdef QT_COMPOSITOR_WAYLAND_GL
- return m_client_buffer_integration.data();
-#else
- return 0;
-#endif
-}
-
-ServerBufferIntegration * Compositor::serverBufferIntegration() const
-{
-#ifdef QT_COMPOSITOR_WAYLAND_GL
- return m_server_buffer_integration.data();
-#else
- return 0;
-#endif
-}
-
-void Compositor::initializeHardwareIntegration()
-{
-#ifdef QT_COMPOSITOR_WAYLAND_GL
- if (m_extensions & QWaylandCompositor::HardwareIntegrationExtension)
- m_hw_integration.reset(new HardwareIntegration(this));
-
- loadClientBufferIntegration();
- loadServerBufferIntegration();
-
- if (m_client_buffer_integration)
- m_client_buffer_integration->initializeHardware(m_display);
- if (m_server_buffer_integration)
- m_server_buffer_integration->initializeHardware(m_qt_compositor);
-#endif
-}
-
-void Compositor::initializeExtensions()
-{
- if (m_extensions & QWaylandCompositor::SurfaceExtension)
- m_surfaceExtension = new SurfaceExtensionGlobal(this);
- if (m_extensions & QWaylandCompositor::TouchExtension)
- m_touchExtension = new TouchExtensionGlobal(this);
- if (m_extensions & QWaylandCompositor::QtKeyExtension)
- m_qtkeyExtension = new QtKeyExtensionGlobal(this);
- if (m_extensions & QWaylandCompositor::TextInputExtension) {
- m_textInputManager.reset(new TextInputManager(this));
- m_inputPanel.reset(new InputPanel(this));
- }
- if (m_extensions & QWaylandCompositor::WindowManagerExtension) {
- m_windowManagerIntegration = new WindowManagerServerIntegration(m_qt_compositor, this);
- m_windowManagerIntegration->initialize(m_display);
- }
-}
-
-void Compositor::initializeDefaultInputDevice()
-{
- m_default_wayland_input_device = new QWaylandInputDevice(m_qt_compositor);
- registerInputDevice(m_default_wayland_input_device);
-}
-
-QList<QWaylandClient *> Compositor::clients() const
-{
- return m_clients;
-}
-
-void Compositor::setClientFullScreenHint(bool value)
-{
- if (m_windowManagerIntegration)
- m_windowManagerIntegration->setShowIsFullScreen(value);
-}
-
-QWaylandCompositor::ExtensionFlags Compositor::extensions() const
-{
- return m_extensions;
-}
-
-InputDevice* Compositor::defaultInputDevice()
-{
- // The list gets prepended so that default is the last element
- return m_inputDevices.last()->handle();
-}
-
-void Compositor::configureTouchExtension(int flags)
-{
- if (m_touchExtension)
- m_touchExtension->setFlags(flags);
-}
-
-InputPanel *Compositor::inputPanel() const
-{
- return m_inputPanel.data();
-}
-
-DataDeviceManager *Compositor::dataDeviceManager() const
-{
- return m_data_device_manager;
-}
-
-void Compositor::setRetainedSelectionEnabled(bool enabled)
-{
- m_retainSelection = enabled;
-}
-
-bool Compositor::retainedSelectionEnabled() const
-{
- return m_retainSelection;
-}
-
-void Compositor::feedRetainedSelectionData(QMimeData *data)
-{
- if (m_retainSelection)
- m_qt_compositor->retainedSelectionReceived(data);
-}
-
-void Compositor::overrideSelection(const QMimeData *data)
-{
- m_data_device_manager->overrideSelection(*data);
-}
-
-bool Compositor::isDragging() const
-{
- return false;
-}
-
-void Compositor::sendDragMoveEvent(const QPoint &global, const QPoint &local,
- Surface *surface)
-{
- Q_UNUSED(global);
- Q_UNUSED(local);
- Q_UNUSED(surface);
-// Drag::instance()->dragMove(global, local, surface);
-}
-
-void Compositor::sendDragEndEvent()
-{
-// Drag::instance()->dragEnd();
-}
-
-void Compositor::bindGlobal(wl_client *client, void *data, uint32_t version, uint32_t id)
-{
- QWaylandGlobalInterface *iface = static_cast<QWaylandGlobalInterface *>(data);
- iface->bind(client, qMin(iface->version(), version), id);
-};
-
-void Compositor::loadClientBufferIntegration()
-{
-#ifdef QT_COMPOSITOR_WAYLAND_GL
- QStringList keys = ClientBufferIntegrationFactory::keys();
- QString targetKey;
- QByteArray clientBufferIntegration = qgetenv("QT_WAYLAND_HARDWARE_INTEGRATION");
- if (clientBufferIntegration.isEmpty())
- clientBufferIntegration = qgetenv("QT_WAYLAND_CLIENT_BUFFER_INTEGRATION");
- if (keys.contains(QString::fromLocal8Bit(clientBufferIntegration.constData()))) {
- targetKey = QString::fromLocal8Bit(clientBufferIntegration.constData());
- } else if (keys.contains(QString::fromLatin1("wayland-egl"))) {
- targetKey = QString::fromLatin1("wayland-egl");
- } else if (!keys.isEmpty()) {
- targetKey = keys.first();
- }
-
- if (!targetKey.isEmpty()) {
- m_client_buffer_integration.reset(ClientBufferIntegrationFactory::create(targetKey, QStringList()));
- if (m_client_buffer_integration) {
- m_client_buffer_integration->setCompositor(m_qt_compositor);
- if (m_hw_integration)
- m_hw_integration->setClientBufferIntegration(targetKey);
- }
- }
- //BUG: if there is no client buffer integration, bad things will happen when opengl is used
-#endif
-}
-
-void Compositor::loadServerBufferIntegration()
-{
-#ifdef QT_COMPOSITOR_WAYLAND_GL
- QStringList keys = ServerBufferIntegrationFactory::keys();
- QString targetKey;
- QByteArray serverBufferIntegration = qgetenv("QT_WAYLAND_SERVER_BUFFER_INTEGRATION");
- if (keys.contains(QString::fromLocal8Bit(serverBufferIntegration.constData()))) {
- targetKey = QString::fromLocal8Bit(serverBufferIntegration.constData());
- }
- if (!targetKey.isEmpty()) {
- m_server_buffer_integration.reset(ServerBufferIntegrationFactory::create(targetKey, QStringList()));
- if (m_hw_integration)
- m_hw_integration->setServerBufferIntegration(targetKey);
- }
-#endif
-}
-
-void Compositor::registerInputDevice(QWaylandInputDevice *device)
-{
- // The devices get prepended as the first input device that gets added
- // is assumed to be the default and it will claim to accept all the input
- // events if asked
- m_inputDevices.prepend(device);
-}
-
-void Compositor::removeInputDevice(QWaylandInputDevice *device)
-{
- m_inputDevices.removeOne(device);
-}
-
-QWaylandInputDevice *Compositor::inputDeviceFor(QInputEvent *inputEvent)
-{
- QWaylandInputDevice *dev = NULL;
- for (int i = 0; i < m_inputDevices.size(); i++) {
- QWaylandInputDevice *candidate = m_inputDevices.at(i);
- if (candidate->isOwner(inputEvent)) {
- dev = candidate;
- break;
- }
- }
- return dev;
-}
-
-} // namespace Wayland
-
-QT_END_NAMESPACE
diff --git a/src/compositor/wayland_wrapper/qwlcompositor_p.h b/src/compositor/wayland_wrapper/qwlcompositor_p.h
deleted file mode 100644
index 6fd63d748..000000000
--- a/src/compositor/wayland_wrapper/qwlcompositor_p.h
+++ /dev/null
@@ -1,253 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014-2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef WL_COMPOSITOR_H
-#define WL_COMPOSITOR_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 <QtCompositor/qwaylandexport.h>
-#include <QtCompositor/qwaylandcompositor.h>
-
-#include <QtCompositor/private/qwayland-server-wayland.h>
-
-#include <QtCore/QElapsedTimer>
-#include <QtCore/QSet>
-
-#include <private/qwldisplay_p.h>
-
-#include <wayland-server.h>
-
-QT_BEGIN_NAMESPACE
-
-class QWaylandClient;
-class QWaylandClientPrivate;
-class QInputEvent;
-
-class QWaylandCompositor;
-class QWaylandInputDevice;
-class WindowManagerServerIntegration;
-class QMimeData;
-class QPlatformScreenBuffer;
-class QWaylandSurface;
-class QWindowSystemEventHandler;
-
-namespace QtWayland {
-
-class Surface;
-class SurfaceBuffer;
-class InputDevice;
-class DataDeviceManager;
-class OutputGlobal;
-class SurfaceExtensionGlobal;
-class SubSurfaceExtensionGlobal;
-class TouchExtensionGlobal;
-class QtKeyExtensionGlobal;
-class TextInputManager;
-class InputPanel;
-class HardwareIntegration;
-class ClientBufferIntegration;
-class ServerBufferIntegration;
-
-class Q_COMPOSITOR_EXPORT Compositor : public QObject, public QtWaylandServer::wl_compositor, public QtWaylandServer::wl_subcompositor
-{
- Q_OBJECT
-
-public:
- Compositor(QWaylandCompositor *qt_compositor, QWaylandCompositor::ExtensionFlags extensions);
- ~Compositor();
-
- void init();
- void sendFrameCallbacks(QList<QWaylandSurface *> visibleSurfaces);
-
- InputDevice *defaultInputDevice();
-
- void registerInputDevice(QWaylandInputDevice *device);
- QList<QWaylandInputDevice *> inputDevices() const { return m_inputDevices; }
- QWaylandInputDevice *inputDeviceFor(QInputEvent *inputEvent);
- void removeInputDevice(QWaylandInputDevice *device);
-
- void destroySurface(Surface *surface);
-
- void destroyClient(QWaylandClient *client);
-
- uint currentTimeMsecs() const;
-
- QList<QWaylandOutput *> outputs() const;
- QWaylandOutput *output(QWindow *window) const;
-
- void addOutput(QWaylandOutput *output);
- void removeOutput(QWaylandOutput *output);
-
- QWaylandOutput *primaryOutput() const;
- void setPrimaryOutput(QWaylandOutput *output);
-
- ClientBufferIntegration *clientBufferIntegration() const;
- ServerBufferIntegration *serverBufferIntegration() const;
- void initializeHardwareIntegration();
- void initializeExtensions();
- void initializeDefaultInputDevice();
- void initializeWindowManagerProtocol();
-
- QList<Surface *> surfaces() const { return m_surfaces; }
-
- QWaylandCompositor *waylandCompositor() const { return m_qt_compositor; }
-
- struct wl_display *wl_display() const { return m_display->handle(); }
- Display *display() const { return m_display; }
-
- static Compositor *instance();
-
- QList<QWaylandClient *> clients() const;
-
- WindowManagerServerIntegration *windowManagerIntegration() const { return m_windowManagerIntegration; }
-
- void setClientFullScreenHint(bool value);
-
- QWaylandCompositor::ExtensionFlags extensions() const;
-
- TouchExtensionGlobal *touchExtension() { return m_touchExtension; }
- void configureTouchExtension(int flags);
-
- QtKeyExtensionGlobal *qtkeyExtension() { return m_qtkeyExtension; }
-
- InputPanel *inputPanel() const;
-
- DataDeviceManager *dataDeviceManager() const;
-
- bool isDragging() const;
- void sendDragMoveEvent(const QPoint &global, const QPoint &local, Surface *surface);
- void sendDragEndEvent();
-
- void setRetainedSelectionEnabled(bool enabled);
- bool retainedSelectionEnabled() const;
- void overrideSelection(const QMimeData *data);
- void feedRetainedSelectionData(QMimeData *data);
-
- static void bindGlobal(wl_client *client, void *data, uint32_t version, uint32_t id);
- void resetInputDevice(Surface *surface);
-
-public slots:
- void cleanupGraphicsResources();
-
-protected:
- void compositor_create_surface(wl_compositor::Resource *resource, uint32_t id) Q_DECL_OVERRIDE;
- void compositor_create_region(wl_compositor::Resource *resource, uint32_t id) Q_DECL_OVERRIDE;
- void subcompositor_destroy(wl_subcompositor::Resource *resource) Q_DECL_OVERRIDE;
- void subcompositor_get_subsurface(wl_subcompositor::Resource *resource, uint32_t id, wl_resource *surface, wl_resource *parent) Q_DECL_OVERRIDE;
-
-private slots:
- void processWaylandEvents();
-
-protected:
- void loadClientBufferIntegration();
- void loadServerBufferIntegration();
-
- QWaylandCompositor::ExtensionFlags m_extensions;
-
- Display *m_display;
- QByteArray m_socket_name;
-
- /* Input */
- QWaylandInputDevice *m_default_wayland_input_device;
-
- QList<QWaylandInputDevice *> m_inputDevices;
-
- /* Output */
- QList<QWaylandOutput *> m_outputs;
-
- DataDeviceManager *m_data_device_manager;
-
- QElapsedTimer m_timer;
- QList<Surface *> m_surfaces;
- QSet<QWaylandSurface *> m_destroyed_surfaces;
-
- /* Render state */
- uint32_t m_current_frame;
- int m_last_queued_buf;
-
- wl_event_loop *m_loop;
-
- QWaylandCompositor *m_qt_compositor;
- Qt::ScreenOrientation m_orientation;
- QList<QWaylandClient *> m_clients;
-
-#ifdef QT_COMPOSITOR_WAYLAND_GL
- QScopedPointer<HardwareIntegration> m_hw_integration;
- QScopedPointer<ClientBufferIntegration> m_client_buffer_integration;
- QScopedPointer<ServerBufferIntegration> m_server_buffer_integration;
-#endif
-
- //extensions
- WindowManagerServerIntegration *m_windowManagerIntegration;
-
- SurfaceExtensionGlobal *m_surfaceExtension;
- TouchExtensionGlobal *m_touchExtension;
- QtKeyExtensionGlobal *m_qtkeyExtension;
- QScopedPointer<TextInputManager> m_textInputManager;
- QScopedPointer<InputPanel> m_inputPanel;
- QList<QWaylandGlobalInterface *> m_globals;
- QScopedPointer<QWindowSystemEventHandler> m_eventHandler;
-
- static void bind_func(struct wl_client *client, void *data,
- uint32_t version, uint32_t id);
-
- bool m_retainSelection;
-
- friend class QT_PREPEND_NAMESPACE(QWaylandCompositor);
- friend class QT_PREPEND_NAMESPACE(QWaylandClient);
- friend class QT_PREPEND_NAMESPACE(QWaylandClientPrivate);
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif //WL_COMPOSITOR_H
diff --git a/src/compositor/wayland_wrapper/qwldatadevice.cpp b/src/compositor/wayland_wrapper/qwldatadevice.cpp
index d97592bd7..e8e96a7d6 100644
--- a/src/compositor/wayland_wrapper/qwldatadevice.cpp
+++ b/src/compositor/wayland_wrapper/qwldatadevice.cpp
@@ -3,36 +3,32 @@
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Compositor.
+** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
+** 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.LGPLv3 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.html.
**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
**
** $QT_END_LICENSE$
**
@@ -40,26 +36,26 @@
#include "qwldatadevice_p.h"
-#include "qwlcompositor_p.h"
#include "qwldatasource_p.h"
#include "qwldataoffer_p.h"
-#include "qwlinputdevice_p.h"
-#include "qwlkeyboard_p.h"
-#include "qwlpointer_p.h"
-#include "qwlsurface_p.h"
-#include "qwltouch_p.h"
+#include "qwaylandsurface_p.h"
#include "qwldatadevicemanager_p.h"
#include "qwaylanddrag.h"
-#include "qwaylandsurfaceview.h"
+#include "qwaylandview.h"
+#include <QtWaylandCompositor/QWaylandClient>
+#include <QtWaylandCompositor/private/qwaylandcompositor_p.h>
+#include <QtWaylandCompositor/private/qwaylandinput_p.h>
+#include <QtWaylandCompositor/private/qwaylandpointer_p.h>
+#include <QtCore/QPointF>
#include <QDebug>
QT_BEGIN_NAMESPACE
namespace QtWayland {
-DataDevice::DataDevice(InputDevice *inputDevice)
+DataDevice::DataDevice(QWaylandInputDevice *inputDevice)
: wl_data_device()
, m_compositor(inputDevice->compositor())
, m_inputDevice(inputDevice)
@@ -72,12 +68,12 @@ DataDevice::DataDevice(InputDevice *inputDevice)
{
}
-void DataDevice::setFocus(QtWaylandServer::wl_keyboard::Resource *focusResource)
+void DataDevice::setFocus(QWaylandClient *focusClient)
{
- if (!focusResource)
+ if (!focusClient)
return;
- Resource *resource = resourceMap().value(focusResource->client());
+ Resource *resource = resourceMap().value(focusClient->client());
if (!resource)
return;
@@ -88,7 +84,7 @@ void DataDevice::setFocus(QtWaylandServer::wl_keyboard::Resource *focusResource)
}
}
-void DataDevice::setDragFocus(QWaylandSurfaceView *focus, const QPointF &localPosition)
+void DataDevice::setDragFocus(QWaylandSurface *focus, const QPointF &localPosition)
{
if (m_dragFocusResource) {
send_leave(m_dragFocusResource->handle);
@@ -99,22 +95,22 @@ void DataDevice::setDragFocus(QWaylandSurfaceView *focus, const QPointF &localPo
if (!focus)
return;
- if (!m_dragDataSource && m_dragClient != focus->surface()->handle()->resource()->client())
+ if (!m_dragDataSource && m_dragClient != focus->waylandClient())
return;
- Resource *resource = resourceMap().value(focus->surface()->handle()->resource()->client());
+ Resource *resource = resourceMap().value(focus->waylandClient());
if (!resource)
return;
- uint32_t serial = wl_display_next_serial(m_compositor->wl_display());
+ uint32_t serial = m_compositor->nextSerial();
DataOffer *offer = m_dragDataSource ? new DataOffer(m_dragDataSource, resource) : 0;
if (m_dragDataSource && !offer)
return;
- send_enter(resource->handle, serial, focus->surface()->handle()->resource()->handle,
+ send_enter(resource->handle, serial, focus->resource(),
wl_fixed_from_double(localPosition.x()), wl_fixed_from_double(localPosition.y()),
offer->resource()->handle);
@@ -122,7 +118,7 @@ void DataDevice::setDragFocus(QWaylandSurfaceView *focus, const QPointF &localPo
m_dragFocusResource = resource;
}
-QWaylandSurfaceView *DataDevice::dragIcon() const
+QWaylandSurface *DataDevice::dragIcon() const
{
return m_dragIcon;
}
@@ -133,65 +129,38 @@ void DataDevice::sourceDestroyed(DataSource *source)
m_selectionSource = 0;
}
-void DataDevice::focus()
+void DataDevice::dragMove(QWaylandSurface *target, const QPointF &pos)
{
- QWaylandSurfaceView *focus = m_compositor->waylandCompositor()->pickView(m_pointer->currentPosition());
-
- if (focus != m_dragFocus)
- setDragFocus(focus, m_compositor->waylandCompositor()->mapToView(focus, m_pointer->currentPosition()));
+ if (target != m_dragFocus)
+ setDragFocus(target, pos);
+ if (!target)
+ return;
+ uint time = m_compositor->currentTimeMsecs(); //### should be serial
+ send_motion(m_dragFocusResource->handle, time,
+ wl_fixed_from_double(pos.x()), wl_fixed_from_double(pos.y()));
}
-void DataDevice::motion(uint32_t time)
+void DataDevice::drop()
{
- if (m_dragIcon) {
- m_dragIcon->setPos(m_pointer->currentPosition());
- }
-
- if (m_dragFocusResource && m_dragFocus) {
- const QPointF &surfacePoint = m_compositor->waylandCompositor()->mapToView(m_dragFocus, m_pointer->currentPosition());
- qDebug() << Q_FUNC_INFO << m_pointer->currentPosition() << surfacePoint;
- send_motion(m_dragFocusResource->handle, time,
- wl_fixed_from_double(surfacePoint.x()), wl_fixed_from_double(surfacePoint.y()));
- }
+ if (m_dragFocusResource)
+ send_drop(m_dragFocusResource->handle);
}
-void DataDevice::button(uint32_t time, Qt::MouseButton button, uint32_t state)
+void DataDevice::cancelDrag()
{
- Q_UNUSED(time);
-
- if (m_dragFocusResource &&
- m_pointer->grabButton() == button &&
- state == Pointer::button_state_released)
- send_drop(m_dragFocusResource->handle);
-
- if (!m_pointer->buttonPressed() &&
- state == Pointer::button_state_released) {
-
- if (m_dragIcon) {
- m_dragIcon = 0;
- Q_EMIT m_inputDevice->dragHandle()->iconChanged();
- }
-
- setDragFocus(0, QPointF());
- m_pointer->endGrab();
- }
}
-
+
void DataDevice::data_device_start_drag(Resource *resource, struct ::wl_resource *source, struct ::wl_resource *origin, struct ::wl_resource *icon, uint32_t serial)
{
- if (m_inputDevice->pointerDevice()->grabSerial() == serial) {
- if (!m_inputDevice->pointerDevice()->buttonPressed() ||
- m_inputDevice->pointerDevice()->focusSurface()->surface()->handle() != Surface::fromResource(origin))
- return;
-
- m_dragClient = resource->client();
- m_dragDataSource = source != 0 ? DataSource::fromResource(source) : 0;
- m_dragIcon = icon != 0 ? m_compositor->waylandCompositor()->createView(Surface::fromResource(icon)->waylandSurface()) : 0;
- Q_EMIT m_inputDevice->dragHandle()->iconChanged();
-
- m_inputDevice->pointerDevice()->setFocus(0, QPointF());
- m_inputDevice->pointerDevice()->startGrab(this);
- }
+ m_dragClient = resource->client();
+ m_dragDataSource = source ? DataSource::fromResource(source) : 0;
+ m_dragIcon = icon ? QWaylandSurface::fromResource(icon) : 0;
+ Q_EMIT m_inputDevice->drag()->iconChanged();
+ Q_EMIT m_inputDevice->drag()->dragStarted();
+
+ Q_UNUSED(serial);
+ Q_UNUSED(origin);
+ //### need to verify that we have an implicit grab with this serial
}
void DataDevice::data_device_set_selection(Resource *, struct ::wl_resource *source, uint32_t serial)
@@ -204,12 +173,12 @@ void DataDevice::data_device_set_selection(Resource *, struct ::wl_resource *sou
m_selectionSource->cancel();
m_selectionSource = dataSource;
- m_compositor->dataDeviceManager()->setCurrentSelectionSource(m_selectionSource);
+ QWaylandCompositorPrivate::get(m_compositor)->dataDeviceManager()->setCurrentSelectionSource(m_selectionSource);
if (m_selectionSource)
m_selectionSource->setDevice(this);
- QtWaylandServer::wl_keyboard::Resource *focusResource = m_inputDevice->keyboardDevice()->focusResource();
- Resource *resource = focusResource ? resourceMap().value(focusResource->client()) : 0;
+ QWaylandClient *focusClient = m_inputDevice->keyboard()->focusClient();
+ Resource *resource = focusClient ? resourceMap().value(focusClient->client()) : 0;
if (resource && m_selectionSource) {
DataOffer *offer = new DataOffer(m_selectionSource, resource);
diff --git a/src/compositor/wayland_wrapper/qwldatadevice_p.h b/src/compositor/wayland_wrapper/qwldatadevice_p.h
index 17e605f19..7359f3084 100644
--- a/src/compositor/wayland_wrapper/qwldatadevice_p.h
+++ b/src/compositor/wayland_wrapper/qwldatadevice_p.h
@@ -3,36 +3,32 @@
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Compositor.
+** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
+** 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.LGPLv3 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.html.
**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
**
** $QT_END_LICENSE$
**
@@ -52,13 +48,11 @@
// We mean it.
//
-#include <QtCompositor/private/qwayland-server-wayland.h>
-#include <qwlpointer_p.h>
+#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
+#include <QtWaylandCompositor/QWaylandInputDevice>
QT_BEGIN_NAMESPACE
-class QWaylandSurfaceView;
-
namespace QtWayland {
class Compositor;
@@ -66,39 +60,40 @@ class DataSource;
class InputDevice;
class Surface;
-class DataDevice : public QtWaylandServer::wl_data_device, public PointerGrabber
+class DataDevice : public QtWaylandServer::wl_data_device
{
public:
- DataDevice(InputDevice *inputDevice);
+ DataDevice(QWaylandInputDevice *inputDevice);
- void setFocus(QtWaylandServer::wl_keyboard::Resource *focusResource);
+ void setFocus(QWaylandClient *client);
- void setDragFocus(QWaylandSurfaceView *focus, const QPointF &localPosition);
+ void setDragFocus(QWaylandSurface *focus, const QPointF &localPosition);
- QWaylandSurfaceView *dragIcon() const;
+ QWaylandSurface *dragIcon() const;
void sourceDestroyed(DataSource *source);
- void focus() Q_DECL_OVERRIDE;
- void motion(uint32_t time) Q_DECL_OVERRIDE;
- void button(uint32_t time, Qt::MouseButton button, uint32_t state) Q_DECL_OVERRIDE;
+ void dragMove(QWaylandSurface *target, const QPointF &pos);
+ void drop();
+ void cancelDrag();
+
protected:
void data_device_start_drag(Resource *resource, struct ::wl_resource *source, struct ::wl_resource *origin, struct ::wl_resource *icon, uint32_t serial) Q_DECL_OVERRIDE;
void data_device_set_selection(Resource *resource, struct ::wl_resource *source, uint32_t serial) Q_DECL_OVERRIDE;
private:
- Compositor *m_compositor;
- InputDevice *m_inputDevice;
+ QWaylandCompositor *m_compositor;
+ QWaylandInputDevice *m_inputDevice;
DataSource *m_selectionSource;
struct ::wl_client *m_dragClient;
DataSource *m_dragDataSource;
- QWaylandSurfaceView *m_dragFocus;
+ QWaylandSurface *m_dragFocus;
Resource *m_dragFocusResource;
- QWaylandSurfaceView *m_dragIcon;
+ QWaylandSurface *m_dragIcon;
};
}
diff --git a/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp b/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp
index 2fe7ff4d7..3aa55ce18 100644
--- a/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp
+++ b/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp
@@ -3,36 +3,32 @@
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Compositor.
+** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
+** 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.LGPLv3 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.html.
**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
**
** $QT_END_LICENSE$
**
@@ -40,12 +36,13 @@
#include "qwldatadevicemanager_p.h"
+#include <QtWaylandCompositor/QWaylandCompositor>
+
+#include <QtWaylandCompositor/private/qwaylandcompositor_p.h>
+#include <QtWaylandCompositor/private/qwaylandinput_p.h>
#include "qwldatadevice_p.h"
#include "qwldatasource_p.h"
-#include "qwlinputdevice_p.h"
-#include "qwlcompositor_p.h"
#include "qwldataoffer_p.h"
-#include "qwlsurface_p.h"
#include "qwaylandmimehelper.h"
#include <QtCore/QDebug>
@@ -58,9 +55,9 @@ QT_BEGIN_NAMESPACE
namespace QtWayland {
-DataDeviceManager::DataDeviceManager(Compositor *compositor)
+DataDeviceManager::DataDeviceManager(QWaylandCompositor *compositor)
: QObject(0)
- , wl_data_device_manager(compositor->wl_display(), 1)
+ , wl_data_device_manager(compositor->display(), 1)
, m_compositor(compositor)
, m_current_selection_source(0)
, m_retainedReadNotifier(0)
@@ -108,7 +105,7 @@ void DataDeviceManager::retain()
QList<QString> offers = m_current_selection_source->mimeTypes();
finishReadFromClient();
if (m_retainedReadIndex >= offers.count()) {
- m_compositor->feedRetainedSelectionData(&m_retainedData);
+ QWaylandCompositorPrivate::get(m_compositor)->feedRetainedSelectionData(&m_retainedData);
return;
}
QString mimeType = offers.at(m_retainedReadIndex);
@@ -185,7 +182,7 @@ DataSource *DataDeviceManager::currentSelectionSource()
struct wl_display *DataDeviceManager::display() const
{
- return m_compositor->wl_display();
+ return m_compositor->display();
}
void DataDeviceManager::overrideSelection(const QMimeData &mimeData)
@@ -198,15 +195,15 @@ void DataDeviceManager::overrideSelection(const QMimeData &mimeData)
foreach (const QString &format, formats)
m_retainedData.setData(format, mimeData.data(format));
- m_compositor->feedRetainedSelectionData(&m_retainedData);
+ QWaylandCompositorPrivate::get(m_compositor)->feedRetainedSelectionData(&m_retainedData);
m_compositorOwnsSelection = true;
- InputDevice *dev = m_compositor->defaultInputDevice();
- Surface *focusSurface = dev->keyboardFocus();
+ QWaylandInputDevice *dev = m_compositor->defaultInputDevice();
+ QWaylandSurface *focusSurface = dev->keyboardFocus();
if (focusSurface)
offerFromCompositorToClient(
- dev->dataDevice()->resourceMap().value(focusSurface->resource()->client())->handle);
+ QWaylandInputDevicePrivate::get(dev)->dataDevice()->resourceMap().value(focusSurface->waylandClient())->handle);
}
bool DataDeviceManager::offerFromCompositorToClient(wl_resource *clientDataDeviceResource)
@@ -246,8 +243,8 @@ void DataDeviceManager::data_device_manager_create_data_source(Resource *resourc
void DataDeviceManager::data_device_manager_get_data_device(Resource *resource, uint32_t id, struct ::wl_resource *seat)
{
- InputDevice *input_device = InputDevice::fromSeatResource(seat);
- input_device->clientRequestedDataDevice(this, resource->client(), id);
+ QWaylandInputDevice *input_device = QWaylandInputDevice::fromSeatResource(seat);
+ QWaylandInputDevicePrivate::get(input_device)->clientRequestedDataDevice(this, resource->client(), id);
}
void DataDeviceManager::comp_accept(wl_client *, wl_resource *, uint32_t, const char *)
diff --git a/src/compositor/wayland_wrapper/qwldatadevicemanager_p.h b/src/compositor/wayland_wrapper/qwldatadevicemanager_p.h
index 90d226d77..8408db977 100644
--- a/src/compositor/wayland_wrapper/qwldatadevicemanager_p.h
+++ b/src/compositor/wayland_wrapper/qwldatadevicemanager_p.h
@@ -3,36 +3,32 @@
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Compositor.
+** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
+** 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.LGPLv3 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.html.
**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
**
** $QT_END_LICENSE$
**
@@ -52,14 +48,14 @@
// We mean it.
//
-#include <private/qwlcompositor_p.h>
-
#include <QtCore/QList>
#include <QtCore/QMap>
#include <QtGui/QClipboard>
#include <QtCore/QMimeData>
-#include <QtCompositor/private/qwayland-server-wayland.h>
+#include <QtWaylandCompositor/QWaylandCompositor>
+
+#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
QT_BEGIN_NAMESPACE
@@ -67,8 +63,6 @@ class QSocketNotifier;
namespace QtWayland {
-class Compositor;
-
class DataDevice;
class DataSource;
@@ -77,7 +71,7 @@ class DataDeviceManager : public QObject, public QtWaylandServer::wl_data_device
Q_OBJECT
public:
- DataDeviceManager(Compositor *compositor);
+ DataDeviceManager(QWaylandCompositor *compositor);
void setCurrentSelectionSource(DataSource *source);
DataSource *currentSelectionSource();
@@ -94,14 +88,14 @@ protected:
void data_device_manager_create_data_source(Resource *resource, uint32_t id) Q_DECL_OVERRIDE;
void data_device_manager_get_data_device(Resource *resource, uint32_t id, struct ::wl_resource *seat) Q_DECL_OVERRIDE;
-private slots:
+private Q_SLOTS:
void readFromClient(int fd);
private:
void retain();
void finishReadFromClient(bool exhausted = false);
- Compositor *m_compositor;
+ QWaylandCompositor *m_compositor;
QList<DataDevice *> m_data_device_list;
DataSource *m_current_selection_source;
diff --git a/src/compositor/wayland_wrapper/qwldataoffer.cpp b/src/compositor/wayland_wrapper/qwldataoffer.cpp
index 028e0bf86..c654b8a2f 100644
--- a/src/compositor/wayland_wrapper/qwldataoffer.cpp
+++ b/src/compositor/wayland_wrapper/qwldataoffer.cpp
@@ -3,36 +3,32 @@
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Compositor.
+** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
+** 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.LGPLv3 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.html.
**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/compositor/wayland_wrapper/qwldataoffer_p.h b/src/compositor/wayland_wrapper/qwldataoffer_p.h
index cc0faa34d..09ca87650 100644
--- a/src/compositor/wayland_wrapper/qwldataoffer_p.h
+++ b/src/compositor/wayland_wrapper/qwldataoffer_p.h
@@ -3,36 +3,32 @@
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Compositor.
+** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
+** 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.LGPLv3 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.html.
**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
**
** $QT_END_LICENSE$
**
@@ -53,7 +49,7 @@
//
#include <QPointer>
-#include <QtCompositor/private/qwayland-server-wayland.h>
+#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
QT_BEGIN_NAMESPACE
diff --git a/src/compositor/wayland_wrapper/qwldatasource.cpp b/src/compositor/wayland_wrapper/qwldatasource.cpp
index 0350ff649..aa2af1604 100644
--- a/src/compositor/wayland_wrapper/qwldatasource.cpp
+++ b/src/compositor/wayland_wrapper/qwldatasource.cpp
@@ -3,36 +3,32 @@
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Compositor.
+** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
+** 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.LGPLv3 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.html.
**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
**
** $QT_END_LICENSE$
**
@@ -42,10 +38,9 @@
#include "qwldataoffer_p.h"
#include "qwldatadevice_p.h"
#include "qwldatadevicemanager_p.h"
-#include "qwlcompositor_p.h"
#include <unistd.h>
-#include <QtCompositor/private/wayland-wayland-server-protocol.h>
+#include <QtWaylandCompositor/private/wayland-wayland-server-protocol.h>
QT_BEGIN_NAMESPACE
diff --git a/src/compositor/wayland_wrapper/qwldatasource_p.h b/src/compositor/wayland_wrapper/qwldatasource_p.h
index d4d10768b..4389b40fb 100644
--- a/src/compositor/wayland_wrapper/qwldatasource_p.h
+++ b/src/compositor/wayland_wrapper/qwldatasource_p.h
@@ -3,36 +3,32 @@
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Compositor.
+** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
+** 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.LGPLv3 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.html.
**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
**
** $QT_END_LICENSE$
**
@@ -52,7 +48,7 @@
// We mean it.
//
-#include <QtCompositor/private/qwayland-server-wayland.h>
+#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
#include <QObject>
#include <QtCore/QList>
diff --git a/src/compositor/wayland_wrapper/qwldisplay.cpp b/src/compositor/wayland_wrapper/qwldisplay.cpp
deleted file mode 100644
index fafde3f73..000000000
--- a/src/compositor/wayland_wrapper/qwldisplay.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwldisplay_p.h"
-
-#include <QtCore/QDebug>
-
-#include <QtCompositor/private/wayland-wayland-server-protocol.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWayland {
-
-Display::Display()
-{
- m_display = wl_display_create();
-
- Q_ASSERT(m_display);
-}
-
-Display::~Display()
-{
- wl_display_destroy(m_display);
-}
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/compositor/wayland_wrapper/qwldisplay_p.h b/src/compositor/wayland_wrapper/qwldisplay_p.h
deleted file mode 100644
index c89bb0509..000000000
--- a/src/compositor/wayland_wrapper/qwldisplay_p.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef WL_DISPLAY_H
-#define WL_DISPLAY_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 <wayland-server.h>
-#include <QtCompositor/qwaylandexport.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWayland {
-
-class Display
-{
-public:
- Display();
- ~Display();
-
- struct wl_display *handle() const { return m_display; }
- struct wl_display *handle() { return m_display; }
-
-private:
- struct wl_display *m_display;
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif //WL_DISPLAY_H
diff --git a/src/compositor/wayland_wrapper/qwlextendedsurface.cpp b/src/compositor/wayland_wrapper/qwlextendedsurface.cpp
deleted file mode 100644
index 50cc5bb7e..000000000
--- a/src/compositor/wayland_wrapper/qwlextendedsurface.cpp
+++ /dev/null
@@ -1,201 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwlextendedsurface_p.h"
-
-#include "qwlcompositor_p.h"
-#include "qwlsurface_p.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWayland {
-
-SurfaceExtensionGlobal::SurfaceExtensionGlobal(Compositor *compositor)
- : QtWaylandServer::qt_surface_extension(compositor->wl_display(), 1)
-{
-}
-
-void SurfaceExtensionGlobal::surface_extension_get_extended_surface(Resource *resource,
- uint32_t id,
- struct wl_resource *surface_resource)
-{
- Surface *surface = Surface::fromResource(surface_resource);
- new ExtendedSurface(resource->client(),id, wl_resource_get_version(resource->handle), surface);
-}
-
-ExtendedSurface::ExtendedSurface(struct wl_client *client, uint32_t id, int version, Surface *surface)
- : QWaylandSurfaceInterface(surface->waylandSurface())
- , QtWaylandServer::qt_extended_surface(client, id, version)
- , m_surface(surface)
- , m_windowFlags(0)
-{
- Q_ASSERT(surface->extendedSurface() == 0);
- surface->setExtendedSurface(this);
-}
-
-ExtendedSurface::~ExtendedSurface()
-{
- if (m_surface)
- m_surface->setExtendedSurface(0);
-}
-
-void ExtendedSurface::sendGenericProperty(const QString &name, const QVariant &variant)
-{
- QByteArray byteValue;
- QDataStream ds(&byteValue, QIODevice::WriteOnly);
- ds << variant;
- send_set_generic_property(name, byteValue);
-
-}
-
-void ExtendedSurface::setVisibility(QWindow::Visibility visibility)
-{
- // If this change came from the client, we shouldn't update it
- send_onscreen_visibility(visibility);
-}
-
-void ExtendedSurface::setParentSurface(Surface *surface)
-{
- m_surface = surface;
-}
-
-bool ExtendedSurface::runOperation(QWaylandSurfaceOp *op)
-{
- switch (op->type()) {
- case QWaylandSurfaceOp::Close:
- send_close();
- return true;
- case QWaylandSurfaceOp::SetVisibility:
- setVisibility(static_cast<QWaylandSurfaceSetVisibilityOp *>(op)->visibility());
- return true;
- default:
- break;
- }
- return false;
-}
-
-void ExtendedSurface::extended_surface_update_generic_property(Resource *resource,
- const QString &name,
- struct wl_array *value)
-{
- Q_UNUSED(resource);
- QVariant variantValue;
- QByteArray byteValue((const char*)value->data, value->size);
- QDataStream ds(&byteValue, QIODevice::ReadOnly);
- ds >> variantValue;
- setWindowProperty(name,variantValue,false);
-}
-
-Qt::ScreenOrientations ExtendedSurface::contentOrientationMask() const
-{
- return m_contentOrientationMask;
-}
-
-void ExtendedSurface::extended_surface_set_content_orientation_mask(Resource *resource, int32_t orientation)
-{
- Q_UNUSED(resource);
- Qt::ScreenOrientations mask = 0;
- if (orientation & QT_EXTENDED_SURFACE_ORIENTATION_PORTRAITORIENTATION)
- mask |= Qt::PortraitOrientation;
- if (orientation & QT_EXTENDED_SURFACE_ORIENTATION_LANDSCAPEORIENTATION)
- mask |= Qt::LandscapeOrientation;
- if (orientation & QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDPORTRAITORIENTATION)
- mask |= Qt::InvertedPortraitOrientation;
- if (orientation & QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDLANDSCAPEORIENTATION)
- mask |= Qt::InvertedLandscapeOrientation;
- if (orientation & QT_EXTENDED_SURFACE_ORIENTATION_PRIMARYORIENTATION)
- mask |= Qt::PrimaryOrientation;
-
- Qt::ScreenOrientations oldMask = m_contentOrientationMask;
- m_contentOrientationMask = mask;
-
- if (m_surface && mask != oldMask)
- emit m_surface->waylandSurface()->orientationUpdateMaskChanged();
-}
-
-QVariantMap ExtendedSurface::windowProperties() const
-{
- return m_windowProperties;
-}
-
-QVariant ExtendedSurface::windowProperty(const QString &propertyName) const
-{
- QVariantMap props = m_windowProperties;
- return props.value(propertyName);
-}
-
-void ExtendedSurface::setWindowProperty(const QString &name, const QVariant &value, bool writeUpdateToClient)
-{
- m_windowProperties.insert(name, value);
- m_surface->waylandSurface()->windowPropertyChanged(name,value);
- if (writeUpdateToClient)
- sendGenericProperty(name, value);
-}
-
-void ExtendedSurface::extended_surface_set_window_flags(Resource *resource, int32_t flags)
-{
- Q_UNUSED(resource);
- QWaylandSurface::WindowFlags windowFlags(flags);
- if (!m_surface || windowFlags == m_windowFlags)
- return;
- m_windowFlags = windowFlags;
- emit m_surface->waylandSurface()->windowFlagsChanged(windowFlags);
-}
-
-void ExtendedSurface::extended_surface_destroy_resource(Resource *)
-{
- delete this;
-}
-
-void ExtendedSurface::extended_surface_raise(Resource *)
-{
- if (m_surface)
- emit m_surface->waylandSurface()->raiseRequested();
-}
-
-void ExtendedSurface::extended_surface_lower(Resource *)
-{
- if (m_surface)
- emit m_surface->waylandSurface()->lowerRequested();
-}
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/compositor/wayland_wrapper/qwlextendedsurface_p.h b/src/compositor/wayland_wrapper/qwlextendedsurface_p.h
deleted file mode 100644
index 88c801067..000000000
--- a/src/compositor/wayland_wrapper/qwlextendedsurface_p.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef WLEXTENDEDSURFACE_H
-#define WLEXTENDEDSURFACE_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 <wayland-server.h>
-
-#include <QtCompositor/private/qwayland-server-surface-extension.h>
-#include <private/qwlsurface_p.h>
-#include <QtCompositor/qwaylandsurface.h>
-#include <QtCompositor/qwaylandsurfaceinterface.h>
-
-#include <QtCore/QVariant>
-#include <QtCore/QLinkedList>
-#include <QtGui/QWindow>
-
-QT_BEGIN_NAMESPACE
-
-class QWaylandSurface;
-
-namespace QtWayland {
-
-class Compositor;
-
-class SurfaceExtensionGlobal : public QtWaylandServer::qt_surface_extension
-{
-public:
- SurfaceExtensionGlobal(Compositor *compositor);
-
-private:
- void surface_extension_get_extended_surface(Resource *resource,
- uint32_t id,
- struct wl_resource *surface);
-
-};
-
-class ExtendedSurface : public QWaylandSurfaceInterface, public QtWaylandServer::qt_extended_surface
-{
-public:
- ExtendedSurface(struct wl_client *client, uint32_t id, int version, Surface *surface);
- ~ExtendedSurface();
-
- void sendGenericProperty(const QString &name, const QVariant &variant);
-
- void setVisibility(QWindow::Visibility visibility);
-
- void setSubSurface(ExtendedSurface *subSurface,int x, int y);
- void removeSubSurface(ExtendedSurface *subSurfaces);
- ExtendedSurface *parent() const;
- void setParent(ExtendedSurface *parent);
- QLinkedList<QWaylandSurface *> subSurfaces() const;
- void setParentSurface(Surface *s);
-
- Qt::ScreenOrientations contentOrientationMask() const;
-
- QWaylandSurface::WindowFlags windowFlags() const { return m_windowFlags; }
-
- QVariantMap windowProperties() const;
- QVariant windowProperty(const QString &propertyName) const;
- void setWindowProperty(const QString &name, const QVariant &value, bool writeUpdateToClient = true);
-
-protected:
- bool runOperation(QWaylandSurfaceOp *op) Q_DECL_OVERRIDE;
-
-private:
- Surface *m_surface;
-
- Qt::ScreenOrientations m_contentOrientationMask;
-
- QWaylandSurface::WindowFlags m_windowFlags;
-
- QByteArray m_authenticationToken;
- QVariantMap m_windowProperties;
-
- void extended_surface_update_generic_property(Resource *resource,
- const QString &name,
- struct wl_array *value) Q_DECL_OVERRIDE;
-
- void extended_surface_set_content_orientation_mask(Resource *resource,
- int32_t orientation) Q_DECL_OVERRIDE;
-
- void extended_surface_set_window_flags(Resource *resource,
- int32_t flags) Q_DECL_OVERRIDE;
-
- void extended_surface_destroy_resource(Resource *) Q_DECL_OVERRIDE;
- void extended_surface_raise(Resource *) Q_DECL_OVERRIDE;
- void extended_surface_lower(Resource *) Q_DECL_OVERRIDE;
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif // WLEXTENDEDSURFACE_H
diff --git a/src/compositor/wayland_wrapper/qwlinputdevice.cpp b/src/compositor/wayland_wrapper/qwlinputdevice.cpp
deleted file mode 100644
index ea127ee74..000000000
--- a/src/compositor/wayland_wrapper/qwlinputdevice.cpp
+++ /dev/null
@@ -1,365 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwlinputdevice_p.h"
-
-#include "qwlcompositor_p.h"
-#include "qwldatadevice_p.h"
-#include "qwlinputmethod_p.h"
-#include "qwlsurface_p.h"
-#include "qwlqttouch_p.h"
-#include "qwlqtkey_p.h"
-#include "qwaylandcompositor.h"
-#include "qwaylanddrag.h"
-#include "qwlpointer_p.h"
-#include "qwlkeyboard_p.h"
-#include "qwltouch_p.h"
-#include "qwaylandsurfaceview.h"
-
-#include <QtGui/QTouchEvent>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWayland {
-
-InputDevice::InputDevice(QWaylandInputDevice *handle, Compositor *compositor, QWaylandInputDevice::CapabilityFlags caps)
- : QtWaylandServer::wl_seat(compositor->wl_display(), 3)
- , m_handle(handle)
- , m_dragHandle(new QWaylandDrag(this))
- , m_compositor(compositor)
- , m_capabilities(caps)
- , m_pointer(m_capabilities & QWaylandInputDevice::Pointer ? new Pointer(m_compositor, this) : 0)
- , m_keyboard(m_capabilities & QWaylandInputDevice::Keyboard ? new Keyboard(m_compositor, this) : 0)
- , m_touch(m_capabilities & QWaylandInputDevice::Touch ? new Touch(m_compositor) : 0)
- , m_inputMethod(m_compositor->extensions() & QWaylandCompositor::TextInputExtension ? new InputMethod(m_compositor, this) : 0)
- , m_data_device()
-{
-}
-
-InputDevice::~InputDevice()
-{
-}
-
-Pointer *InputDevice::pointerDevice()
-{
- return m_pointer.data();
-}
-
-Keyboard *InputDevice::keyboardDevice()
-{
- return m_keyboard.data();
-}
-
-Touch *InputDevice::touchDevice()
-{
- return m_touch.data();
-}
-
-InputMethod *InputDevice::inputMethod()
-{
- return m_inputMethod.data();
-}
-
-const Pointer *InputDevice::pointerDevice() const
-{
- return m_pointer.data();
-}
-
-const Keyboard *InputDevice::keyboardDevice() const
-{
- return m_keyboard.data();
-}
-
-const Touch *InputDevice::touchDevice() const
-{
- return m_touch.data();
-}
-
-void InputDevice::seat_destroy_resource(wl_seat::Resource *)
-{
-// cleanupDataDeviceForClient(resource->client(), true);
-}
-
-void InputDevice::seat_bind_resource(wl_seat::Resource *resource)
-{
- // The order of m_capabilities matches the order defined in the wayland protocol
- wl_seat::send_capabilities(resource->handle, (uint32_t)m_capabilities);
-}
-
-void InputDevice::setCapabilities(QWaylandInputDevice::CapabilityFlags caps)
-{
- if (m_capabilities != caps) {
- QWaylandInputDevice::CapabilityFlags changed = caps ^ m_capabilities;
-
- if (changed & QWaylandInputDevice::Pointer) {
- m_pointer.reset(m_pointer.isNull() ? new Pointer(m_compositor, this) : 0);
- }
-
- if (changed & QWaylandInputDevice::Keyboard) {
- m_keyboard.reset(m_keyboard.isNull() ? new Keyboard(m_compositor, this) : 0);
- }
-
- if (changed & QWaylandInputDevice::Touch) {
- m_touch.reset(m_touch.isNull() ? new Touch(m_compositor) : 0);
- }
-
- m_capabilities = caps;
- QList<Resource *> resources = resourceMap().values();
- for (int i = 0; i < resources.size(); i++) {
- wl_seat::send_capabilities(resources.at(i)->handle, (uint32_t)m_capabilities);
- }
- }
-}
-
-void InputDevice::seat_get_pointer(wl_seat::Resource *resource, uint32_t id)
-{
- if (!m_pointer.isNull()) {
- m_pointer->add(resource->client(), id, resource->version());
- }
-}
-
-void InputDevice::seat_get_keyboard(wl_seat::Resource *resource, uint32_t id)
-{
- if (!m_keyboard.isNull()) {
- m_keyboard->add(resource->client(), id, resource->version());
- }
-}
-
-void InputDevice::seat_get_touch(wl_seat::Resource *resource, uint32_t id)
-{
- if (!m_touch.isNull()) {
- m_touch->add(resource->client(), id, resource->version());
- }
-}
-
-void InputDevice::sendMousePressEvent(Qt::MouseButton button, const QPointF &localPos, const QPointF &globalPos)
-{
- pointerDevice()->sendMousePressEvent(button, localPos, globalPos);
-}
-
-void InputDevice::sendMouseReleaseEvent(Qt::MouseButton button, const QPointF &localPos, const QPointF &globalPos)
-{
- pointerDevice()->sendMouseReleaseEvent(button, localPos, globalPos);
-}
-
-void InputDevice::sendMouseMoveEvent(const QPointF &localPos, const QPointF &globalPos)
-{
- pointerDevice()->sendMouseMoveEvent(localPos, globalPos);
-}
-
-void InputDevice::sendMouseMoveEvent(QWaylandSurfaceView *surface, const QPointF &localPos, const QPointF &globalPos)
-{
- setMouseFocus(surface,localPos,globalPos);
- sendMouseMoveEvent(localPos,globalPos);
-}
-
-void InputDevice::sendMouseWheelEvent(Qt::Orientation orientation, int delta)
-{
- pointerDevice()->sendMouseWheelEvent(orientation, delta);
-}
-
-void InputDevice::sendTouchPointEvent(int id, double x, double y, Qt::TouchPointState state)
-{
- if (m_touch.isNull()) {
- return;
- }
-
- switch (state) {
- case Qt::TouchPointPressed:
- m_touch->sendDown(id, QPointF(x, y));
- break;
- case Qt::TouchPointMoved:
- m_touch->sendMotion(id, QPointF(x, y));
- break;
- case Qt::TouchPointReleased:
- m_touch->sendUp(id);
- break;
- case Qt::TouchPointStationary:
- // stationary points are not sent through wayland, the client must cache them
- break;
- default:
- break;
- }
-}
-
-void InputDevice::sendTouchFrameEvent()
-{
- if (!m_touch.isNull()) {
- m_touch->sendFrame();
- }
-}
-
-void InputDevice::sendTouchCancelEvent()
-{
- if (!m_touch.isNull()) {
- m_touch->sendCancel();
- }
-}
-
-void InputDevice::sendFullKeyEvent(QKeyEvent *event)
-{
- if (!keyboardFocus()) {
- qWarning("Cannot send key event, no keyboard focus, fix the compositor");
- return;
- }
-
- QtKeyExtensionGlobal *ext = m_compositor->qtkeyExtension();
- if (ext && ext->postQtKeyEvent(event, keyboardFocus()))
- return;
-
- if (!m_keyboard.isNull() && !event->isAutoRepeat()) {
- if (event->type() == QEvent::KeyPress)
- m_keyboard->sendKeyPressEvent(event->nativeScanCode());
- else if (event->type() == QEvent::KeyRelease)
- m_keyboard->sendKeyReleaseEvent(event->nativeScanCode());
- }
-}
-
-void InputDevice::sendFullKeyEvent(Surface *surface, QKeyEvent *event)
-{
- QtKeyExtensionGlobal *ext = m_compositor->qtkeyExtension();
- if (ext)
- ext->postQtKeyEvent(event, surface);
-}
-
-void InputDevice::sendFullTouchEvent(QTouchEvent *event)
-{
- if (!mouseFocus()) {
- qWarning("Cannot send touch event, no pointer focus, fix the compositor");
- return;
- }
-
- if (event->type() == QEvent::TouchCancel) {
- sendTouchCancelEvent();
- return;
- }
-
- TouchExtensionGlobal *ext = m_compositor->touchExtension();
- if (ext && ext->postTouchEvent(event, mouseFocus()))
- return;
-
- const QList<QTouchEvent::TouchPoint> points = event->touchPoints();
- if (points.isEmpty())
- return;
-
- const int pointCount = points.count();
- QPointF pos = mouseFocus()->pos();
- for (int i = 0; i < pointCount; ++i) {
- const QTouchEvent::TouchPoint &tp(points.at(i));
- // Convert the local pos in the compositor window to surface-relative.
- QPointF p = tp.pos() - pos;
- sendTouchPointEvent(tp.id(), p.x(), p.y(), tp.state());
- }
- sendTouchFrameEvent();
-}
-
-Surface *InputDevice::keyboardFocus() const
-{
- return m_keyboard.isNull() ? 0 : m_keyboard->focus();
-}
-
-/*!
- * \return True if the keyboard focus is changed successfully. False for inactive transient surfaces.
- */
-bool InputDevice::setKeyboardFocus(Surface *surface)
-{
- if (surface && (surface->transientInactive() || surface->isDestroyed()))
- return false;
-
- if (!m_keyboard.isNull()) {
- m_keyboard->setFocus(surface);
- if (m_data_device)
- m_data_device->setFocus(m_keyboard->focusResource());
- return true;
- }
- return false;
-}
-
-QWaylandSurfaceView *InputDevice::mouseFocus() const
-{
- return m_pointer.isNull() ? 0 : m_pointer->focusSurface();
-}
-
-void InputDevice::setMouseFocus(QWaylandSurfaceView *view, const QPointF &localPos, const QPointF &globalPos)
-{
- if (view && view->surface()->handle()->isDestroyed())
- return;
-
- if (!m_pointer.isNull()) {
- m_pointer->setMouseFocus(view, localPos, globalPos);
- }
-
- if (!m_touch.isNull()) {
- // We have no separate touch focus management so make it match the pointer focus always.
- // No wl_touch_set_focus() is available so set it manually.
- m_touch->setFocus(view);
- }
-}
-
-void InputDevice::clientRequestedDataDevice(DataDeviceManager *, struct wl_client *client, uint32_t id)
-{
- if (!m_data_device)
- m_data_device.reset(new DataDevice(this));
- m_data_device->add(client, id, 1);
-}
-
-Compositor *InputDevice::compositor() const
-{
- return m_compositor;
-}
-
-QWaylandInputDevice *InputDevice::handle() const
-{
- return m_handle;
-}
-
-QWaylandDrag *InputDevice::dragHandle() const
-{
- return m_dragHandle.data();
-}
-
-const DataDevice *InputDevice::dataDevice() const
-{
- return m_data_device.data();
-}
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/compositor/wayland_wrapper/qwlinputdevice_p.h b/src/compositor/wayland_wrapper/qwlinputdevice_p.h
deleted file mode 100644
index f28946a9b..000000000
--- a/src/compositor/wayland_wrapper/qwlinputdevice_p.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef WLINPUTDEVICE_H
-#define WLINPUTDEVICE_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 <stdint.h>
-
-#include <QtCompositor/qwaylandexport.h>
-#include <QtCompositor/qwaylandinput.h>
-
-#include <QtCore/QList>
-#include <QtCore/QPoint>
-#include <QtCore/QScopedPointer>
-
-#ifndef QT_NO_WAYLAND_XKB
-#include <xkbcommon/xkbcommon.h>
-#endif
-
-#include <QtCompositor/private/qwayland-server-wayland.h>
-
-QT_BEGIN_NAMESPACE
-
-class QKeyEvent;
-class QTouchEvent;
-class QWaylandInputDevice;
-class QWaylandDrag;
-class QWaylandSurfaceView;
-
-namespace QtWayland {
-
-class Compositor;
-class DataDevice;
-class Surface;
-class DataDeviceManager;
-class Pointer;
-class Keyboard;
-class Touch;
-class InputMethod;
-
-class Q_COMPOSITOR_EXPORT InputDevice : public QtWaylandServer::wl_seat
-{
-public:
- InputDevice(QWaylandInputDevice *handle, Compositor *compositor, QWaylandInputDevice::CapabilityFlags caps);
- ~InputDevice();
-
- void sendMousePressEvent(Qt::MouseButton button, const QPointF &localPos, const QPointF &globalPos = QPointF());
- void sendMouseReleaseEvent(Qt::MouseButton button, const QPointF &localPos, const QPointF &globalPos = QPointF());
- void sendMouseMoveEvent(const QPointF &localPos, const QPointF &globalPos = QPointF());
- void sendMouseMoveEvent(QWaylandSurfaceView *surface, const QPointF &localPos, const QPointF &globalPos = QPointF());
- void sendMouseWheelEvent(Qt::Orientation orientation, int delta);
-
- void sendTouchPointEvent(int id, double x, double y, Qt::TouchPointState state);
- void sendTouchFrameEvent();
- void sendTouchCancelEvent();
-
- void sendFullKeyEvent(QKeyEvent *event);
- void sendFullKeyEvent(Surface *surface, QKeyEvent *event);
-
- void sendFullTouchEvent(QTouchEvent *event);
-
- Surface *keyboardFocus() const;
- bool setKeyboardFocus(Surface *surface);
-
- QWaylandSurfaceView *mouseFocus() const;
- void setMouseFocus(QWaylandSurfaceView *surface, const QPointF &localPos, const QPointF &globalPos);
-
- void clientRequestedDataDevice(DataDeviceManager *dndSelection, struct wl_client *client, uint32_t id);
- const DataDevice *dataDevice() const;
-
- Compositor *compositor() const;
- QWaylandInputDevice *handle() const;
- QWaylandDrag *dragHandle() const;
-
- Pointer *pointerDevice();
- Keyboard *keyboardDevice();
- Touch *touchDevice();
- InputMethod *inputMethod();
-
- const Pointer *pointerDevice() const;
- const Keyboard *keyboardDevice() const;
- const Touch *touchDevice() const;
-
- static InputDevice *fromSeatResource(struct ::wl_resource *resource)
- {
- return static_cast<InputDevice *>(wl_seat::Resource::fromResource(resource)->seat_object);
- }
-
- QWaylandInputDevice::CapabilityFlags capabilities() { return m_capabilities; }
- void setCapabilities(QWaylandInputDevice::CapabilityFlags caps);
-
-private:
- QWaylandInputDevice *m_handle;
- QScopedPointer<QWaylandDrag> m_dragHandle;
- Compositor *m_compositor;
- QWaylandInputDevice::CapabilityFlags m_capabilities;
-
- QScopedPointer<Pointer> m_pointer;
- QScopedPointer<Keyboard> m_keyboard;
- QScopedPointer<Touch> m_touch;
- QScopedPointer<InputMethod> m_inputMethod;
- QScopedPointer<DataDevice> m_data_device;
-
- void seat_bind_resource(wl_seat::Resource *resource) Q_DECL_OVERRIDE;
-
- void seat_get_pointer(wl_seat::Resource *resource,
- uint32_t id) Q_DECL_OVERRIDE;
- void seat_get_keyboard(wl_seat::Resource *resource,
- uint32_t id) Q_DECL_OVERRIDE;
- void seat_get_touch(wl_seat::Resource *resource,
- uint32_t id) Q_DECL_OVERRIDE;
-
- void seat_destroy_resource(wl_seat::Resource *resource) Q_DECL_OVERRIDE;
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif // WLINPUTDEVICE_H
diff --git a/src/compositor/wayland_wrapper/qwlinputmethod.cpp b/src/compositor/wayland_wrapper/qwlinputmethod.cpp
deleted file mode 100644
index 5bafe7894..000000000
--- a/src/compositor/wayland_wrapper/qwlinputmethod.cpp
+++ /dev/null
@@ -1,150 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwlinputmethod_p.h"
-
-#include "qwlcompositor_p.h"
-#include "qwlinputdevice_p.h"
-#include "qwlinputmethodcontext_p.h"
-#include "qwlinputpanel_p.h"
-#include "qwlkeyboard_p.h"
-#include "qwltextinput_p.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWayland {
-
-InputMethod::InputMethod(Compositor *compositor, InputDevice *seat)
- : QtWaylandServer::wl_input_method(seat->compositor()->wl_display(), 1)
- , m_compositor(compositor)
- , m_seat(seat)
- , m_resource(0)
- , m_textInput()
- , m_context()
-{
- connect(seat->keyboardDevice(), SIGNAL(focusChanged(Surface*)), this, SLOT(focusChanged(Surface*)));
-}
-
-InputMethod::~InputMethod()
-{
-}
-
-void InputMethod::activate(TextInput *textInput)
-{
- if (!m_resource) {
- qDebug("Cannot activate (no input method running).");
- return;
- }
-
- if (m_textInput) {
- Q_ASSERT(m_textInput != textInput);
- m_textInput->deactivate(this);
- }
- m_textInput = textInput;
- m_context = new InputMethodContext(m_resource->client(), textInput);
-
- send_activate(m_resource->handle, m_context->resource()->handle);
-
- m_compositor->inputPanel()->setFocus(textInput->focus());
- m_compositor->inputPanel()->setCursorRectangle(textInput->cursorRectangle());
- m_compositor->inputPanel()->setInputPanelVisible(textInput->inputPanelVisible());
-}
-
-void InputMethod::deactivate()
-{
- if (!m_resource) {
- qDebug("Cannot deactivate (no input method running).");
- return;
- }
-
- send_deactivate(m_resource->handle, m_context->resource()->handle);
- m_textInput = 0;
- m_context = 0;
-
- m_compositor->inputPanel()->setFocus(0);
- m_compositor->inputPanel()->setCursorRectangle(QRect());
- m_compositor->inputPanel()->setInputPanelVisible(false);
-}
-
-void InputMethod::focusChanged(Surface *surface)
-{
- if (!m_textInput)
- return;
-
- if (!surface || m_textInput->focus() != surface) {
- m_textInput->deactivate(this);
- }
-}
-
-bool InputMethod::isBound() const
-{
- return m_resource != 0;
-}
-
-InputMethodContext *InputMethod::context() const
-{
- return m_context;
-}
-
-TextInput *InputMethod::textInput() const
-{
- return m_textInput;
-}
-
-void InputMethod::input_method_bind_resource(Resource *resource)
-{
- if (m_resource) {
- wl_resource_post_error(resource->handle, WL_DISPLAY_ERROR_INVALID_OBJECT, "interface object already bound");
- wl_resource_destroy(resource->handle);
- return;
- }
-
- m_resource = resource;
-}
-
-void InputMethod::input_method_destroy_resource(Resource *resource)
-{
- Q_ASSERT(resource == m_resource);
- m_resource = 0;
-}
-
-} // namespace QtWayland
-
-QT_END_NAMESPACE
diff --git a/src/compositor/wayland_wrapper/qwlinputmethod_p.h b/src/compositor/wayland_wrapper/qwlinputmethod_p.h
deleted file mode 100644
index f52208a9c..000000000
--- a/src/compositor/wayland_wrapper/qwlinputmethod_p.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QTWAYLAND_QWLINPUTMETHOD_H
-#define QTWAYLAND_QWLINPUTMETHOD_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 <QtCompositor/private/qwayland-server-input-method.h>
-
-#include <QObject>
-#include <QScopedPointer>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWayland {
-
-class Compositor;
-class InputDevice;
-class InputMethodContext;
-class TextInput;
-class Surface;
-
-class InputMethod : public QObject, public QtWaylandServer::wl_input_method
-{
- Q_OBJECT
-
-public:
- explicit InputMethod(Compositor *compositor, InputDevice *seat);
- ~InputMethod();
-
- void activate(TextInput *textInput);
- void deactivate();
-
- bool isBound() const;
-
- InputMethodContext *context() const;
- TextInput *textInput() const;
-
-protected:
- void input_method_bind_resource(Resource *resource);
- void input_method_destroy_resource(Resource *resource);
-
-private slots:
- void focusChanged(Surface *surface);
-
-private:
- Compositor *m_compositor;
- InputDevice *m_seat;
- Resource *m_resource;
- TextInput *m_textInput;
- InputMethodContext *m_context;
-};
-
-} // namespace QtWayland
-
-QT_END_NAMESPACE
-
-#endif // QTWAYLAND_QWLINPUTMETHOD_H
diff --git a/src/compositor/wayland_wrapper/qwlinputmethodcontext.cpp b/src/compositor/wayland_wrapper/qwlinputmethodcontext.cpp
deleted file mode 100644
index caf75b2ae..000000000
--- a/src/compositor/wayland_wrapper/qwlinputmethodcontext.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwlinputmethodcontext_p.h"
-
-#include "qwltextinput_p.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWayland {
-
-InputMethodContext::InputMethodContext(wl_client *client, TextInput *textInput)
- : QtWaylandServer::wl_input_method_context(client, 0, 1)
- , m_textInput(textInput)
-{
-}
-
-InputMethodContext::~InputMethodContext()
-{
-}
-
-void InputMethodContext::input_method_context_destroy_resource(Resource *)
-{
- delete this;
-}
-
-void InputMethodContext::input_method_context_destroy(Resource *resource)
-{
- wl_resource_destroy(resource->handle);
-}
-
-void InputMethodContext::input_method_context_commit_string(Resource *, uint32_t serial, const QString &text)
-{
- m_textInput->send_commit_string(serial, text);
-}
-
-void InputMethodContext::input_method_context_cursor_position(Resource *, int32_t index, int32_t anchor)
-{
- m_textInput->send_cursor_position(index, anchor);
-}
-
-void InputMethodContext::input_method_context_delete_surrounding_text(Resource *, int32_t index, uint32_t length)
-{
- m_textInput->send_delete_surrounding_text(index, length);
-}
-
-void InputMethodContext::input_method_context_language(Resource *, uint32_t serial, const QString &language)
-{
- m_textInput->send_language(serial, language);
-}
-
-void InputMethodContext::input_method_context_keysym(Resource *, uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers)
-{
- m_textInput->send_keysym(serial, time, sym, state, modifiers);
-}
-
-void InputMethodContext::input_method_context_modifiers_map(Resource *, wl_array *map)
-{
- QByteArray modifiersArray(static_cast<char *>(map->data), map->size);
- m_textInput->send_modifiers_map(modifiersArray);
-}
-
-void InputMethodContext::input_method_context_preedit_cursor(Resource *, int32_t index)
-{
- m_textInput->send_preedit_cursor(index);
-}
-
-void InputMethodContext::input_method_context_preedit_string(Resource *, uint32_t serial, const QString &text, const QString &commit)
-{
- m_textInput->send_preedit_string(serial, text, commit);
-}
-
-void InputMethodContext::input_method_context_preedit_styling(Resource *, uint32_t index, uint32_t length, uint32_t style)
-{
- m_textInput->send_preedit_styling(index, length, style);
-}
-
-void InputMethodContext::input_method_context_grab_keyboard(Resource *, uint32_t keyboard)
-{
- Q_UNUSED(keyboard);
-}
-
-void InputMethodContext::input_method_context_key(Resource *, uint32_t serial, uint32_t time, uint32_t key, uint32_t state)
-{
- Q_UNUSED(serial);
- Q_UNUSED(time);
- Q_UNUSED(key);
- Q_UNUSED(state);
-}
-
-void InputMethodContext::input_method_context_modifiers(Resource *, uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group)
-{
- Q_UNUSED(serial);
- Q_UNUSED(mods_depressed);
- Q_UNUSED(mods_latched);
- Q_UNUSED(mods_locked);
- Q_UNUSED(group);
-}
-
-} // namespace QtWayland
-
-QT_END_NAMESPACE
diff --git a/src/compositor/wayland_wrapper/qwlinputmethodcontext_p.h b/src/compositor/wayland_wrapper/qwlinputmethodcontext_p.h
deleted file mode 100644
index ccf236e61..000000000
--- a/src/compositor/wayland_wrapper/qwlinputmethodcontext_p.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QTWAYLAND_QWLINPUTMETHODCONTEXT_P_H
-#define QTWAYLAND_QWLINPUTMETHODCONTEXT_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 <QtCompositor/private/qwayland-server-input-method.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWayland {
-
-class TextInput;
-
-class InputMethodContext : public QtWaylandServer::wl_input_method_context
-{
-public:
- explicit InputMethodContext(struct ::wl_client *client, TextInput *textInput);
- ~InputMethodContext();
-
-protected:
- void input_method_context_destroy_resource(Resource *resource) Q_DECL_OVERRIDE;
- void input_method_context_destroy(Resource *resource) Q_DECL_OVERRIDE;
-
- void input_method_context_commit_string(Resource *resource, uint32_t serial, const QString &text) Q_DECL_OVERRIDE;
- void input_method_context_cursor_position(Resource *resource, int32_t index, int32_t anchor) Q_DECL_OVERRIDE;
- void input_method_context_delete_surrounding_text(Resource *resource, int32_t index, uint32_t length) Q_DECL_OVERRIDE;
- void input_method_context_language(Resource *resource, uint32_t serial, const QString &language) Q_DECL_OVERRIDE;
- void input_method_context_keysym(Resource *resource, uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers) Q_DECL_OVERRIDE;
- void input_method_context_modifiers_map(Resource *resource, wl_array *map) Q_DECL_OVERRIDE;
- void input_method_context_preedit_cursor(Resource *resource, int32_t index) Q_DECL_OVERRIDE;
- void input_method_context_preedit_string(Resource *resource, uint32_t serial, const QString &text, const QString &commit) Q_DECL_OVERRIDE;
- void input_method_context_preedit_styling(Resource *resource, uint32_t index, uint32_t length, uint32_t style) Q_DECL_OVERRIDE;
- void input_method_context_grab_keyboard(Resource *resource, uint32_t keyboard) Q_DECL_OVERRIDE;
- void input_method_context_key(Resource *resource, uint32_t serial, uint32_t time, uint32_t key, uint32_t state) Q_DECL_OVERRIDE;
- void input_method_context_modifiers(Resource *resource, uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group) Q_DECL_OVERRIDE;
-
-private:
- TextInput *m_textInput;
-};
-
-} // namespace QtWayland
-
-QT_END_NAMESPACE
-
-#endif // QTWAYLAND_QWLINPUTMETHODCONTEXT_P_H
diff --git a/src/compositor/wayland_wrapper/qwlinputpanel.cpp b/src/compositor/wayland_wrapper/qwlinputpanel.cpp
deleted file mode 100644
index 2f11a9b3f..000000000
--- a/src/compositor/wayland_wrapper/qwlinputpanel.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwlinputpanel_p.h"
-
-#include <QtCompositor/qwaylandinputpanel.h>
-
-#include "qwlcompositor_p.h"
-#include "qwlinputdevice_p.h"
-#include "qwlinputmethod_p.h"
-#include "qwlinputpanelsurface_p.h"
-#include "qwlsurface_p.h"
-#include "qwltextinput_p.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWayland {
-
-InputPanel::InputPanel(Compositor *compositor)
- : QtWaylandServer::wl_input_panel(compositor->wl_display(), 1)
- , m_compositor(compositor)
- , m_handle(new QWaylandInputPanel(this))
- , m_focus()
- , m_inputPanelVisible(false)
- , m_cursorRectangle()
-{
-}
-
-InputPanel::~InputPanel()
-{
-}
-
-QWaylandInputPanel *InputPanel::handle() const
-{
- return m_handle.data();
-}
-
-Surface *InputPanel::focus() const
-{
- return m_focus;
-}
-
-void InputPanel::setFocus(Surface *focus)
-{
- if (m_focus == focus)
- return;
-
- m_focus = focus;
-
- Q_EMIT handle()->focusChanged();
-}
-
-bool InputPanel::inputPanelVisible() const
-{
- return m_inputPanelVisible;
-}
-
-void InputPanel::setInputPanelVisible(bool inputPanelVisible)
-{
- if (m_inputPanelVisible == inputPanelVisible)
- return;
-
- m_inputPanelVisible = inputPanelVisible;
-
- Q_EMIT handle()->visibleChanged();
-}
-
-QRect InputPanel::cursorRectangle() const
-{
- return m_cursorRectangle;
-}
-
-void InputPanel::setCursorRectangle(const QRect &cursorRectangle)
-{
- if (m_cursorRectangle == cursorRectangle)
- return;
-
- m_cursorRectangle = cursorRectangle;
-
- Q_EMIT handle()->cursorRectangleChanged();
-}
-
-void InputPanel::input_panel_get_input_panel_surface(Resource *resource, uint32_t id, wl_resource *surface)
-{
- new InputPanelSurface(resource->client(), id, Surface::fromResource(surface));
-}
-
-} // namespace QtWayland
-
-QT_END_NAMESPACE
diff --git a/src/compositor/wayland_wrapper/qwlinputpanel_p.h b/src/compositor/wayland_wrapper/qwlinputpanel_p.h
deleted file mode 100644
index f8880ad4a..000000000
--- a/src/compositor/wayland_wrapper/qwlinputpanel_p.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QTWAYLAND_QWLINPUTPANEL_P_H
-#define QTWAYLAND_QWLINPUTPANEL_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 <QtCompositor/qwaylandexport.h>
-
-#include <QtCompositor/private/qwayland-server-input-method.h>
-
-#include <QRect>
-#include <QScopedPointer>
-
-QT_BEGIN_NAMESPACE
-
-class QWaylandInputPanel;
-
-namespace QtWayland {
-
-class Compositor;
-class Surface;
-class TextInput;
-
-class Q_COMPOSITOR_EXPORT InputPanel : public QtWaylandServer::wl_input_panel
-{
-public:
- InputPanel(Compositor *compositor);
- ~InputPanel();
-
- QWaylandInputPanel *handle() const;
-
- Surface *focus() const;
- void setFocus(Surface *focus);
-
- bool inputPanelVisible() const;
- void setInputPanelVisible(bool inputPanelVisible);
-
- QRect cursorRectangle() const;
- void setCursorRectangle(const QRect &cursorRectangle);
-
-protected:
- void input_panel_get_input_panel_surface(Resource *resource, uint32_t id, struct ::wl_resource *surface) Q_DECL_OVERRIDE;
-
-private:
- Compositor *m_compositor;
- QScopedPointer<QWaylandInputPanel> m_handle;
-
- Surface *m_focus;
- bool m_inputPanelVisible;
- QRect m_cursorRectangle;
-};
-
-} // namespace QtWayland
-
-QT_END_NAMESPACE
-
-#endif // QTWAYLAND_QWLINPUTPANEL_P_H
diff --git a/src/compositor/wayland_wrapper/qwlinputpanelsurface.cpp b/src/compositor/wayland_wrapper/qwlinputpanelsurface.cpp
deleted file mode 100644
index fdaf895ef..000000000
--- a/src/compositor/wayland_wrapper/qwlinputpanelsurface.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwlinputpanelsurface_p.h"
-
-#include "qwloutput_p.h"
-#include "qwlsurface_p.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWayland {
-
-InputPanelSurface::InputPanelSurface(wl_client *client, int id, Surface *surface)
- : QtWaylandServer::wl_input_panel_surface(client, id, 1)
- , m_surface(surface)
- , m_type(Invalid)
- , m_output(0)
- , m_position()
-{
- surface->setInputPanelSurface(this);
-}
-
-InputPanelSurface::Type InputPanelSurface::type() const
-{
- return m_type;
-}
-
-Output *InputPanelSurface::output() const
-{
- return m_output;
-}
-
-QtWaylandServer::wl_input_panel_surface::position InputPanelSurface::position() const
-{
- return m_position;
-}
-
-void InputPanelSurface::input_panel_surface_set_overlay_panel(Resource *)
-{
- m_type = OverlayPanel;
-}
-
-void InputPanelSurface::input_panel_surface_set_toplevel(Resource *, wl_resource *output_resource, uint32_t position)
-{
- m_type = Toplevel;
- OutputResource *output = static_cast<OutputResource *>(Output::Resource::fromResource(output_resource));
- m_output = static_cast<Output *>(output->output_object);
- m_position = static_cast<wl_input_panel_surface::position>(position);
-}
-
-QT_END_NAMESPACE
-
-} // namespace QtWayland
diff --git a/src/compositor/wayland_wrapper/qwlinputpanelsurface_p.h b/src/compositor/wayland_wrapper/qwlinputpanelsurface_p.h
deleted file mode 100644
index 37f2e0858..000000000
--- a/src/compositor/wayland_wrapper/qwlinputpanelsurface_p.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QTWAYLAND_QWLINPUTPANELSURFACE_P_H
-#define QTWAYLAND_QWLINPUTPANELSURFACE_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 <QtCompositor/private/qwayland-server-input-method.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWayland {
-
-class Output;
-class Surface;
-
-class InputPanelSurface : public QtWaylandServer::wl_input_panel_surface
-{
-public:
- enum Type {
- Invalid,
- Toplevel,
- OverlayPanel
- };
-
- InputPanelSurface(struct ::wl_client *client, int id, Surface *surface);
-
- Type type() const;
-
- Output *output() const;
- wl_input_panel_surface::position position() const;
-
-protected:
- void input_panel_surface_set_overlay_panel(Resource *resource) Q_DECL_OVERRIDE;
- void input_panel_surface_set_toplevel(Resource *resource, wl_resource *output_resource, uint32_t position) Q_DECL_OVERRIDE;
-
-private:
- Surface *m_surface;
-
- Type m_type;
-
- Output *m_output;
- wl_input_panel_surface::position m_position;
-};
-
-} // namespace QtWayland
-
-QT_END_NAMESPACE
-
-#endif // QTWAYLAND_QWLINPUTPANELSURFACE_P_H
diff --git a/src/compositor/wayland_wrapper/qwlkeyboard.cpp b/src/compositor/wayland_wrapper/qwlkeyboard.cpp
deleted file mode 100644
index 7a5ed5f25..000000000
--- a/src/compositor/wayland_wrapper/qwlkeyboard.cpp
+++ /dev/null
@@ -1,444 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwlkeyboard_p.h"
-
-#include <QFile>
-#include <QStandardPaths>
-
-#include "qwlcompositor_p.h"
-#include "qwlsurface_p.h"
-
-#include <fcntl.h>
-#include <unistd.h>
-#ifndef QT_NO_WAYLAND_XKB
-#include <sys/mman.h>
-#include <sys/types.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWayland {
-
-Keyboard::Keyboard(Compositor *compositor, InputDevice *seat)
- : QtWaylandServer::wl_keyboard()
- , m_compositor(compositor)
- , m_seat(seat)
- , m_grab(this)
- , m_focus()
- , m_focusResource()
- , m_keys()
- , m_modsDepressed()
- , m_modsLatched()
- , m_modsLocked()
- , m_group()
- , m_pendingKeymap(false)
-#ifndef QT_NO_WAYLAND_XKB
- , m_keymap_fd(-1)
- , m_state(0)
-#endif
-{
-#ifndef QT_NO_WAYLAND_XKB
- initXKB();
-#endif
- connect(&m_focusDestroyListener, &WlListener::fired, this, &Keyboard::focusDestroyed);
-}
-
-Keyboard::~Keyboard()
-{
-#ifndef QT_NO_WAYLAND_XKB
- if (m_context) {
- if (m_keymap_area)
- munmap(m_keymap_area, m_keymap_size);
- close(m_keymap_fd);
- xkb_context_unref(m_context);
- xkb_state_unref(m_state);
- }
-#endif
-}
-
-KeyboardGrabber::~KeyboardGrabber()
-{
-}
-
-void Keyboard::startGrab(KeyboardGrabber *grab)
-{
- m_grab = grab;
- m_grab->m_keyboard = this;
- m_grab->focused(m_focus);
-}
-
-void Keyboard::endGrab()
-{
- m_grab = this;
-}
-
-KeyboardGrabber *Keyboard::currentGrab() const
-{
- return m_grab;
-}
-
-void Keyboard::checkFocusResource(wl_keyboard::Resource *keyboardResource)
-{
- if (!keyboardResource || !m_focus)
- return;
-
- // this is already the current resource, do no send enter twice
- if (m_focusResource == keyboardResource)
- return;
-
- // check if new wl_keyboard resource is from the client owning the focus surface
- struct ::wl_client *focusedClient = m_focus->resource()->client();
- if (focusedClient == keyboardResource->client()) {
- sendEnter(m_focus, keyboardResource);
- m_focusResource = keyboardResource;
- }
-}
-
-void Keyboard::sendEnter(Surface *surface, wl_keyboard::Resource *keyboardResource)
-{
- uint32_t serial = wl_display_next_serial(m_compositor->wl_display());
- send_modifiers(keyboardResource->handle, serial, m_modsDepressed, m_modsLatched, m_modsLocked, m_group);
- send_enter(keyboardResource->handle, serial, surface->resource()->handle, QByteArray::fromRawData((char *)m_keys.data(), m_keys.size() * sizeof(uint32_t)));
-}
-
-void Keyboard::focused(Surface *surface)
-{
- if (m_focus != surface) {
- if (m_focusResource) {
- uint32_t serial = wl_display_next_serial(m_compositor->wl_display());
- send_leave(m_focusResource->handle, serial, m_focus->resource()->handle);
- }
- m_focusDestroyListener.reset();
- if (surface) {
- m_focusDestroyListener.listenForDestruction(surface->resource()->handle);
- }
- }
-
- Resource *resource = surface ? resourceMap().value(surface->resource()->client()) : 0;
-
- if (resource && (m_focus != surface || m_focusResource != resource)) {
- sendEnter(surface, resource);
- }
-
- m_focusResource = resource;
- m_focus = surface;
- Q_EMIT focusChanged(m_focus);
-}
-
-void Keyboard::setFocus(Surface* surface)
-{
- m_grab->focused(surface);
-}
-
-void Keyboard::setKeymap(const QWaylandKeymap &keymap)
-{
- m_keymap = keymap;
- m_pendingKeymap = true;
-
- // If there is no key currently pressed, update right away the keymap
- // Otherwise, delay the update when keys are released
- // see http://lists.freedesktop.org/archives/wayland-devel/2013-October/011395.html
- if (m_keys.isEmpty()) {
- updateKeymap();
- }
-}
-
-void Keyboard::focusDestroyed(void *data)
-{
- Q_UNUSED(data)
- m_focusDestroyListener.reset();
-
- m_focus = 0;
- m_focusResource = 0;
-}
-
-void Keyboard::sendKeyModifiers(wl_keyboard::Resource *resource, uint32_t serial)
-{
- send_modifiers(resource->handle, serial, m_modsDepressed, m_modsLatched, m_modsLocked, m_group);
-}
-
-void Keyboard::sendKeyPressEvent(uint code)
-{
- sendKeyEvent(code, WL_KEYBOARD_KEY_STATE_PRESSED);
-}
-
-void Keyboard::sendKeyReleaseEvent(uint code)
-{
- sendKeyEvent(code, WL_KEYBOARD_KEY_STATE_RELEASED);
-}
-
-Surface *Keyboard::focus() const
-{
- return m_focus;
-}
-
-QtWaylandServer::wl_keyboard::Resource *Keyboard::focusResource() const
-{
- return m_focusResource;
-}
-
-void Keyboard::keyboard_bind_resource(wl_keyboard::Resource *resource)
-{
-#ifndef QT_NO_WAYLAND_XKB
- if (m_context) {
- send_keymap(resource->handle, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1,
- m_keymap_fd, m_keymap_size);
- }
- else
-#endif
- {
- int null_fd = open("/dev/null", O_RDONLY);
- send_keymap(resource->handle, 0 /* WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP */,
- null_fd, 0);
- close(null_fd);
- }
-
- checkFocusResource(resource);
-}
-
-void Keyboard::keyboard_destroy_resource(wl_keyboard::Resource *resource)
-{
- if (m_focusResource == resource)
- m_focusResource = 0;
-}
-
-void Keyboard::keyboard_release(wl_keyboard::Resource *resource)
-{
- wl_resource_destroy(resource->handle);
-}
-
-void Keyboard::key(uint32_t serial, uint32_t time, uint32_t key, uint32_t state)
-{
- if (m_focusResource) {
- send_key(m_focusResource->handle, serial, time, key, state);
- }
-}
-
-void Keyboard::keyEvent(uint code, uint32_t state)
-{
- uint key = code - 8;
- if (state == WL_KEYBOARD_KEY_STATE_PRESSED) {
- m_keys << key;
- } else {
- for (int i = 0; i < m_keys.size(); ++i) {
- if (m_keys.at(i) == key) {
- m_keys.remove(i);
- }
- }
- }
-}
-
-void Keyboard::sendKeyEvent(uint code, uint32_t state)
-{
- uint32_t time = m_compositor->currentTimeMsecs();
- uint32_t serial = wl_display_next_serial(m_compositor->wl_display());
- uint key = code - 8;
- m_grab->key(serial, time, key, state);
-}
-
-void Keyboard::modifiers(uint32_t serial, uint32_t mods_depressed,
- uint32_t mods_latched, uint32_t mods_locked, uint32_t group)
-{
- if (m_focusResource) {
- send_modifiers(m_focusResource->handle, serial, mods_depressed, mods_latched, mods_locked, group);
- }
-}
-
-void Keyboard::updateModifierState(uint code, uint32_t state)
-{
-#ifndef QT_NO_WAYLAND_XKB
- if (!m_context)
- return;
-
- xkb_state_update_key(m_state, code, state == WL_KEYBOARD_KEY_STATE_PRESSED ? XKB_KEY_DOWN : XKB_KEY_UP);
-
- uint32_t modsDepressed = xkb_state_serialize_mods(m_state, (xkb_state_component)XKB_STATE_DEPRESSED);
- uint32_t modsLatched = xkb_state_serialize_mods(m_state, (xkb_state_component)XKB_STATE_LATCHED);
- uint32_t modsLocked = xkb_state_serialize_mods(m_state, (xkb_state_component)XKB_STATE_LOCKED);
- uint32_t group = xkb_state_serialize_group(m_state, (xkb_state_component)XKB_STATE_EFFECTIVE);
-
- if (modsDepressed == m_modsDepressed
- && modsLatched == m_modsLatched
- && modsLocked == m_modsLocked
- && group == m_group)
- return;
-
- m_modsDepressed = modsDepressed;
- m_modsLatched = modsLatched;
- m_modsLocked = modsLocked;
- m_group = group;
-
- m_grab->modifiers(wl_display_next_serial(m_compositor->wl_display()), m_modsDepressed, m_modsLatched, m_modsLocked, m_group);
-#else
- Q_UNUSED(code);
- Q_UNUSED(state);
-#endif
-}
-
-void Keyboard::updateKeymap()
-{
- // There must be no keys pressed when changing the keymap,
- // see http://lists.freedesktop.org/archives/wayland-devel/2013-October/011395.html
- if (!m_pendingKeymap || !m_keys.isEmpty())
- return;
-
- m_pendingKeymap = false;
-#ifndef QT_NO_WAYLAND_XKB
- if (!m_context)
- return;
-
- createXKBKeymap();
- foreach (Resource *res, resourceMap()) {
- send_keymap(res->handle, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, m_keymap_fd, m_keymap_size);
- }
-
- xkb_state_update_mask(m_state, 0, m_modsLatched, m_modsLocked, 0, 0, 0);
- if (m_focusResource)
- sendKeyModifiers(m_focusResource, wl_display_next_serial(m_compositor->wl_display()));
-#endif
-}
-
-#ifndef QT_NO_WAYLAND_XKB
-static int createAnonymousFile(size_t size)
-{
- QString path = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation);
- if (path.isEmpty())
- return -1;
-
- QByteArray name = QFile::encodeName(path + QStringLiteral("/qtwayland-XXXXXX"));
-
- int fd = mkstemp(name.data());
- if (fd < 0)
- return -1;
-
- long flags = fcntl(fd, F_GETFD);
- if (flags == -1 || fcntl(fd, F_SETFD, flags | FD_CLOEXEC) == -1) {
- close(fd);
- fd = -1;
- }
- unlink(name.constData());
-
- if (fd < 0)
- return -1;
-
- if (ftruncate(fd, size) < 0) {
- close(fd);
- return -1;
- }
-
- return fd;
-}
-
-void Keyboard::initXKB()
-{
- m_context = xkb_context_new(static_cast<xkb_context_flags>(0));
- if (!m_context) {
- qWarning("Failed to create a XKB context: keymap will not be supported");
- return;
- }
-
- createXKBKeymap();
-}
-
-void Keyboard::createXKBState(xkb_keymap *keymap)
-{
- char *keymap_str = xkb_keymap_get_as_string(keymap, XKB_KEYMAP_FORMAT_TEXT_V1);
- if (!keymap_str) {
- qWarning("Failed to compile global XKB keymap");
- return;
- }
-
- m_keymap_size = strlen(keymap_str) + 1;
- if (m_keymap_fd >= 0)
- close(m_keymap_fd);
- m_keymap_fd = createAnonymousFile(m_keymap_size);
- if (m_keymap_fd < 0) {
- qWarning("Failed to create anonymous file of size %lu", static_cast<unsigned long>(m_keymap_size));
- return;
- }
-
- m_keymap_area = static_cast<char *>(mmap(0, m_keymap_size, PROT_READ | PROT_WRITE, MAP_SHARED, m_keymap_fd, 0));
- if (m_keymap_area == MAP_FAILED) {
- close(m_keymap_fd);
- m_keymap_fd = -1;
- qWarning("Failed to map shared memory segment");
- return;
- }
-
- strcpy(m_keymap_area, keymap_str);
- free(keymap_str);
-
- if (m_state)
- xkb_state_unref(m_state);
- m_state = xkb_state_new(keymap);
-}
-
-void Keyboard::createXKBKeymap()
-{
- if (!m_context)
- return;
-
- struct xkb_rule_names rule_names = { strdup(qPrintable(m_keymap.rules())),
- strdup(qPrintable(m_keymap.model())),
- strdup(qPrintable(m_keymap.layout())),
- strdup(qPrintable(m_keymap.variant())),
- strdup(qPrintable(m_keymap.options())) };
- struct xkb_keymap *keymap = xkb_keymap_new_from_names(m_context, &rule_names, static_cast<xkb_keymap_compile_flags>(0));
-
- if (keymap) {
- createXKBState(keymap);
- xkb_keymap_unref(keymap);
- } else {
- qWarning("Failed to load the '%s' XKB keymap.", qPrintable(m_keymap.layout()));
- }
-
- free((char *)rule_names.rules);
- free((char *)rule_names.model);
- free((char *)rule_names.layout);
- free((char *)rule_names.variant);
- free((char *)rule_names.options);
-}
-#endif
-
-} // namespace QtWayland
-
-QT_END_NAMESPACE
diff --git a/src/compositor/wayland_wrapper/qwlkeyboard_p.h b/src/compositor/wayland_wrapper/qwlkeyboard_p.h
deleted file mode 100644
index 15185ed56..000000000
--- a/src/compositor/wayland_wrapper/qwlkeyboard_p.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QTWAYLAND_QWLKEYBOARD_P_H
-#define QTWAYLAND_QWLKEYBOARD_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 <QtCompositor/qwaylandexport.h>
-#include <QtCompositor/qwaylandinput.h>
-
-#include <QObject>
-#include <QtCompositor/private/qwayland-server-wayland.h>
-
-#include <QtCore/QVector>
-
-#ifndef QT_NO_WAYLAND_XKB
-#include <xkbcommon/xkbcommon.h>
-#endif
-
-#include "qwllistener_p.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWayland {
-
-class Compositor;
-class InputDevice;
-class Surface;
-class Keyboard;
-
-class Q_COMPOSITOR_EXPORT KeyboardGrabber {
- public:
- virtual ~KeyboardGrabber();
- virtual void focused(Surface *surface) = 0;
- virtual void key(uint32_t serial, uint32_t time, uint32_t key, uint32_t state) = 0;
- virtual void modifiers(uint32_t serial, uint32_t mods_depressed,
- uint32_t mods_latched, uint32_t mods_locked, uint32_t group) = 0;
-
- Keyboard *m_keyboard;
-};
-
-class Q_COMPOSITOR_EXPORT Keyboard : public QObject, public QtWaylandServer::wl_keyboard, public KeyboardGrabber
-{
- Q_OBJECT
-
-public:
- Keyboard(Compositor *compositor, InputDevice *seat);
- ~Keyboard();
-
- void setFocus(Surface *surface);
- void setKeymap(const QWaylandKeymap &keymap);
-
- void sendKeyModifiers(Resource *resource, uint32_t serial);
- void sendKeyPressEvent(uint code);
- void sendKeyReleaseEvent(uint code);
-
- Surface *focus() const;
- Resource *focusResource() const;
-
- void focused(Surface* surface);
- void key(uint32_t serial, uint32_t time, uint32_t key, uint32_t state);
- void modifiers(uint32_t serial, uint32_t mods_depressed,
- uint32_t mods_latched, uint32_t mods_locked, uint32_t group);
-
- void keyEvent(uint code, uint32_t state);
- void updateModifierState(uint code, uint32_t state);
- void updateKeymap();
-
- void startGrab(KeyboardGrabber *grab);
- void endGrab();
- KeyboardGrabber *currentGrab() const;
-
-#ifndef QT_NO_WAYLAND_XKB
- struct xkb_state *xkbState() const { return m_state; }
- uint32_t xkbModsMask() const { return m_modsDepressed | m_modsLatched | m_modsLocked; }
-#endif
-
-Q_SIGNALS:
- void focusChanged(Surface *surface);
-
-protected:
- void keyboard_bind_resource(Resource *resource);
- void keyboard_destroy_resource(Resource *resource);
- void keyboard_release(Resource *resource) Q_DECL_OVERRIDE;
-
-private:
- void checkFocusResource(wl_keyboard::Resource *resource);
- void sendEnter(Surface *surface, wl_keyboard::Resource *resource);
-
- void sendKeyEvent(uint code, uint32_t state);
- void focusDestroyed(void *data);
-
-#ifndef QT_NO_WAYLAND_XKB
- void initXKB();
- void createXKBKeymap();
- void createXKBState(xkb_keymap *keymap);
-#endif
-
- Compositor *m_compositor;
- InputDevice *m_seat;
-
- KeyboardGrabber* m_grab;
- Surface *m_focus;
- Resource *m_focusResource;
- WlListener m_focusDestroyListener;
-
- QVector<uint32_t> m_keys;
- uint32_t m_modsDepressed;
- uint32_t m_modsLatched;
- uint32_t m_modsLocked;
- uint32_t m_group;
-
- QWaylandKeymap m_keymap;
- bool m_pendingKeymap;
-#ifndef QT_NO_WAYLAND_XKB
- size_t m_keymap_size;
- int m_keymap_fd;
- char *m_keymap_area;
- struct xkb_context *m_context;
- struct xkb_state *m_state;
-#endif
-};
-
-} // namespace QtWayland
-
-QT_END_NAMESPACE
-
-#endif // QTWAYLAND_QWLKEYBOARD_P_H
diff --git a/src/compositor/wayland_wrapper/qwllistener.cpp b/src/compositor/wayland_wrapper/qwllistener.cpp
deleted file mode 100644
index 5a3c0e576..000000000
--- a/src/compositor/wayland_wrapper/qwllistener.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** 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 http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://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 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwllistener_p.h"
-
-QT_BEGIN_NAMESPACE
-
-WlListener::WlListener()
-{
- m_listener.parent = this;
- m_listener.listener.notify = handler;
- wl_list_init(&m_listener.listener.link);
-}
-
-void WlListener::listenForDestruction(::wl_resource *resource)
-{
- wl_resource_add_destroy_listener(resource, &m_listener.listener);
-}
-
-void WlListener::reset()
-{
- wl_list_remove(&m_listener.listener.link);
- wl_list_init(&m_listener.listener.link);
-}
-
-void WlListener::handler(wl_listener *listener, void *data)
-{
- WlListener *that = reinterpret_cast<Listener *>(listener)->parent;
- emit that->fired(data);
-}
-
-QT_END_NAMESPACE
diff --git a/src/compositor/wayland_wrapper/qwllistener_p.h b/src/compositor/wayland_wrapper/qwllistener_p.h
deleted file mode 100644
index 296a081ab..000000000
--- a/src/compositor/wayland_wrapper/qwllistener_p.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** 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 http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://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 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QTWAYLAND_QWLLISTENER_H
-#define QTWAYLAND_QWLLISTENER_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 <QObject>
-
-#include <wayland-server.h>
-
-QT_BEGIN_NAMESPACE
-
-class WlListener : public QObject
-{
- Q_OBJECT
-public:
- WlListener();
-
- void listenForDestruction(::wl_resource *resource);
- void reset();
-
-signals:
- void fired(void *data);
-
-private:
- static void handler(wl_listener *listener, void *data);
-
- struct Listener {
- wl_listener listener;
- WlListener *parent;
- };
- Listener m_listener;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/compositor/wayland_wrapper/qwloutput.cpp b/src/compositor/wayland_wrapper/qwloutput.cpp
deleted file mode 100644
index 0cbe166e2..000000000
--- a/src/compositor/wayland_wrapper/qwloutput.cpp
+++ /dev/null
@@ -1,271 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwloutput_p.h"
-
-#include "qwlcompositor_p.h"
-#include "qwlsurface_p.h"
-
-#include <QtGui/QWindow>
-#include <QRect>
-#include <QtCompositor/QWaylandSurface>
-#include <QtCompositor/QWaylandOutput>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWayland {
-
-static QtWaylandServer::wl_output::subpixel toWlSubpixel(const QWaylandOutput::Subpixel &value)
-{
- switch (value) {
- case QWaylandOutput::SubpixelUnknown:
- return QtWaylandServer::wl_output::subpixel_unknown;
- case QWaylandOutput::SubpixelNone:
- return QtWaylandServer::wl_output::subpixel_none;
- case QWaylandOutput::SubpixelHorizontalRgb:
- return QtWaylandServer::wl_output::subpixel_horizontal_rgb;
- case QWaylandOutput::SubpixelHorizontalBgr:
- return QtWaylandServer::wl_output::subpixel_horizontal_bgr;
- case QWaylandOutput::SubpixelVerticalRgb:
- return QtWaylandServer::wl_output::subpixel_vertical_rgb;
- case QWaylandOutput::SubpixelVerticalBgr:
- return QtWaylandServer::wl_output::subpixel_vertical_bgr;
- default:
- break;
- }
-
- return QtWaylandServer::wl_output::subpixel_unknown;
-}
-
-static QtWaylandServer::wl_output::transform toWlTransform(const QWaylandOutput::Transform &value)
-{
- switch (value) {
- case QWaylandOutput::Transform90:
- return QtWaylandServer::wl_output::transform_90;
- case QWaylandOutput::Transform180:
- return QtWaylandServer::wl_output::transform_180;
- case QWaylandOutput::Transform270:
- return QtWaylandServer::wl_output::transform_270;
- case QWaylandOutput::TransformFlipped:
- return QtWaylandServer::wl_output::transform_flipped;
- case QWaylandOutput::TransformFlipped90:
- return QtWaylandServer::wl_output::transform_flipped_90;
- case QWaylandOutput::TransformFlipped180:
- return QtWaylandServer::wl_output::transform_flipped_180;
- case QWaylandOutput::TransformFlipped270:
- return QtWaylandServer::wl_output::transform_flipped_270;
- default:
- break;
- }
-
- return QtWaylandServer::wl_output::transform_normal;
-}
-
-Output::Output(Compositor *compositor, QWindow *window)
- : QtWaylandServer::wl_output(compositor->wl_display(), 2)
- , m_compositor(compositor)
- , m_window(window)
- , m_output(Q_NULLPTR)
- , m_position(QPoint())
- , m_availableGeometry(QRect())
- , m_physicalSize(QSize())
- , m_subpixel(QWaylandOutput::SubpixelUnknown)
- , m_transform(QWaylandOutput::TransformNormal)
- , m_scaleFactor(1)
-{
- m_mode.size = window ? window->size() : QSize();
- m_mode.refreshRate = 60;
-
- qRegisterMetaType<QWaylandOutput::Mode>("WaylandOutput::Mode");
-}
-
-void Output::output_bind_resource(Resource *resource)
-{
- send_geometry(resource->handle,
- m_position.x(), m_position.y(),
- m_physicalSize.width(), m_physicalSize.height(),
- toWlSubpixel(m_subpixel), m_manufacturer, m_model,
- toWlTransform(m_transform));
-
- send_mode(resource->handle, mode_current | mode_preferred,
- m_mode.size.width(), m_mode.size.height(),
- m_mode.refreshRate);
-
- if (resource->version() >= 2) {
- send_scale(resource->handle, m_scaleFactor);
- send_done(resource->handle);
- }
-}
-
-void Output::setManufacturer(const QString &manufacturer)
-{
- m_manufacturer = manufacturer;
-}
-
-void Output::setModel(const QString &model)
-{
- m_model = model;
-}
-
-void Output::setPosition(const QPoint &position)
-{
- if (m_position == position)
- return;
-
- m_position = position;
-
- sendGeometryInfo();
-}
-
-void Output::setMode(const QWaylandOutput::Mode &mode)
-{
- if (m_mode.size == mode.size && m_mode.refreshRate == mode.refreshRate)
- return;
-
- m_mode = mode;
-
- Q_FOREACH (Resource *resource, resourceMap().values()) {
- send_mode(resource->handle, mode_current,
- m_mode.size.width(), m_mode.size.height(),
- m_mode.refreshRate * 1000);
- if (resource->version() >= 2)
- send_done(resource->handle);
- }
-}
-
-QRect Output::geometry() const
-{
- return QRect(m_position, m_mode.size);
-}
-
-void Output::setGeometry(const QRect &geometry)
-{
- if (m_position == geometry.topLeft() && m_mode.size == geometry.size())
- return;
-
- m_position = geometry.topLeft();
- m_mode.size = geometry.size();
-
- Q_FOREACH (Resource *resource, resourceMap().values()) {
- send_geometry(resource->handle,
- m_position.x(), m_position.y(),
- m_physicalSize.width(), m_physicalSize.height(),
- toWlSubpixel(m_subpixel), m_manufacturer, m_model,
- toWlTransform(m_transform));
- send_mode(resource->handle, mode_current,
- m_mode.size.width(), m_mode.size.height(),
- m_mode.refreshRate * 1000);
- if (resource->version() >= 2)
- send_done(resource->handle);
- }
-}
-
-void Output::setAvailableGeometry(const QRect &availableGeometry)
-{
- m_availableGeometry = availableGeometry;
-}
-
-void Output::setPhysicalSize(const QSize &physicalSize)
-{
- if (m_physicalSize == physicalSize)
- return;
-
- m_physicalSize = physicalSize;
-
- sendGeometryInfo();
-}
-
-void Output::setSubpixel(const QWaylandOutput::Subpixel &subpixel)
-{
- if (m_subpixel == subpixel)
- return;
-
- m_subpixel = subpixel;
-
- sendGeometryInfo();
-}
-
-void Output::setTransform(const QWaylandOutput::Transform &transform)
-{
- if (m_transform == transform)
- return;
-
- m_transform = transform;
-
- sendGeometryInfo();
-}
-
-void Output::setScaleFactor(int scale)
-{
- if (m_scaleFactor == scale)
- return;
-
- m_scaleFactor = scale;
-
- Q_FOREACH (Resource *resource, resourceMap().values()) {
- if (resource->version() >= 2) {
- send_scale(resource->handle, m_scaleFactor);
- send_done(resource->handle);
- }
- }
-}
-
-OutputResource *Output::outputForClient(wl_client *client) const
-{
- return static_cast<OutputResource *>(resourceMap().value(client));
-}
-
-void Output::sendGeometryInfo()
-{
- Q_FOREACH (Resource *resource, resourceMap().values()) {
- send_geometry(resource->handle,
- m_position.x(), m_position.x(),
- m_physicalSize.width(), m_physicalSize.height(),
- toWlSubpixel(m_subpixel), m_manufacturer, m_model,
- toWlTransform(m_transform));
- if (resource->version() >= 2)
- send_done(resource->handle);
- }
-}
-
-} // namespace Wayland
-
-QT_END_NAMESPACE
diff --git a/src/compositor/wayland_wrapper/qwloutput_p.h b/src/compositor/wayland_wrapper/qwloutput_p.h
deleted file mode 100644
index 3efd49fb6..000000000
--- a/src/compositor/wayland_wrapper/qwloutput_p.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef WL_OUTPUT_H
-#define WL_OUTPUT_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 <QtCompositor/qwaylandexport.h>
-
-#include <QtCore/QRect>
-#include <QtCore/QList>
-
-#include <QtCompositor/private/qwayland-server-wayland.h>
-#include <QtCompositor/qwaylandoutput.h>
-
-QT_BEGIN_NAMESPACE
-
-class QWindow;
-
-namespace QtWayland {
-
-class Compositor;
-
-struct OutputResource : public QtWaylandServer::wl_output::Resource
-{
- OutputResource() {}
-};
-
-class Output : public QtWaylandServer::wl_output
-{
-public:
- explicit Output(Compositor *compositor, QWindow *window = 0);
-
- Compositor *compositor() const { return m_compositor; }
-
- QWaylandOutput *output() const { return m_output; }
-
- QString manufacturer() const { return m_manufacturer; }
- void setManufacturer(const QString &manufacturer);
-
- QString model() const { return m_model; }
- void setModel(const QString &model);
-
- QPoint position() const { return m_position; }
- void setPosition(const QPoint &position);
-
- QRect geometry() const;
- void setGeometry(const QRect &geometry);
-
- QWaylandOutput::Mode mode() const { return m_mode; }
- void setMode(const QWaylandOutput::Mode &mode);
-
- QRect availableGeometry() const { return m_availableGeometry; }
- void setAvailableGeometry(const QRect &availableGeometry);
-
- QSize physicalSize() const { return m_physicalSize; }
- void setPhysicalSize(const QSize &physicalSize);
-
- QWaylandOutput::Subpixel subpixel() const { return m_subpixel; }
- void setSubpixel(const QWaylandOutput::Subpixel &subpixel);
-
- QWaylandOutput::Transform transform() const { return m_transform; }
- void setTransform(const QWaylandOutput::Transform &transform);
-
- int scaleFactor() const { return m_scaleFactor; }
- void setScaleFactor(int scale);
-
- QWindow *window() const { return m_window; }
-
- OutputResource *outputForClient(struct wl_client *client) const;
-
- QWaylandOutput *waylandOutput() const { return m_output; }
-
- void output_bind_resource(Resource *resource) Q_DECL_OVERRIDE;
- Resource *output_allocate() Q_DECL_OVERRIDE { return new OutputResource; }
-
-private:
- friend class QT_PREPEND_NAMESPACE(QWaylandOutput);
-
- Compositor *m_compositor;
- QWindow *m_window;
- QWaylandOutput *m_output;
- QString m_manufacturer;
- QString m_model;
- QPoint m_position;
- QWaylandOutput::Mode m_mode;
- QRect m_availableGeometry;
- QSize m_physicalSize;
- QWaylandOutput::Subpixel m_subpixel;
- QWaylandOutput::Transform m_transform;
- int m_scaleFactor;
- QList<QWaylandSurface *> m_surfaces;
-
- void sendGeometryInfo();
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif //WL_OUTPUT_H
diff --git a/src/compositor/wayland_wrapper/qwlpointer.cpp b/src/compositor/wayland_wrapper/qwlpointer.cpp
deleted file mode 100644
index 10c2d1037..000000000
--- a/src/compositor/wayland_wrapper/qwlpointer.cpp
+++ /dev/null
@@ -1,336 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwlpointer_p.h"
-
-#include "qwlcompositor_p.h"
-#include "qwlinputdevice_p.h"
-#include "qwlkeyboard_p.h"
-#include "qwlsurface_p.h"
-#include "qwaylandcompositor.h"
-#include "qwaylandsurfaceview.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWayland {
-
-using QtWaylandServer::wl_keyboard;
-
-static uint32_t toWaylandButton(Qt::MouseButton button)
-{
-#ifndef BTN_LEFT
- uint32_t BTN_LEFT = 0x110;
-#endif
- // the range of valid buttons (evdev module) is from 0x110
- // through 0x11f. 0x120 is the first 'Joystick' button.
- switch (button) {
- case Qt::LeftButton: return BTN_LEFT;
- case Qt::RightButton: return uint32_t(0x111);
- case Qt::MiddleButton: return uint32_t(0x112);
- case Qt::ExtraButton1: return uint32_t(0x113); // AKA Qt::BackButton, Qt::XButton1
- case Qt::ExtraButton2: return uint32_t(0x114); // AKA Qt::ForwardButton, Qt::XButton2
- case Qt::ExtraButton3: return uint32_t(0x115);
- case Qt::ExtraButton4: return uint32_t(0x116);
- case Qt::ExtraButton5: return uint32_t(0x117);
- case Qt::ExtraButton6: return uint32_t(0x118);
- case Qt::ExtraButton7: return uint32_t(0x119);
- case Qt::ExtraButton8: return uint32_t(0x11a);
- case Qt::ExtraButton9: return uint32_t(0x11b);
- case Qt::ExtraButton10: return uint32_t(0x11c);
- case Qt::ExtraButton11: return uint32_t(0x11d);
- case Qt::ExtraButton12: return uint32_t(0x11e);
- case Qt::ExtraButton13: return uint32_t(0x11f);
- // default should not occur; but if it does, then return Wayland's highest possible button number.
- default: return uint32_t(0x11f);
- }
-}
-
-Pointer::Pointer(Compositor *compositor, InputDevice *seat)
- : wl_pointer()
- , PointerGrabber()
- , m_compositor(compositor)
- , m_seat(seat)
- , m_grab(this)
- , m_grabButton()
- , m_grabTime()
- , m_grabSerial()
- , m_position(100, 100)
- , m_focus()
- , m_focusResource()
- , m_current()
- , m_currentPoint()
- , m_buttonCount()
-{
- connect(&m_focusDestroyListener, &WlListener::fired, this, &Pointer::focusDestroyed);
-}
-
-void Pointer::setFocus(QWaylandSurfaceView *surface, const QPointF &position)
-{
- if (m_focusResource && m_focus != surface) {
- uint32_t serial = wl_display_next_serial(m_compositor->wl_display());
- send_leave(m_focusResource->handle, serial, m_focus->surface()->handle()->resource()->handle);
- m_focusDestroyListener.reset();
- }
-
- Resource *resource = surface ? resourceMap().value(surface->surface()->handle()->resource()->client()) : 0;
-
- if (resource && (m_focus != surface || resource != m_focusResource)) {
- uint32_t serial = wl_display_next_serial(m_compositor->wl_display());
- Keyboard *keyboard = m_seat->keyboardDevice();
- if (keyboard) {
- wl_keyboard::Resource *kr = keyboard->resourceMap().value(surface->surface()->handle()->resource()->client());
- if (kr)
- keyboard->sendKeyModifiers(kr, serial);
- }
- send_enter(resource->handle, serial, surface->surface()->handle()->resource()->handle,
- wl_fixed_from_double(position.x()), wl_fixed_from_double(position.y()));
-
- m_focusDestroyListener.listenForDestruction(surface->surface()->handle()->resource()->handle);
- }
-
- m_focusResource = resource;
- m_focus = surface;
-}
-
-void Pointer::focusDestroyed(void *data)
-{
- Q_UNUSED(data)
- m_focusDestroyListener.reset();
-
- m_focus = 0;
- m_focusResource = 0;
- setMouseFocus(0, QPointF(), QPointF());
-}
-
-void Pointer::startGrab(PointerGrabber *grab)
-{
- m_grab = grab;
- grab->m_pointer = this;
-
- if (m_current)
- grab->focus();
-}
-
-void Pointer::endGrab()
-{
- m_grab = this;
- m_grab->focus();
-}
-
-void Pointer::setCurrent(QWaylandSurfaceView *surface, const QPointF &point)
-{
- m_current = surface;
- m_currentPoint = point;
-}
-
-bool Pointer::buttonPressed() const
-{
- return m_buttonCount > 0;
-}
-
-PointerGrabber *Pointer::currentGrab() const
-{
- return m_grab;
-}
-
-Qt::MouseButton Pointer::grabButton() const
-{
- return m_grabButton;
-}
-
-uint32_t Pointer::grabTime() const
-{
- return m_grabTime;
-}
-
-uint32_t Pointer::grabSerial() const
-{
- return m_grabSerial;
-}
-
-QWaylandSurfaceView *Pointer::focusSurface() const
-{
- return m_focus;
-}
-
-QWaylandSurfaceView *Pointer::current() const
-{
- return m_current;
-}
-
-QPointF Pointer::position() const
-{
- return m_position;
-}
-
-QPointF Pointer::currentPosition() const
-{
- return m_currentPoint;
-}
-
-QtWaylandServer::wl_pointer::Resource *Pointer::focusResource() const
-{
- return m_focusResource;
-}
-
-void Pointer::pointer_destroy_resource(wl_pointer::Resource *resource)
-{
- if (m_focusResource == resource)
- m_focusResource = 0;
-}
-
-void Pointer::pointer_release(wl_pointer::Resource *resource)
-{
- wl_resource_destroy(resource->handle);
-}
-
-void Pointer::setMouseFocus(QWaylandSurfaceView *surface, const QPointF &localPos, const QPointF &globalPos)
-{
- m_position = globalPos;
-
- m_current = surface;
- m_currentPoint = localPos;
-
- m_grab->focus();
-}
-
-void Pointer::sendButton(uint32_t time, Qt::MouseButton button, uint32_t state)
-{
- uint32_t serial = wl_display_next_serial(m_compositor->wl_display());
- send_button(m_focusResource->handle, serial, time, toWaylandButton(button), state);
-}
-
-void Pointer::sendMousePressEvent(Qt::MouseButton button, const QPointF &localPos, const QPointF &globalPos)
-{
- sendMouseMoveEvent(localPos, globalPos);
- uint32_t time = m_compositor->currentTimeMsecs();
- if (m_buttonCount == 0) {
- m_grabButton = button;
- m_grabTime = time;
- }
- m_buttonCount++;
- m_grab->button(time, button, WL_POINTER_BUTTON_STATE_PRESSED);
-
- if (m_buttonCount == 1)
- m_grabSerial = wl_display_get_serial(m_compositor->wl_display());
-}
-
-void Pointer::sendMouseReleaseEvent(Qt::MouseButton button, const QPointF &localPos, const QPointF &globalPos)
-{
- sendMouseMoveEvent(localPos, globalPos);
- uint32_t time = m_compositor->currentTimeMsecs();
- m_buttonCount--;
- m_grab->button(time, button, WL_POINTER_BUTTON_STATE_RELEASED);
-
- if (m_buttonCount == 1)
- m_grabSerial = wl_display_get_serial(m_compositor->wl_display());
-}
-
-void Pointer::sendMouseMoveEvent(const QPointF &localPos, const QPointF &globalPos)
-{
- uint32_t time = m_compositor->currentTimeMsecs();
-
- m_position = globalPos;
- m_currentPoint = localPos;
-
- m_grab->motion(time);
-}
-
-void Pointer::sendMouseWheelEvent(Qt::Orientation orientation, int delta)
-{
- if (!m_focusResource)
- return;
-
- uint32_t time = m_compositor->currentTimeMsecs();
- uint32_t axis = orientation == Qt::Horizontal ? WL_POINTER_AXIS_HORIZONTAL_SCROLL
- : WL_POINTER_AXIS_VERTICAL_SCROLL;
- send_axis(m_focusResource->handle, time, axis, wl_fixed_from_int(-delta / 12));
-}
-
-void Pointer::focus()
-{
- if (buttonPressed())
- return;
-
- setFocus(m_current, m_currentPoint);
-}
-
-void Pointer::motion(uint32_t time)
-{
- if (m_focusResource)
- send_motion(m_focusResource->handle, time,
- wl_fixed_from_double(m_currentPoint.x()),
- wl_fixed_from_double(m_currentPoint.y()));
-
-}
-
-void Pointer::button(uint32_t time, Qt::MouseButton button, uint32_t state)
-{
- if (m_focusResource) {
- sendButton(time, button, state);
- }
-
- if (!buttonPressed() && state == WL_POINTER_BUTTON_STATE_RELEASED)
- setFocus(m_current, m_currentPoint);
-}
-
-void Pointer::pointer_set_cursor(wl_pointer::Resource *resource, uint32_t serial, wl_resource *surface, int32_t hotspot_x, int32_t hotspot_y)
-{
- Q_UNUSED(resource);
- Q_UNUSED(serial);
-
- if (!surface) {
- m_compositor->waylandCompositor()->setCursorSurface(NULL, 0, 0);
- return;
- }
-
- Surface *s = Surface::fromResource(surface);
- s->setCursorSurface(true);
- m_compositor->waylandCompositor()->setCursorSurface(s->waylandSurface(), hotspot_x, hotspot_y);
-}
-
-PointerGrabber::~PointerGrabber()
-{
-}
-
-} // namespace QtWayland
-
-QT_END_NAMESPACE
diff --git a/src/compositor/wayland_wrapper/qwlpointer_p.h b/src/compositor/wayland_wrapper/qwlpointer_p.h
deleted file mode 100644
index b50350d8b..000000000
--- a/src/compositor/wayland_wrapper/qwlpointer_p.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QTWAYLAND_QWLPOINTER_P_H
-#define QTWAYLAND_QWLPOINTER_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 <QtCompositor/qwaylandexport.h>
-
-#include <QtCore/QList>
-#include <QtCore/QPoint>
-#include <QtCore/QObject>
-
-#include <QtCompositor/private/qwayland-server-wayland.h>
-
-#include <stdint.h>
-
-#include "qwllistener_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QWaylandSurfaceView;
-
-namespace QtWayland {
-
-class Compositor;
-class InputDevice;
-class Pointer;
-class Surface;
-
-class Q_COMPOSITOR_EXPORT PointerGrabber {
-public:
- virtual ~PointerGrabber();
-
- virtual void focus() = 0;
- virtual void motion(uint32_t time) = 0;
- virtual void button(uint32_t time, Qt::MouseButton button, uint32_t state) = 0;
-
- Pointer *m_pointer;
-};
-
-class Q_COMPOSITOR_EXPORT Pointer : public QObject, public QtWaylandServer::wl_pointer, public PointerGrabber
-{
-public:
- Pointer(Compositor *compositor, InputDevice *seat);
-
- void setFocus(QWaylandSurfaceView *surface, const QPointF &position);
-
- void startGrab(PointerGrabber *currentGrab);
- void endGrab();
- PointerGrabber *currentGrab() const;
- Qt::MouseButton grabButton() const;
- uint32_t grabTime() const;
- uint32_t grabSerial() const;
-
- void setCurrent(QWaylandSurfaceView *surface, const QPointF &point);
- void setMouseFocus(QWaylandSurfaceView *surface, const QPointF &localPos, const QPointF &globalPos);
-
- void sendButton(uint32_t time, Qt::MouseButton button, uint32_t state);
-
- void sendMousePressEvent(Qt::MouseButton button, const QPointF &localPos, const QPointF &globalPos);
- void sendMouseReleaseEvent(Qt::MouseButton button, const QPointF &localPos, const QPointF &globalPos);
- void sendMouseMoveEvent(const QPointF &localPos, const QPointF &globalPos);
- void sendMouseWheelEvent(Qt::Orientation orientation, int delta);
-
- QWaylandSurfaceView *focusSurface() const;
- QWaylandSurfaceView *current() const;
- QPointF position() const;
- QPointF currentPosition() const;
- Resource *focusResource() const;
-
- bool buttonPressed() const;
-
- void focus() Q_DECL_OVERRIDE;
- void motion(uint32_t time) Q_DECL_OVERRIDE;
- void button(uint32_t time, Qt::MouseButton button, uint32_t state) Q_DECL_OVERRIDE;
-
-protected:
- void pointer_set_cursor(Resource *resource, uint32_t serial, wl_resource *surface, int32_t hotspot_x, int32_t hotspot_y) Q_DECL_OVERRIDE;
- void pointer_release(Resource *resource) Q_DECL_OVERRIDE;
- void pointer_destroy_resource(Resource *resource) Q_DECL_OVERRIDE;
-
-private:
- void focusDestroyed(void *data);
-
- Compositor *m_compositor;
- InputDevice *m_seat;
-
- PointerGrabber *m_grab;
- Qt::MouseButton m_grabButton;
- uint32_t m_grabTime;
- uint32_t m_grabSerial;
-
- QPointF m_position;
-
- QWaylandSurfaceView *m_focus;
- Resource *m_focusResource;
-
- QWaylandSurfaceView *m_current;
- QPointF m_currentPoint;
-
- int m_buttonCount;
-
- WlListener m_focusDestroyListener;
-};
-
-} // namespace QtWayland
-
-QT_END_NAMESPACE
-
-#endif // QTWAYLAND_QWLPOINTER_P_H
diff --git a/src/compositor/wayland_wrapper/qwlqtkey.cpp b/src/compositor/wayland_wrapper/qwlqtkey.cpp
deleted file mode 100644
index 1eb6c2f1b..000000000
--- a/src/compositor/wayland_wrapper/qwlqtkey.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwlqtkey_p.h"
-#include "qwlsurface_p.h"
-#include <QKeyEvent>
-#include <QWindow>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWayland {
-
-QtKeyExtensionGlobal::QtKeyExtensionGlobal(Compositor *compositor)
- : QtWaylandServer::qt_key_extension(compositor->wl_display(), 2)
- , m_compositor(compositor)
-{
-}
-
-bool QtKeyExtensionGlobal::postQtKeyEvent(QKeyEvent *event, Surface *surface)
-{
- uint32_t time = m_compositor->currentTimeMsecs();
-
- Resource *target = surface ? resourceMap().value(surface->resource()->client()) : 0;
-
- if (target) {
- send_qtkey(target->handle,
- surface ? surface->resource()->handle : 0,
- time, event->type(), event->key(), event->modifiers(),
- event->nativeScanCode(),
- event->nativeVirtualKey(),
- event->nativeModifiers(),
- event->text(),
- event->isAutoRepeat(),
- event->count());
-
- return true;
- }
-
- return false;
-}
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/compositor/wayland_wrapper/qwlqtkey_p.h b/src/compositor/wayland_wrapper/qwlqtkey_p.h
deleted file mode 100644
index 938fa0b84..000000000
--- a/src/compositor/wayland_wrapper/qwlqtkey_p.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef WLQTKEY_H
-#define WLQTKEY_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 <private/qwlcompositor_p.h>
-
-#include "wayland-util.h"
-
-#include <QtCompositor/private/qwayland-server-qtkey-extension.h>
-
-QT_BEGIN_NAMESPACE
-
-class Compositor;
-class Surface;
-class QKeyEvent;
-
-namespace QtWayland {
-
-class QtKeyExtensionGlobal : public QtWaylandServer::qt_key_extension
-{
-public:
- QtKeyExtensionGlobal(Compositor *compositor);
-
- bool postQtKeyEvent(QKeyEvent *event, Surface *surface);
-
-private:
- Compositor *m_compositor;
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif // WLQTKEY_H
diff --git a/src/compositor/wayland_wrapper/qwlqttouch.cpp b/src/compositor/wayland_wrapper/qwlqttouch.cpp
deleted file mode 100644
index 9d4dfdcdd..000000000
--- a/src/compositor/wayland_wrapper/qwlqttouch.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwlqttouch_p.h"
-#include "qwlsurface_p.h"
-#include "qwaylandsurfaceview.h"
-#include <QTouchEvent>
-#include <QWindow>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWayland {
-
-static const int maxRawPos = 24;
-
-TouchExtensionGlobal::TouchExtensionGlobal(Compositor *compositor)
- : QtWaylandServer::qt_touch_extension(compositor->wl_display(), 1)
- , m_compositor(compositor)
- , m_flags(0)
- , m_resources()
- , m_posData(maxRawPos * 2)
-{
-}
-
-TouchExtensionGlobal::~TouchExtensionGlobal()
-{
-}
-
-static inline int toFixed(qreal f)
-{
- return int(f * 10000);
-}
-
-bool TouchExtensionGlobal::postTouchEvent(QTouchEvent *event, QWaylandSurfaceView *view)
-{
- const QList<QTouchEvent::TouchPoint> points = event->touchPoints();
- const int pointCount = points.count();
- if (!pointCount)
- return false;
-
- QPointF surfacePos = view->pos();
- wl_client *surfaceClient = view->surface()->handle()->resource()->client();
- uint32_t time = m_compositor->currentTimeMsecs();
- const int rescount = m_resources.count();
-
- for (int res = 0; res < rescount; ++res) {
- Resource *target = m_resources.at(res);
- if (target->client() != surfaceClient)
- continue;
-
- // We will use no touch_frame type of event, to reduce the number of
- // events flowing through the wire. Instead, the number of points sent is
- // included in the touch point events.
- int sentPointCount = 0;
- for (int i = 0; i < pointCount; ++i) {
- if (points.at(i).state() != Qt::TouchPointStationary)
- ++sentPointCount;
- }
-
- for (int i = 0; i < pointCount; ++i) {
- const QTouchEvent::TouchPoint &tp(points.at(i));
- // Stationary points are never sent. They are cached on client side.
- if (tp.state() == Qt::TouchPointStationary)
- continue;
-
- uint32_t id = tp.id();
- uint32_t state = (tp.state() & 0xFFFF) | (sentPointCount << 16);
- uint32_t flags = (tp.flags() & 0xFFFF) | (int(event->device()->capabilities()) << 16);
-
- QPointF p = tp.pos() - surfacePos; // surface-relative
- int x = toFixed(p.x());
- int y = toFixed(p.y());
- int nx = toFixed(tp.normalizedPos().x());
- int ny = toFixed(tp.normalizedPos().y());
- int w = toFixed(tp.rect().width());
- int h = toFixed(tp.rect().height());
- int vx = toFixed(tp.velocity().x());
- int vy = toFixed(tp.velocity().y());
- uint32_t pressure = uint32_t(tp.pressure() * 255);
-
- QByteArray rawData;
- QVector<QPointF> rawPosList = tp.rawScreenPositions();
- int rawPosCount = rawPosList.count();
- if (rawPosCount) {
- rawPosCount = qMin(maxRawPos, rawPosCount);
- QVector<float>::iterator iter = m_posData.begin();
- for (int rpi = 0; rpi < rawPosCount; ++rpi) {
- const QPointF &rawPos(rawPosList.at(rpi));
- // This will stay in screen coordinates for performance
- // reasons, clients using this data will presumably know
- // what they are doing.
- *iter++ = static_cast<float>(rawPos.x());
- *iter++ = static_cast<float>(rawPos.y());
- }
- rawData = QByteArray::fromRawData(reinterpret_cast<const char*>(m_posData.constData()), sizeof(float) * rawPosCount * 2);
- }
-
- send_touch(target->handle,
- time, id, state,
- x, y, nx, ny, w, h,
- pressure, vx, vy,
- flags, rawData);
- }
-
- return true;
- }
-
- return false;
-}
-
-void TouchExtensionGlobal::touch_extension_bind_resource(Resource *resource)
-{
- m_resources.append(resource);
- send_configure(resource->handle, m_flags);
-}
-
-void TouchExtensionGlobal::touch_extension_destroy_resource(Resource *resource)
-{
- m_resources.removeOne(resource);
-}
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/compositor/wayland_wrapper/qwlqttouch_p.h b/src/compositor/wayland_wrapper/qwlqttouch_p.h
deleted file mode 100644
index 003f783dc..000000000
--- a/src/compositor/wayland_wrapper/qwlqttouch_p.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef WLTOUCH_H
-#define WLTOUCH_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 <private/qwlcompositor_p.h>
-#include <QtCompositor/private/qwayland-server-touch-extension.h>
-#include "wayland-util.h"
-
-QT_BEGIN_NAMESPACE
-
-class Compositor;
-class Surface;
-class QTouchEvent;
-class QWaylandSurfaceView;
-
-namespace QtWayland {
-
-class TouchExtensionGlobal : public QtWaylandServer::qt_touch_extension
-{
-public:
- TouchExtensionGlobal(Compositor *compositor);
- ~TouchExtensionGlobal();
-
- bool postTouchEvent(QTouchEvent *event, QWaylandSurfaceView *view);
-
- void setFlags(int flags) { m_flags = flags; }
-
-protected:
- void touch_extension_bind_resource(Resource *resource) Q_DECL_OVERRIDE;
- void touch_extension_destroy_resource(Resource *resource) Q_DECL_OVERRIDE;
-
-private:
- Compositor *m_compositor;
- int m_flags;
- QList<Resource *> m_resources;
- QVector<float> m_posData;
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif // WLTOUCH_H
diff --git a/src/compositor/wayland_wrapper/qwlregion.cpp b/src/compositor/wayland_wrapper/qwlregion.cpp
index 03829df9a..9f55980e8 100644
--- a/src/compositor/wayland_wrapper/qwlregion.cpp
+++ b/src/compositor/wayland_wrapper/qwlregion.cpp
@@ -3,36 +3,32 @@
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Compositor.
+** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
+** 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.LGPLv3 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.html.
**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
**
** $QT_END_LICENSE$
**
@@ -40,8 +36,6 @@
#include "qwlregion_p.h"
-#include "qwlcompositor_p.h"
-
QT_BEGIN_NAMESPACE
namespace QtWayland {
diff --git a/src/compositor/wayland_wrapper/qwlregion_p.h b/src/compositor/wayland_wrapper/qwlregion_p.h
index 4df39602b..bc15378e3 100644
--- a/src/compositor/wayland_wrapper/qwlregion_p.h
+++ b/src/compositor/wayland_wrapper/qwlregion_p.h
@@ -3,36 +3,32 @@
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Compositor.
+** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
+** 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.LGPLv3 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.html.
**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
**
** $QT_END_LICENSE$
**
@@ -52,12 +48,12 @@
// We mean it.
//
-#include <QtCompositor/qwaylandexport.h>
+#include <QtWaylandCompositor/qwaylandexport.h>
#include <QRegion>
#include <wayland-util.h>
-#include <QtCompositor/private/qwayland-server-wayland.h>
+#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
QT_BEGIN_NAMESPACE
diff --git a/src/compositor/wayland_wrapper/qwlshellsurface.cpp b/src/compositor/wayland_wrapper/qwlshellsurface.cpp
deleted file mode 100644
index b2725462b..000000000
--- a/src/compositor/wayland_wrapper/qwlshellsurface.cpp
+++ /dev/null
@@ -1,557 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwlshellsurface_p.h"
-
-#include "qwlcompositor_p.h"
-#include "qwlsurface_p.h"
-#include "qwloutput_p.h"
-#include "qwlinputdevice_p.h"
-#include "qwlsubsurface_p.h"
-#include "qwlpointer_p.h"
-#include "qwlextendedsurface_p.h"
-
-#include "qwaylandoutput.h"
-#include "qwaylandsurfaceview.h"
-
-#include <QtCore/qglobal.h>
-#include <QtCore/QDebug>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWayland {
-
-Shell::Shell()
-{
-}
-
-const wl_interface *Shell::interface() const
-{
- return &wl_shell_interface;
-}
-
-void Shell::bind(struct wl_client *client, uint32_t version, uint32_t id)
-{
- add(client, id, version);
-}
-
-ShellSurfacePopupGrabber *Shell::getPopupGrabber(InputDevice *input)
-{
- if (!m_popupGrabber.contains(input))
- m_popupGrabber.insert(input, new ShellSurfacePopupGrabber(input));
-
- return m_popupGrabber.value(input);
-}
-
-void Shell::shell_get_shell_surface(Resource *resource, uint32_t id, struct ::wl_resource *surface_res)
-{
- Surface *surface = Surface::fromResource(surface_res);
- new ShellSurface(this, resource->client(), id, surface);
-}
-
-
-
-ShellSurface::ShellSurface(Shell *shell, wl_client *client, uint32_t id, Surface *surface)
- : QWaylandSurfaceInterface(surface->waylandSurface())
- , wl_shell_surface(client, id, 1)
- , m_shell(shell)
- , m_surface(surface)
- , m_resizeGrabber(0)
- , m_moveGrabber(0)
- , m_popupGrabber(0)
- , m_popupSerial()
-{
- m_view = surface->compositor()->waylandCompositor()->createView(surface->waylandSurface());
- connect(surface->waylandSurface(), &QWaylandSurface::configure, this, &ShellSurface::configure);
- connect(surface->waylandSurface(), &QWaylandSurface::mapped, this, &ShellSurface::mapped);
-}
-
-ShellSurface::~ShellSurface()
-{
- delete m_view;
-}
-
-void ShellSurface::sendConfigure(uint32_t edges, int32_t width, int32_t height)
-{
- send_configure(edges, width, height);
-}
-
-void ShellSurface::ping(uint32_t serial)
-{
- m_pings.insert(serial);
- send_ping(serial);
-}
-
-void ShellSurface::adjustPosInResize()
-{
- if (m_surface->transientParent())
- return;
- if (!m_resizeGrabber || !(m_resizeGrabber->resize_edges & WL_SHELL_SURFACE_RESIZE_TOP_LEFT))
- return;
-
- int bottomLeftX = m_resizeGrabber->point.x() + m_resizeGrabber->width;
- int bottomLeftY = m_resizeGrabber->point.y() + m_resizeGrabber->height;
- qreal x = m_view->pos().x();
- qreal y = m_view->pos().y();
- if (m_resizeGrabber->resize_edges & WL_SHELL_SURFACE_RESIZE_TOP)
- y = bottomLeftY - m_view->surface()->size().height();
- if (m_resizeGrabber->resize_edges & WL_SHELL_SURFACE_RESIZE_LEFT)
- x = bottomLeftX - m_view->surface()->size().width();
- QPointF newPos(x,y);
- m_view->setPos(newPos);
-}
-
-void ShellSurface::resetResizeGrabber()
-{
- m_resizeGrabber = 0;
-}
-
-void ShellSurface::resetMoveGrabber()
-{
- m_moveGrabber = 0;
-}
-
-void ShellSurface::setOffset(const QPointF &offset)
-{
- m_surface->setTransientOffset(offset.x(), offset.y());
-}
-
-void ShellSurface::configure(bool hasBuffer)
-{
- m_surface->setMapped(hasBuffer);
-}
-
-bool ShellSurface::runOperation(QWaylandSurfaceOp *op)
-{
- switch (op->type()) {
- case QWaylandSurfaceOp::Ping:
- ping(static_cast<QWaylandSurfacePingOp *>(op)->serial());
- return true;
- case QWaylandSurfaceOp::Resize:
- requestSize(static_cast<QWaylandSurfaceResizeOp *>(op)->size());
- return true;
- default:
- break;
- }
- return false;
-}
-
-void ShellSurface::mapped()
-{
- if (m_surface->waylandSurface()->windowType() == QWaylandSurface::Popup) {
- if (m_surface->mapped() && m_popupGrabber->grabSerial() == m_popupSerial) {
- m_popupGrabber->addPopup(this);
- } else {
- send_popup_done();
- m_popupGrabber->setClient(0);
- }
- }
-}
-
-void ShellSurface::requestSize(const QSize &size)
-{
- send_configure(WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT, size.width(), size.height());
-}
-
-void ShellSurface::shell_surface_destroy_resource(Resource *)
-{
- if (m_popupGrabber)
- m_popupGrabber->removePopup(this);
-
- delete this;
-}
-
-void ShellSurface::shell_surface_move(Resource *resource,
- struct wl_resource *input_device_super,
- uint32_t time)
-{
- Q_UNUSED(resource);
- Q_UNUSED(time);
-
- if (m_resizeGrabber || m_moveGrabber) {
- qDebug() << "invalid state";
- return;
- }
-
- InputDevice *input_device = InputDevice::fromSeatResource(input_device_super);
- Pointer *pointer = input_device->pointerDevice();
-
- m_moveGrabber = new ShellSurfaceMoveGrabber(this, pointer->position() - m_view->pos());
-
- pointer->startGrab(m_moveGrabber);
-}
-
-void ShellSurface::shell_surface_resize(Resource *resource,
- struct wl_resource *input_device_super,
- uint32_t time,
- uint32_t edges)
-{
- Q_UNUSED(resource);
- Q_UNUSED(time);
- Q_UNUSED(edges);
-
- if (m_moveGrabber || m_resizeGrabber) {
- qDebug() << "invalid state2";
- return;
- }
-
- m_resizeGrabber = new ShellSurfaceResizeGrabber(this);
-
- InputDevice *input_device = InputDevice::fromSeatResource(input_device_super);
- Pointer *pointer = input_device->pointerDevice();
-
- m_resizeGrabber->point = pointer->position();
- m_resizeGrabber->resize_edges = static_cast<wl_shell_surface_resize>(edges);
- m_resizeGrabber->width = m_view->surface()->size().width();
- m_resizeGrabber->height = m_view->surface()->size().height();
-
- pointer->startGrab(m_resizeGrabber);
-}
-
-void ShellSurface::shell_surface_set_toplevel(Resource *resource)
-{
- Q_UNUSED(resource);
- m_surface->setTransientParent(0);
- m_surface->setTransientOffset(0, 0);
-
- setSurfaceType(QWaylandSurface::Toplevel);
-
- m_surface->setVisibility(QWindow::Windowed);
-}
-
-void ShellSurface::shell_surface_set_transient(Resource *resource,
- struct wl_resource *parent_surface_resource,
- int x,
- int y,
- uint32_t flags)
-{
-
- Q_UNUSED(resource);
- Q_UNUSED(flags);
- Surface *parent_surface = Surface::fromResource(parent_surface_resource);
- m_surface->setTransientParent(parent_surface);
- m_surface->setTransientOffset(x, y);
- if (flags & WL_SHELL_SURFACE_TRANSIENT_INACTIVE)
- m_surface->setTransientInactive(true);
-
- setSurfaceType(QWaylandSurface::Transient);
-
- m_surface->setVisibility(QWindow::AutomaticVisibility);
-}
-
-void ShellSurface::shell_surface_set_fullscreen(Resource *resource,
- uint32_t method,
- uint32_t framerate,
- struct wl_resource *output_resource)
-{
- Q_UNUSED(resource);
- Q_UNUSED(method);
- Q_UNUSED(framerate);
-
- QWaylandOutput *output = output_resource
- ? QWaylandOutput::fromResource(output_resource)
- : Q_NULLPTR;
- if (!output) {
- // Look for an output that can contain this surface
- Q_FOREACH (QWaylandOutput *curOutput, m_surface->compositor()->outputs()) {
- if (curOutput->geometry().size().width() >= m_surface->size().width() &&
- curOutput->geometry().size().height() >= m_surface->size().height()) {
- output = curOutput;
- break;
- }
- }
- }
- if (!output) {
- qWarning() << "Unable to resize surface full screen, cannot determine output";
- return;
- }
- QSize outputSize = output->geometry().size();
-
- m_view->setPos(output->geometry().topLeft());
- send_configure(resize_bottom_right, outputSize.width(), outputSize.height());
-
- m_surface->setVisibility(QWindow::FullScreen);
-}
-
-void ShellSurface::shell_surface_set_popup(Resource *resource, wl_resource *input_device, uint32_t serial, wl_resource *parent, int32_t x, int32_t y, uint32_t flags)
-{
- Q_UNUSED(resource);
- Q_UNUSED(input_device);
- Q_UNUSED(flags);
-
- InputDevice *input = InputDevice::fromSeatResource(input_device);
- m_popupGrabber = m_shell->getPopupGrabber(input);
-
- m_popupSerial = serial;
- m_surface->setTransientParent(Surface::fromResource(parent));
- m_surface->setTransientOffset(x, y);
-
- setSurfaceType(QWaylandSurface::Popup);
-
- m_surface->setVisibility(QWindow::AutomaticVisibility);
-}
-
-void ShellSurface::shell_surface_set_maximized(Resource *resource,
- struct wl_resource *output_resource)
-{
- Q_UNUSED(resource);
-
- QWaylandOutput *output = output_resource
- ? QWaylandOutput::fromResource(output_resource)
- : Q_NULLPTR;
- if (!output) {
- // Look for an output that can contain this surface
- Q_FOREACH (QWaylandOutput *curOutput, m_surface->compositor()->outputs()) {
- if (curOutput->geometry().size().width() >= m_surface->size().width() &&
- curOutput->geometry().size().height() >= m_surface->size().height()) {
- output = curOutput;
- break;
- }
- }
- }
- if (!output) {
- qWarning() << "Unable to maximize surface, cannot determine output";
- return;
- }
- QSize outputSize = output->availableGeometry().size();
-
- m_view->setPos(output->availableGeometry().topLeft());
- send_configure(resize_bottom_right, outputSize.width(), outputSize.height());
-
- m_surface->setVisibility(QWindow::Maximized);
-}
-
-void ShellSurface::shell_surface_pong(Resource *resource,
- uint32_t serial)
-{
- Q_UNUSED(resource);
- if (m_pings.remove(serial))
- emit m_surface->waylandSurface()->pong();
- else
- qWarning("Received an unexpected pong!");
-}
-
-void ShellSurface::shell_surface_set_title(Resource *resource,
- const QString &title)
-{
- Q_UNUSED(resource);
- m_surface->setTitle(title);
-}
-
-void ShellSurface::shell_surface_set_class(Resource *resource,
- const QString &className)
-{
- Q_UNUSED(resource);
- m_surface->setClassName(className);
-}
-
-ShellSurfaceGrabber::ShellSurfaceGrabber(ShellSurface *shellSurface)
- : PointerGrabber()
- , shell_surface(shellSurface)
-{
-}
-
-ShellSurfaceGrabber::~ShellSurfaceGrabber()
-{
-}
-
-ShellSurfaceResizeGrabber::ShellSurfaceResizeGrabber(ShellSurface *shellSurface)
- : ShellSurfaceGrabber(shellSurface)
-{
-}
-
-void ShellSurfaceResizeGrabber::focus()
-{
-}
-
-void ShellSurfaceResizeGrabber::motion(uint32_t time)
-{
- Q_UNUSED(time);
-
- int width_delta = point.x() - m_pointer->position().x();
- int height_delta = point.y() - m_pointer->position().y();
-
- int new_height = height;
- if (resize_edges & WL_SHELL_SURFACE_RESIZE_TOP)
- new_height = qMax(new_height + height_delta, 1);
- else if (resize_edges & WL_SHELL_SURFACE_RESIZE_BOTTOM)
- new_height = qMax(new_height - height_delta, 1);
-
- int new_width = width;
- if (resize_edges & WL_SHELL_SURFACE_RESIZE_LEFT)
- new_width = qMax(new_width + width_delta, 1);
- else if (resize_edges & WL_SHELL_SURFACE_RESIZE_RIGHT)
- new_width = qMax(new_width - width_delta, 1);
-
- shell_surface->sendConfigure(resize_edges, new_width, new_height);
-}
-
-void ShellSurfaceResizeGrabber::button(uint32_t time, Qt::MouseButton button, uint32_t state)
-{
- Q_UNUSED(time)
-
- if (button == Qt::LeftButton && !state) {
- m_pointer->endGrab();
- shell_surface->resetResizeGrabber();
- delete this;
- }
-}
-
-ShellSurfaceMoveGrabber::ShellSurfaceMoveGrabber(ShellSurface *shellSurface, const QPointF &offset)
- : ShellSurfaceGrabber(shellSurface)
- , m_offset(offset)
-{
-}
-
-void ShellSurfaceMoveGrabber::focus()
-{
-}
-
-void ShellSurfaceMoveGrabber::motion(uint32_t time)
-{
- Q_UNUSED(time);
-
- QPointF pos(m_pointer->position() - m_offset);
- shell_surface->m_view->setPos(pos);
- if (shell_surface->m_surface->transientParent()) {
- QWaylandSurfaceView *view = shell_surface->m_surface->transientParent()->waylandSurface()->views().first();
- if (view)
- shell_surface->setOffset(pos - view->pos());
- }
-
-}
-
-void ShellSurfaceMoveGrabber::button(uint32_t time, Qt::MouseButton button, uint32_t state)
-{
- Q_UNUSED(time)
-
- if (button == Qt::LeftButton && !state) {
- m_pointer->setFocus(0, QPointF());
- m_pointer->endGrab();
- shell_surface->resetMoveGrabber();
- delete this;
- }
-}
-
-ShellSurfacePopupGrabber::ShellSurfacePopupGrabber(InputDevice *inputDevice)
- : PointerGrabber()
- , m_inputDevice(inputDevice)
- , m_client(0)
- , m_surfaces()
- , m_initialUp(false)
-{
-}
-
-uint32_t ShellSurfacePopupGrabber::grabSerial() const
-{
- return m_inputDevice->pointerDevice()->grabSerial();
-}
-
-struct ::wl_client *ShellSurfacePopupGrabber::client() const
-{
- return m_client;
-}
-
-void ShellSurfacePopupGrabber::setClient(struct ::wl_client *client)
-{
- m_client = client;
-}
-
-void ShellSurfacePopupGrabber::addPopup(ShellSurface *surface)
-{
- if (m_surfaces.isEmpty()) {
- m_client = surface->resource()->client();
-
- if (m_inputDevice->pointerDevice()->buttonPressed())
- m_initialUp = false;
-
- m_surfaces.append(surface);
- m_inputDevice->pointerDevice()->startGrab(this);
- } else {
- m_surfaces.append(surface);
- }
-}
-
-void ShellSurfacePopupGrabber::removePopup(ShellSurface *surface)
-{
- if (m_surfaces.isEmpty())
- return;
-
- m_surfaces.removeOne(surface);
- if (m_surfaces.isEmpty())
- m_inputDevice->pointerDevice()->endGrab();
-}
-
-void ShellSurfacePopupGrabber::focus()
-{
- if (m_pointer->current() && m_pointer->current()->surface()->handle()->resource()->client() == m_client)
- m_pointer->setFocus(m_pointer->current(), m_pointer->currentPosition());
- else
- m_pointer->setFocus(0, QPointF());
-}
-
-void ShellSurfacePopupGrabber::motion(uint32_t time)
-{
- m_pointer->motion(time);
-}
-
-void ShellSurfacePopupGrabber::button(uint32_t time, Qt::MouseButton button, uint32_t state)
-{
- if (m_pointer->focusResource()) {
- m_pointer->sendButton(time, button, state);
- } else if (state == QtWaylandServer::wl_pointer::button_state_pressed &&
- (m_initialUp || time - m_pointer->grabTime() > 500) &&
- m_pointer->currentGrab() == this) {
- m_pointer->endGrab();
- Q_FOREACH (ShellSurface *surface, m_surfaces) {
- surface->send_popup_done();
- }
- m_surfaces.clear();
- }
-
- if (state == QtWaylandServer::wl_pointer::button_state_released)
- m_initialUp = true;
-}
-
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/compositor/wayland_wrapper/qwlshellsurface_p.h b/src/compositor/wayland_wrapper/qwlshellsurface_p.h
deleted file mode 100644
index fab2a5c0b..000000000
--- a/src/compositor/wayland_wrapper/qwlshellsurface_p.h
+++ /dev/null
@@ -1,238 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef WLSHELLSURFACE_H
-#define WLSHELLSURFACE_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 <QtCompositor/qwaylandexport.h>
-#include <QtCompositor/qwaylandsurface.h>
-#include <QtCompositor/qwaylandglobalinterface.h>
-#include <QtCompositor/qwaylandsurfaceinterface.h>
-
-#include <wayland-server.h>
-#include <QHash>
-#include <QPoint>
-#include <QSet>
-#include <private/qwlpointer_p.h>
-
-#include <QtCompositor/private/qwayland-server-wayland.h>
-
-QT_BEGIN_NAMESPACE
-
-class QWaylandSurfaceView;
-
-namespace QtWayland {
-
-class Compositor;
-class Surface;
-class ShellSurface;
-class ShellSurfaceResizeGrabber;
-class ShellSurfaceMoveGrabber;
-class ShellSurfacePopupGrabber;
-
-class Shell : public QWaylandGlobalInterface, public QtWaylandServer::wl_shell
-{
-public:
- Shell();
-
- const wl_interface *interface() const Q_DECL_OVERRIDE;
-
- void bind(struct wl_client *client, uint32_t version, uint32_t id) Q_DECL_OVERRIDE;
-
- ShellSurfacePopupGrabber* getPopupGrabber(InputDevice *input);
-
-private:
- void shell_get_shell_surface(Resource *resource, uint32_t id, struct ::wl_resource *surface) Q_DECL_OVERRIDE;
-
- QHash<InputDevice*, ShellSurfacePopupGrabber*> m_popupGrabber;
-};
-
-class Q_COMPOSITOR_EXPORT ShellSurface : public QObject, public QWaylandSurfaceInterface, public QtWaylandServer::wl_shell_surface
-{
-public:
- ShellSurface(Shell *shell, struct wl_client *client, uint32_t id, Surface *surface);
- ~ShellSurface();
- void sendConfigure(uint32_t edges, int32_t width, int32_t height);
-
- void adjustPosInResize();
- void resetResizeGrabber();
- void resetMoveGrabber();
-
- void setOffset(const QPointF &offset);
-
- void configure(bool hasBuffer);
-
- void requestSize(const QSize &size);
- void ping(uint32_t serial);
-
-protected:
- bool runOperation(QWaylandSurfaceOp *op) Q_DECL_OVERRIDE;
-
-private Q_SLOTS:
- void mapped();
-
-private:
- Shell *m_shell;
- Surface *m_surface;
- QWaylandSurfaceView *m_view;
-
- ShellSurfaceResizeGrabber *m_resizeGrabber;
- ShellSurfaceMoveGrabber *m_moveGrabber;
- ShellSurfacePopupGrabber *m_popupGrabber;
-
- uint32_t m_popupSerial;
-
- QSet<uint32_t> m_pings;
-
- void shell_surface_destroy_resource(Resource *resource) Q_DECL_OVERRIDE;
-
- void shell_surface_move(Resource *resource,
- struct wl_resource *input_device_super,
- uint32_t time) Q_DECL_OVERRIDE;
- void shell_surface_resize(Resource *resource,
- struct wl_resource *input_device,
- uint32_t time,
- uint32_t edges) Q_DECL_OVERRIDE;
- void shell_surface_set_toplevel(Resource *resource) Q_DECL_OVERRIDE;
- void shell_surface_set_transient(Resource *resource,
- struct wl_resource *parent_surface_resource,
- int x,
- int y,
- uint32_t flags) Q_DECL_OVERRIDE;
- void shell_surface_set_fullscreen(Resource *resource,
- uint32_t method,
- uint32_t framerate,
- struct wl_resource *output_resource) Q_DECL_OVERRIDE;
- void shell_surface_set_popup(Resource *resource,
- struct wl_resource *input_device,
- uint32_t time,
- struct wl_resource *parent,
- int32_t x,
- int32_t y,
- uint32_t flags) Q_DECL_OVERRIDE;
- void shell_surface_set_maximized(Resource *resource,
- struct wl_resource *output_resource) Q_DECL_OVERRIDE;
- void shell_surface_pong(Resource *resource,
- uint32_t serial) Q_DECL_OVERRIDE;
- void shell_surface_set_title(Resource *resource,
- const QString &title) Q_DECL_OVERRIDE;
- void shell_surface_set_class(Resource *resource,
- const QString &class_) Q_DECL_OVERRIDE;
-
- friend class ShellSurfaceMoveGrabber;
-};
-
-class ShellSurfaceGrabber : public PointerGrabber
-{
-public:
- ShellSurfaceGrabber(ShellSurface *shellSurface);
- ~ShellSurfaceGrabber();
-
- ShellSurface *shell_surface;
-};
-
-class ShellSurfaceResizeGrabber : public ShellSurfaceGrabber
-{
-public:
- ShellSurfaceResizeGrabber(ShellSurface *shellSurface);
-
- QPointF point;
- enum wl_shell_surface_resize resize_edges;
- int32_t width;
- int32_t height;
-
- void focus() Q_DECL_OVERRIDE;
- void motion(uint32_t time) Q_DECL_OVERRIDE;
- void button(uint32_t time, Qt::MouseButton button, uint32_t state) Q_DECL_OVERRIDE;
-};
-
-class ShellSurfaceMoveGrabber : public ShellSurfaceGrabber
-{
-public:
- ShellSurfaceMoveGrabber(ShellSurface *shellSurface, const QPointF &offset);
-
- void focus() Q_DECL_OVERRIDE;
- void motion(uint32_t time) Q_DECL_OVERRIDE;
- void button(uint32_t time, Qt::MouseButton button, uint32_t state) Q_DECL_OVERRIDE;
-
-private:
- QPointF m_offset;
-};
-
-class ShellSurfacePopupGrabber : public PointerGrabber
-{
-public:
- ShellSurfacePopupGrabber(InputDevice *inputDevice);
-
- uint32_t grabSerial() const;
-
- struct ::wl_client *client() const;
- void setClient(struct ::wl_client *client);
-
- void addPopup(ShellSurface *surface);
- void removePopup(ShellSurface *surface);
-
- void focus() Q_DECL_OVERRIDE;
- void motion(uint32_t time) Q_DECL_OVERRIDE;
- void button(uint32_t time, Qt::MouseButton button, uint32_t state) Q_DECL_OVERRIDE;
-
-private:
- InputDevice *m_inputDevice;
- struct ::wl_client *m_client;
- QList<ShellSurface *> m_surfaces;
- bool m_initialUp;
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif // WLSHELLSURFACE_H
diff --git a/src/compositor/wayland_wrapper/qwlsubsurface.cpp b/src/compositor/wayland_wrapper/qwlsubsurface.cpp
deleted file mode 100644
index 3d5085452..000000000
--- a/src/compositor/wayland_wrapper/qwlsubsurface.cpp
+++ /dev/null
@@ -1,151 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QDebug>
-
-#include "qwlsubsurface_p.h"
-
-#include "qwlcompositor_p.h"
-#include "qwaylandsurface.h"
-#include "qwaylandsurfaceview.h"
-
-#include "qwaylandsurfaceitem.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWayland {
-
-SubSurface::SubSurface(Surface *surface, Surface *parent, wl_client *client, uint32_t id, int version)
- : QtWaylandServer::wl_subsurface(client, id, version)
- , m_surface(surface)
- , m_parent(parent)
- , m_synchronized(true)
-{
- m_surface->setSubSurface(this);
- parent->addSubSurface(this);
- QWaylandSurface *p = parent->waylandSurface();
-
- foreach (QWaylandSurfaceView *v, p->views())
- createSubView(v);
- connect(p, &QWaylandSurface::viewAdded, this, &SubSurface::createSubView);
-}
-
-SubSurface::~SubSurface()
-{
- qDeleteAll(m_views);
-
- m_surface->setSubSurface(Q_NULLPTR);
- m_parent->removeSubSurface(this);
-}
-
-const SurfaceRole *SubSurface::role()
-{
- static const SurfaceRole role = { "subsurface" };
- return &role;
-}
-
-void SubSurface::parentCommit()
-{
- foreach (QWaylandSurfaceView *view, m_views) {
- view->setPos(m_position);
- }
-}
-
-void SubSurface::configure(int dx, int dy)
-{
- Q_UNUSED(dx)
- Q_UNUSED(dy)
-}
-
-void SubSurface::createSubView(QWaylandSurfaceView *view)
-{
- QWaylandSurfaceView *v = m_surface->compositor()->waylandCompositor()->createView(m_surface->waylandSurface());
- v->setParentView(view);
- v->setPos(m_position);
- m_views << v;
-}
-
-void SubSurface::subsurface_destroy_resource(Resource *resource)
-{
- Q_UNUSED(resource)
- delete this;
-}
-
-void SubSurface::subsurface_destroy(Resource *resource)
-{
- wl_resource_destroy(resource->handle);
-}
-
-void SubSurface::subsurface_set_position(Resource *resource, int32_t x, int32_t y)
-{
- Q_UNUSED(resource)
-
- m_position = QPoint(x, y);
-}
-
-void SubSurface::subsurface_place_above(Resource *resource, ::wl_resource *sibling)
-{
- Q_UNUSED(resource)
- Q_UNUSED(sibling)
- qWarning("wl_subsurface.place_above not implemented");
-}
-
-void SubSurface::subsurface_place_below(Resource *resource, ::wl_resource *sibling)
-{
- Q_UNUSED(resource)
- Q_UNUSED(sibling)
- qWarning("wl_subsurface.place_below not implemented");
-}
-
-void SubSurface::subsurface_set_sync(Resource *resource)
-{
- Q_UNUSED(resource)
- qWarning("wl_subsurface.set_sync not implemented");
-}
-
-void SubSurface::subsurface_set_desync(Resource *resource)
-{
- Q_UNUSED(resource)
- qWarning("wl_subsurface.set_desync not implemented");
-}
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/compositor/wayland_wrapper/qwlsubsurface_p.h b/src/compositor/wayland_wrapper/qwlsubsurface_p.h
deleted file mode 100644
index 2046ec62b..000000000
--- a/src/compositor/wayland_wrapper/qwlsubsurface_p.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef WLSUBSURFACE_H
-#define WLSUBSURFACE_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 <private/qwlsurface_p.h>
-
-#include <QtCompositor/private/qwayland-server-wayland.h>
-
-#include <QtCore/QObject>
-#include <QtCore/QLinkedList>
-
-QT_BEGIN_NAMESPACE
-
-class Compositor;
-class QWaylandSurface;
-
-namespace QtWayland {
-
-class SubSurface : public QObject, public QtWaylandServer::wl_subsurface, public SurfaceRoleHandler<SubSurface>
-{
-public:
- SubSurface(Surface *surface, Surface *parent, wl_client *client, uint32_t id, int version);
- ~SubSurface();
-
- static const SurfaceRole *role();
-
- void parentCommit();
-
-protected:
- void configure(int dx, int dy) Q_DECL_OVERRIDE;
- void subsurface_destroy_resource(Resource *resource) Q_DECL_OVERRIDE;
- void subsurface_destroy(Resource *resource) Q_DECL_OVERRIDE;
- void subsurface_set_position(Resource *resource, int32_t x, int32_t y) Q_DECL_OVERRIDE;
- void subsurface_place_above(Resource *resource, ::wl_resource *sibling) Q_DECL_OVERRIDE;
- void subsurface_place_below(Resource *resource, ::wl_resource *sibling) Q_DECL_OVERRIDE;
- void subsurface_set_sync(Resource *resource) Q_DECL_OVERRIDE;
- void subsurface_set_desync(Resource *resource) Q_DECL_OVERRIDE;
-
-private:
- void createSubView(QWaylandSurfaceView *view);
-
- Surface *m_surface;
- Surface *m_parent;
- QPoint m_position;
- bool m_synchronized;
- QVector<QWaylandSurfaceView *> m_views;
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif // WLSUBSURFACE_H
diff --git a/src/compositor/wayland_wrapper/qwlsurface.cpp b/src/compositor/wayland_wrapper/qwlsurface.cpp
deleted file mode 100644
index eb79d9c10..000000000
--- a/src/compositor/wayland_wrapper/qwlsurface.cpp
+++ /dev/null
@@ -1,593 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwlsurface_p.h"
-
-#include "qwaylandsurface.h"
-#include "qwlcompositor_p.h"
-#include "qwlinputdevice_p.h"
-#include "qwlextendedsurface_p.h"
-#include "qwlregion_p.h"
-#include "qwlsubsurface_p.h"
-#include "qwlsurfacebuffer_p.h"
-#include "qwaylandsurfaceview.h"
-#include "qwaylandoutput.h"
-
-#include <QtCore/QDebug>
-#include <QTouchEvent>
-#include <QGuiApplication>
-#include <QScreen>
-
-#include <wayland-server.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWayland {
-
-class FrameCallback {
-public:
- FrameCallback(Surface *surf, wl_resource *res)
- : surface(surf)
- , resource(res)
- , canSend(false)
- {
-#if WAYLAND_VERSION_MAJOR < 1 || (WAYLAND_VERSION_MAJOR == 1 && WAYLAND_VERSION_MINOR <= 2)
- res->data = this;
- res->destroy = destroyCallback;
-#else
- wl_resource_set_implementation(res, 0, this, destroyCallback);
-#endif
- }
- ~FrameCallback()
- {
- }
- void destroy()
- {
- if (resource)
- wl_resource_destroy(resource);
- else
- delete this;
- }
- void send(uint time)
- {
- wl_callback_send_done(resource, time);
- wl_resource_destroy(resource);
- }
- static void destroyCallback(wl_resource *res)
- {
-#if WAYLAND_VERSION_MAJOR < 1 || (WAYLAND_VERSION_MAJOR == 1 && WAYLAND_VERSION_MINOR <= 2)
- FrameCallback *_this = static_cast<FrameCallback *>(res->data);
-#else
- FrameCallback *_this = static_cast<FrameCallback *>(wl_resource_get_user_data(res));
-#endif
- _this->surface->removeFrameCallback(_this);
- delete _this;
- }
- Surface *surface;
- wl_resource *resource;
- bool canSend;
-};
-
-static QRegion infiniteRegion() {
- return QRegion(QRect(QPoint(std::numeric_limits<int>::min(), std::numeric_limits<int>::min()),
- QPoint(std::numeric_limits<int>::max(), std::numeric_limits<int>::max())));
-}
-
-Surface::Surface(struct wl_client *client, uint32_t id, int version, QWaylandCompositor *compositor, QWaylandSurface *surface)
- : QtWaylandServer::wl_surface(client, id, version)
- , m_compositor(compositor->handle())
- , m_waylandSurface(surface)
- , m_mainOutput(0)
- , m_buffer(0)
- , m_surfaceMapped(false)
- , m_attacher(0)
- , m_extendedSurface(0)
- , m_subSurface(0)
- , m_inputPanelSurface(0)
- , m_inputRegion(infiniteRegion())
- , m_transientParent(0)
- , m_transientInactive(false)
- , m_transientOffset(QPointF(0, 0))
- , m_isCursorSurface(false)
- , m_destroyed(false)
- , m_contentOrientation(Qt::PrimaryOrientation)
- , m_visibility(QWindow::Hidden)
- , m_role(0)
- , m_roleHandler(0)
-{
- m_pending.buffer = 0;
- m_pending.newlyAttached = false;
- m_pending.inputRegion = infiniteRegion();
-}
-
-Surface::~Surface()
-{
- delete m_subSurface;
-
- m_bufferRef = QWaylandBufferRef();
-
- for (int i = 0; i < m_bufferPool.size(); i++)
- m_bufferPool[i]->setDestroyIfUnused(true);
-
- foreach (FrameCallback *c, m_pendingFrameCallbacks)
- c->destroy();
- foreach (FrameCallback *c, m_frameCallbacks)
- c->destroy();
-}
-
-bool Surface::setRole(const SurfaceRole *role, wl_resource *errorResource, uint32_t errorCode)
-{
- if (m_role && m_role != role) {
- wl_resource_post_error(errorResource, errorCode, "Cannot assign role %s to wl_surface@%d, already has role %s\n", role->name,
- wl_resource_get_id(resource()->handle), m_role->name);
- return false;
- }
- m_role = role;
- return true;
-}
-
-void Surface::setTransientOffset(qreal x, qreal y)
-{
- m_transientOffset.setX(x);
- m_transientOffset.setY(y);
-}
-
-void Surface::releaseSurfaces()
-{
-
-}
-
-Surface *Surface::fromResource(struct ::wl_resource *resource)
-{
- return static_cast<Surface *>(Resource::fromResource(resource)->surface_object);
-}
-
-QWaylandSurface::Type Surface::type() const
-{
- if (m_buffer && m_buffer->waylandBufferHandle()) {
- if (m_buffer->isShmBuffer()) {
- return QWaylandSurface::Shm;
- } else {
- return QWaylandSurface::Texture;
- }
- }
- return QWaylandSurface::Invalid;
-}
-
-bool Surface::isYInverted() const
-{
- if (m_buffer)
- return m_buffer->isYInverted();
- return false;
-}
-
-bool Surface::mapped() const
-{
- return !m_unmapLocks.isEmpty() || (m_buffer && bool(m_buffer->waylandBufferHandle()));
-}
-
-QSize Surface::size() const
-{
- return m_size;
-}
-
-void Surface::setSize(const QSize &size)
-{
- if (size != m_size) {
- m_opaqueRegion = QRegion();
- m_size = size;
- m_waylandSurface->sizeChanged();
- }
-}
-
-QRegion Surface::inputRegion() const
-{
- return m_inputRegion;
-}
-
-QRegion Surface::opaqueRegion() const
-{
- return m_opaqueRegion;
-}
-
-void Surface::sendFrameCallback()
-{
- uint time = m_compositor->currentTimeMsecs();
- foreach (FrameCallback *callback, m_frameCallbacks) {
- if (callback->canSend) {
- callback->send(time);
- m_frameCallbacks.removeOne(callback);
- }
- }
-}
-
-void Surface::removeFrameCallback(FrameCallback *callback)
-{
- m_pendingFrameCallbacks.removeOne(callback);
- m_frameCallbacks.removeOne(callback);
-}
-
-QWaylandSurface * Surface::waylandSurface() const
-{
- return m_waylandSurface;
-}
-
-QPoint Surface::lastMousePos() const
-{
- return m_lastLocalMousePos;
-}
-
-void Surface::setExtendedSurface(ExtendedSurface *extendedSurface)
-{
- m_extendedSurface = extendedSurface;
- if (m_extendedSurface)
- emit m_waylandSurface->extendedSurfaceReady();
-}
-
-ExtendedSurface *Surface::extendedSurface() const
-{
- return m_extendedSurface;
-}
-
-void Surface::setSubSurface(SubSurface *subSurface)
-{
- m_subSurface = subSurface;
-}
-
-SubSurface *Surface::subSurface() const
-{
- return m_subSurface;
-}
-
-void Surface::addSubSurface(SubSurface *ss)
-{
- m_subsurfaces << ss;
-}
-
-void Surface::removeSubSurface(SubSurface *ss)
-{
- for (QVector<SubSurface *>::iterator i = m_subsurfaces.begin(); i != m_subsurfaces.end(); ++i) {
- if (*i == ss) {
- m_subsurfaces.erase(i);
- return;
- }
- }
-}
-
-void Surface::setInputPanelSurface(InputPanelSurface *inputPanelSurface)
-{
- m_inputPanelSurface = inputPanelSurface;
-}
-
-InputPanelSurface *Surface::inputPanelSurface() const
-{
- return m_inputPanelSurface;
-}
-
-Compositor *Surface::compositor() const
-{
- return m_compositor;
-}
-
-Output *Surface::mainOutput() const
-{
- if (!m_mainOutput)
- return m_compositor->primaryOutput()->handle();
- return m_mainOutput;
-}
-
-void Surface::setMainOutput(Output *output)
-{
- m_mainOutput = output;
-}
-
-QList<Output *> Surface::outputs() const
-{
- return m_outputs;
-}
-
-void Surface::addToOutput(Output *output)
-{
- if (!output)
- return;
-
- if (!m_mainOutput)
- m_mainOutput = output;
-
- if (m_outputs.contains(output))
- return;
-
- m_outputs.append(output);
-
- QWaylandSurfaceEnterEvent event(output->waylandOutput());
- QCoreApplication::sendEvent(waylandSurface(), &event);
-
- // Send surface enter event
- Q_FOREACH (Resource *resource, resourceMap().values()) {
- QList<Output::Resource *> outputs = output->resourceMap().values();
- for (int i = 0; i < outputs.size(); i++)
- send_enter(resource->handle, outputs.at(i)->handle);
- }
-}
-
-void Surface::removeFromOutput(Output *output)
-{
- if (!output)
- return;
-
- m_outputs.removeOne(output);
-
- if (m_outputs.size() == 0)
- m_mainOutput = m_compositor->primaryOutput()->handle();
-
- QWaylandSurfaceLeaveEvent event(output->waylandOutput());
- QCoreApplication::sendEvent(waylandSurface(), &event);
-
- // Send surface leave event
- Q_FOREACH (Resource *resource, resourceMap().values()) {
- QList<Output::Resource *> outputs = output->resourceMap().values();
- for (int i = 0; i < outputs.size(); i++)
- send_leave(resource->handle, outputs.at(i)->handle);
- }
-}
-
-/*!
- * Sets the backbuffer for this surface. The back buffer is not yet on
- * screen and will become live during the next swapBuffers().
- *
- * The backbuffer represents the current state of the surface for the
- * purpose of GUI-thread accessible properties such as size and visibility.
- */
-void Surface::setBackBuffer(SurfaceBuffer *buffer)
-{
- m_buffer = buffer;
-
- if (m_buffer) {
- bool valid = m_buffer->waylandBufferHandle() != 0;
- if (valid)
- setSize(m_buffer->size());
-
- m_damage = m_damage.intersected(QRect(QPoint(), m_size));
- emit m_waylandSurface->damaged(m_damage);
- } else {
- m_compositor->resetInputDevice(this);
- }
- m_damage = QRegion();
-}
-
-void Surface::setMapped(bool mapped)
-{
- if (!m_surfaceMapped && mapped) {
- m_surfaceMapped = true;
- emit m_waylandSurface->mapped();
- } else if (!mapped && m_surfaceMapped) {
- m_surfaceMapped = false;
- emit m_waylandSurface->unmapped();
- }
-}
-
-void Surface::addUnmapLock(QWaylandUnmapLock *l)
-{
- m_unmapLocks << l;
-}
-
-void Surface::removeUnmapLock(QWaylandUnmapLock *l)
-{
- m_unmapLocks.removeOne(l);
- if (!mapped() && m_attacher) {
- setSize(QSize());
- m_attacher->unmap();
- }
-}
-
-SurfaceBuffer *Surface::createSurfaceBuffer(struct ::wl_resource *buffer)
-{
- SurfaceBuffer *newBuffer = 0;
- for (int i = 0; i < m_bufferPool.size(); i++) {
- if (!m_bufferPool[i]->isRegisteredWithBuffer()) {
- newBuffer = m_bufferPool[i];
- newBuffer->initialize(buffer);
- break;
- }
- }
-
- if (!newBuffer) {
- newBuffer = new SurfaceBuffer(this);
- newBuffer->initialize(buffer);
- m_bufferPool.append(newBuffer);
- if (m_bufferPool.size() > 3)
- qWarning() << "Increased buffer pool size to" << m_bufferPool.size() << "for surface with title:" << title() << "className:" << className();
- }
-
- return newBuffer;
-}
-
-Qt::ScreenOrientation Surface::contentOrientation() const
-{
- return m_contentOrientation;
-}
-
-void Surface::surface_destroy_resource(Resource *)
-{
- if (m_extendedSurface) {
- m_extendedSurface->setParentSurface(Q_NULLPTR);
- m_extendedSurface = 0;
- }
-
- if (transientParent()) {
- foreach (Surface *surface, compositor()->surfaces()) {
- if (surface->transientParent() == this) {
- surface->setTransientParent(0);
- }
- }
- }
-
- m_destroyed = true;
- m_waylandSurface->destroy();
- emit m_waylandSurface->surfaceDestroyed();
-}
-
-void Surface::surface_destroy(Resource *resource)
-{
- wl_resource_destroy(resource->handle);
-}
-
-void Surface::surface_attach(Resource *, struct wl_resource *buffer, int x, int y)
-{
- if (m_pending.buffer)
- m_pending.buffer->disown();
- m_pending.buffer = createSurfaceBuffer(buffer);
- m_pending.offset = QPoint(x, y);
- m_pending.newlyAttached = true;
-}
-
-void Surface::surface_damage(Resource *, int32_t x, int32_t y, int32_t width, int32_t height)
-{
- m_pending.damage = m_pending.damage.united(QRect(x, y, width, height));
-}
-
-void Surface::surface_frame(Resource *resource, uint32_t callback)
-{
- struct wl_resource *frame_callback = wl_resource_create(resource->client(), &wl_callback_interface, wl_callback_interface.version, callback);
- m_pendingFrameCallbacks << new FrameCallback(this, frame_callback);
-}
-
-void Surface::surface_set_opaque_region(Resource *, struct wl_resource *region)
-{
- m_opaqueRegion = region ? Region::fromResource(region)->region() : QRegion();
-}
-
-void Surface::surface_set_input_region(Resource *, struct wl_resource *region)
-{
- if (region) {
- m_pending.inputRegion = Region::fromResource(region)->region();
- } else {
- m_pending.inputRegion = infiniteRegion();
- }
-}
-
-void Surface::surface_commit(Resource *)
-{
- m_damage = m_pending.damage;
-
- if (m_pending.buffer || m_pending.newlyAttached) {
- setBackBuffer(m_pending.buffer);
- m_bufferRef = QWaylandBufferRef(m_buffer);
-
- if (m_attacher) {
- if (m_bufferRef) {
- m_attacher->attach(m_bufferRef);
- } else if (!mapped()) {
- setSize(QSize());
- m_attacher->unmap();
- }
- }
- emit m_waylandSurface->configure(m_bufferRef);
- if (m_roleHandler)
- m_roleHandler->configure(m_pending.offset.x(), m_pending.offset.y());
- }
-
- m_pending.buffer = 0;
- m_pending.offset = QPoint();
- m_pending.newlyAttached = false;
- m_pending.damage = QRegion();
-
- foreach (SubSurface *ss, m_subsurfaces)
- ss->parentCommit();
-
- if (m_buffer)
- m_buffer->setCommitted();
-
- m_frameCallbacks << m_pendingFrameCallbacks;
- m_pendingFrameCallbacks.clear();
-
- m_inputRegion = m_pending.inputRegion.intersected(QRect(QPoint(), m_size));
-
- emit m_waylandSurface->redraw();
-}
-
-void Surface::surface_set_buffer_transform(Resource *resource, int32_t orientation)
-{
- Q_UNUSED(resource);
- QScreen *screen = QGuiApplication::primaryScreen();
- bool isPortrait = screen->primaryOrientation() == Qt::PortraitOrientation;
- Qt::ScreenOrientation oldOrientation = m_contentOrientation;
- switch (orientation) {
- case WL_OUTPUT_TRANSFORM_90:
- m_contentOrientation = isPortrait ? Qt::InvertedLandscapeOrientation : Qt::PortraitOrientation;
- break;
- case WL_OUTPUT_TRANSFORM_180:
- m_contentOrientation = isPortrait ? Qt::InvertedPortraitOrientation : Qt::InvertedLandscapeOrientation;
- break;
- case WL_OUTPUT_TRANSFORM_270:
- m_contentOrientation = isPortrait ? Qt::LandscapeOrientation : Qt::InvertedPortraitOrientation;
- break;
- default:
- m_contentOrientation = Qt::PrimaryOrientation;
- }
- if (m_contentOrientation != oldOrientation)
- emit waylandSurface()->contentOrientationChanged();
-}
-
-void Surface::frameStarted()
-{
- foreach (FrameCallback *c, m_frameCallbacks)
- c->canSend = true;
-}
-
-void Surface::setClassName(const QString &className)
-{
- if (m_className != className) {
- m_className = className;
- emit waylandSurface()->classNameChanged();
- }
-}
-
-void Surface::setTitle(const QString &title)
-{
- if (m_title != title) {
- m_title = title;
- emit waylandSurface()->titleChanged();
- }
-}
-
-} // namespace Wayland
-
-QT_END_NAMESPACE
diff --git a/src/compositor/wayland_wrapper/qwlsurface_p.h b/src/compositor/wayland_wrapper/qwlsurface_p.h
deleted file mode 100644
index 9cb9b5145..000000000
--- a/src/compositor/wayland_wrapper/qwlsurface_p.h
+++ /dev/null
@@ -1,307 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef WL_SURFACE_H
-#define WL_SURFACE_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 <QtCompositor/qwaylandexport.h>
-
-#include <private/qwlsurfacebuffer_p.h>
-#include <private/qwloutput_p.h>
-#include <QtCompositor/qwaylandsurface.h>
-#include <QtCompositor/qwaylandbufferref.h>
-
-#include <QtCore/QVector>
-#include <QtCore/QRect>
-#include <QtGui/QRegion>
-#include <QtGui/QImage>
-#include <QtGui/QWindow>
-
-#include <QtCore/QTextStream>
-#include <QtCore/QMetaType>
-
-#include <wayland-util.h>
-
-#include <QtCompositor/private/qwayland-server-wayland.h>
-
-QT_BEGIN_NAMESPACE
-
-class QTouchEvent;
-
-class QWaylandUnmapLock;
-
-namespace QtWayland {
-
-class Compositor;
-class Buffer;
-class ExtendedSurface;
-class InputPanelSurface;
-class SubSurface;
-class FrameCallback;
-
-class SurfaceRole;
-class RoleBase;
-
-class Q_COMPOSITOR_EXPORT Surface : public QtWaylandServer::wl_surface
-{
-public:
- Surface(struct wl_client *client, uint32_t id, int version, QWaylandCompositor *compositor, QWaylandSurface *surface);
- ~Surface();
-
- bool setRole(const SurfaceRole *role, wl_resource *errorResource, uint32_t errorCode);
- const SurfaceRole *role() const { return m_role; }
- template<class T>
- bool setRoleHandler(T *handler);
-
- static Surface *fromResource(struct ::wl_resource *resource);
-
- QWaylandSurface::Type type() const;
- bool isYInverted() const;
-
- bool mapped() const;
-
- using QtWaylandServer::wl_surface::resource;
-
- QSize size() const;
- void setSize(const QSize &size);
-
- QRegion inputRegion() const;
- QRegion opaqueRegion() const;
-
- void sendFrameCallback();
- void removeFrameCallback(FrameCallback *callback);
-
- QWaylandSurface *waylandSurface() const;
-
- QPoint lastMousePos() const;
-
- void setExtendedSurface(ExtendedSurface *extendedSurface);
- ExtendedSurface *extendedSurface() const;
-
- void setSubSurface(SubSurface *subSurface);
- SubSurface *subSurface() const;
- void addSubSurface(SubSurface *ss);
- void removeSubSurface(SubSurface *ss);
-
- void setInputPanelSurface(InputPanelSurface *inputPanelSurface);
- InputPanelSurface *inputPanelSurface() const;
-
- Compositor *compositor() const;
-
- Output *mainOutput() const;
- void setMainOutput(Output *output);
-
- QList<Output *> outputs() const;
-
- void addToOutput(Output *output);
- void removeFromOutput(Output *output);
-
- QString className() const { return m_className; }
- void setClassName(const QString &className);
-
- QString title() const { return m_title; }
- void setTitle(const QString &title);
-
- Surface *transientParent() const { return m_transientParent; }
- void setTransientParent(Surface *parent) { m_transientParent = parent; }
-
- bool transientInactive() const { return m_transientInactive; }
- void setTransientInactive(bool v) { m_transientInactive = v; }
-
- void setTransientOffset(qreal x, qreal y);
-
- bool isCursorSurface() const { return m_isCursorSurface; }
- void setCursorSurface(bool isCursor) { m_isCursorSurface = isCursor; }
-
- void releaseSurfaces();
- void frameStarted();
-
- void addUnmapLock(QWaylandUnmapLock *l);
- void removeUnmapLock(QWaylandUnmapLock *l);
-
- void setMapped(bool mapped);
- void setVisibility(QWindow::Visibility visibility) { m_visibility = visibility; }
-
- inline bool isDestroyed() const { return m_destroyed; }
-
- Qt::ScreenOrientation contentOrientation() const;
-
-protected:
- void surface_destroy_resource(Resource *resource) Q_DECL_OVERRIDE;
-
- void surface_destroy(Resource *resource) Q_DECL_OVERRIDE;
- void surface_attach(Resource *resource,
- struct wl_resource *buffer, int x, int y) Q_DECL_OVERRIDE;
- void surface_damage(Resource *resource,
- int32_t x, int32_t y, int32_t width, int32_t height) Q_DECL_OVERRIDE;
- void surface_frame(Resource *resource,
- uint32_t callback) Q_DECL_OVERRIDE;
- void surface_set_opaque_region(Resource *resource,
- struct wl_resource *region) Q_DECL_OVERRIDE;
- void surface_set_input_region(Resource *resource,
- struct wl_resource *region) Q_DECL_OVERRIDE;
- void surface_commit(Resource *resource) Q_DECL_OVERRIDE;
- void surface_set_buffer_transform(Resource *resource, int32_t transform) Q_DECL_OVERRIDE;
-
- Q_DISABLE_COPY(Surface)
-
- Compositor *m_compositor;
- QWaylandSurface *m_waylandSurface;
- Output *m_mainOutput;
- QList<Output *> m_outputs;
-
- QRegion m_damage;
- SurfaceBuffer *m_buffer;
- QWaylandBufferRef m_bufferRef;
- bool m_surfaceMapped;
- QWaylandBufferAttacher *m_attacher;
- QVector<QWaylandUnmapLock *> m_unmapLocks;
-
- struct {
- SurfaceBuffer *buffer;
- QRegion damage;
- QPoint offset;
- bool newlyAttached;
- QRegion inputRegion;
- } m_pending;
-
- QPoint m_lastLocalMousePos;
- QPoint m_lastGlobalMousePos;
-
- QList<FrameCallback *> m_pendingFrameCallbacks;
- QList<FrameCallback *> m_frameCallbacks;
-
- ExtendedSurface *m_extendedSurface;
- SubSurface *m_subSurface;
- InputPanelSurface *m_inputPanelSurface;
-
- QRegion m_inputRegion;
- QRegion m_opaqueRegion;
-
- QVector<SurfaceBuffer *> m_bufferPool;
-
- QSize m_size;
- QString m_className;
- QString m_title;
- Surface *m_transientParent;
- bool m_transientInactive;
- QPointF m_transientOffset;
- bool m_isCursorSurface;
- bool m_destroyed;
- Qt::ScreenOrientation m_contentOrientation;
- QWindow::Visibility m_visibility;
- QVector<SubSurface *> m_subsurfaces;
-
- const SurfaceRole *m_role;
- RoleBase *m_roleHandler;
-
- void setBackBuffer(SurfaceBuffer *buffer);
- SurfaceBuffer *createSurfaceBuffer(struct ::wl_resource *buffer);
-
- friend class QWaylandSurface;
- friend class RoleBase;
-};
-
-class SurfaceRole
-{
-public:
- const char *name;
-};
-
-class RoleBase
-{
-public:
- virtual ~RoleBase() {
- if (m_surface) {
- m_surface->m_roleHandler = 0; m_surface = 0;
- }
- }
-
-protected:
- RoleBase() : m_surface(0) {}
- static inline RoleBase *roleOf(Surface *s) { return s->m_roleHandler; }
-
- virtual void configure(int dx, int dy) = 0;
-
-private:
- Surface *m_surface;
- friend class Surface;
-};
-
-template<class T>
-class SurfaceRoleHandler : public RoleBase
-{
-public:
- static T *get(Surface *surface) {
- if (surface->role() == T::role()) {
- return static_cast<T *>(roleOf(surface));
- }
- return 0;
- }
-};
-
-template<class T>
-bool Surface::setRoleHandler(T *handler)
-{
- RoleBase *base = handler;
- if (m_role == T::role()) {
- m_roleHandler = base;
- base->m_surface = this;
- return true;
- }
- return false;
-}
-
-}
-
-QT_END_NAMESPACE
-
-#endif //WL_SURFACE_H
diff --git a/src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp b/src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp
index 1229d286f..f48dd3400 100644
--- a/src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp
+++ b/src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp
@@ -3,36 +3,32 @@
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Compositor.
+** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
+** 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.LGPLv3 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.html.
**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
**
** $QT_END_LICENSE$
**
@@ -40,9 +36,6 @@
#include "qwlsurfacebuffer_p.h"
-#include "qwlsurface_p.h"
-#include "qwlcompositor_p.h"
-
#ifdef QT_COMPOSITOR_WAYLAND_GL
#include "hardware_integration/qwlclientbufferintegration_p.h"
#include <qpa/qplatformopenglcontext.h>
@@ -53,11 +46,13 @@
#include <wayland-server-protocol.h>
#include "qwaylandshmformathelper.h"
+#include <QtWaylandCompositor/private/qwaylandcompositor_p.h>
+
QT_BEGIN_NAMESPACE
namespace QtWayland {
-SurfaceBuffer::SurfaceBuffer(Surface *surface)
+SurfaceBuffer::SurfaceBuffer(QWaylandSurface *surface)
: m_surface(surface)
, m_compositor(surface->compositor())
, m_buffer(0)
@@ -66,14 +61,8 @@ SurfaceBuffer::SurfaceBuffer(Surface *surface)
, m_surface_has_buffer(false)
, m_destroyed(false)
, m_is_displayed(false)
- , m_texture(0)
- , m_is_shm_resolved(false)
- , m_shmBuffer(0)
- , m_isSizeResolved(false)
- , m_size()
, m_used(false)
, m_destroyIfUnused(false)
- , m_image(0)
{
}
@@ -86,81 +75,30 @@ SurfaceBuffer::~SurfaceBuffer()
void SurfaceBuffer::initialize(struct ::wl_resource *buffer)
{
m_buffer = buffer;
- m_texture = 0;
m_committed = false;
m_is_registered_for_buffer = true;
m_surface_has_buffer = true;
m_is_displayed = false;
m_destroyed = false;
- m_handle = 0;
- m_is_shm_resolved = false;
- m_shmBuffer = 0;
- m_isSizeResolved = false;
- m_size = QSize();
m_destroy_listener.surfaceBuffer = this;
m_destroy_listener.listener.notify = destroy_listener_callback;
if (buffer) {
- ClientBufferIntegration *hwIntegration = m_compositor->clientBufferIntegration();
- hwIntegration->unlockNativeBuffer(m_handle);
- hwIntegration->initialize(buffer);
+ if (ClientBufferIntegration *integration = QWaylandCompositorPrivate::get(m_compositor)->clientBufferIntegration())
+ integration->initializeBuffer(buffer);
wl_signal_add(&buffer->destroy_signal, &m_destroy_listener.listener);
}
}
void SurfaceBuffer::destructBufferState()
{
- destroyTexture();
if (m_buffer) {
sendRelease();
-
- if (m_handle) {
- if (m_shmBuffer) {
- delete static_cast<QImage *>(m_handle);
-#ifdef QT_COMPOSITOR_WAYLAND_GL
- } else {
- ClientBufferIntegration *hwIntegration = m_compositor->clientBufferIntegration();
- hwIntegration->unlockNativeBuffer(m_handle);
-#endif
- }
- }
wl_list_remove(&m_destroy_listener.listener.link);
}
m_buffer = 0;
- m_handle = 0;
m_committed = false;
m_is_registered_for_buffer = false;
m_is_displayed = false;
- m_image = QImage();
-}
-
-QSize SurfaceBuffer::size() const
-{
- if (!m_isSizeResolved) {
- if (isShmBuffer()) {
- m_size = QSize(wl_shm_buffer_get_width(m_shmBuffer), wl_shm_buffer_get_height(m_shmBuffer));
-#ifdef QT_COMPOSITOR_WAYLAND_GL
- } else {
- ClientBufferIntegration *hwIntegration = m_compositor->clientBufferIntegration();
- m_size = hwIntegration->bufferSize(m_buffer);
-#endif
- }
- }
-
- return m_size;
-}
-
-bool SurfaceBuffer::isShmBuffer() const
-{
- if (!m_is_shm_resolved) {
-#if (WAYLAND_VERSION_MAJOR >= 1) && (WAYLAND_VERSION_MINOR >= 2)
- m_shmBuffer = wl_shm_buffer_get(m_buffer);
-#else
- if (wl_buffer_is_shm(static_cast<struct ::wl_buffer*>(m_buffer->data)))
- m_shmBuffer = static_cast<struct ::wl_buffer*>(m_buffer->data);
-#endif
- m_is_shm_resolved = true;
- }
- return m_shmBuffer != 0;
}
void SurfaceBuffer::sendRelease()
@@ -181,156 +119,120 @@ void SurfaceBuffer::setDisplayed()
m_is_displayed = true;
}
-void SurfaceBuffer::destroyTexture()
-{
-#ifdef QT_COMPOSITOR_WAYLAND_GL
- if (m_texture) {
- Q_ASSERT(QOpenGLContext::currentContext());
- ClientBufferIntegration *hwIntegration = m_compositor->clientBufferIntegration();
- if (hwIntegration->textureForBuffer(m_buffer) == 0)
- glDeleteTextures(1, &m_texture);
- else
- hwIntegration->destroyTextureForBuffer(m_buffer, m_texture);
- m_texture = 0;
- }
-#endif
-}
-
-uint SurfaceBuffer::textureTarget() const
+void SurfaceBuffer::destroy_listener_callback(wl_listener *listener, void *data)
{
-#ifdef QT_COMPOSITOR_WAYLAND_GL
- ClientBufferIntegration *hwIntegration = m_compositor->clientBufferIntegration();
- return hwIntegration->textureTargetForBuffer(m_buffer);
-#endif
+ Q_UNUSED(data);
+ struct surface_buffer_destroy_listener *destroy_listener =
+ reinterpret_cast<struct surface_buffer_destroy_listener *>(listener);
+ SurfaceBuffer *d = destroy_listener->surfaceBuffer;
- return 0;
+ // Mark the buffer as destroyed and clear m_buffer right away to avoid
+ // touching it before it is properly cleaned up.
+ d->m_destroyed = true;
+ d->m_buffer = 0;
}
-void SurfaceBuffer::handleAboutToBeDisplayed()
+void SurfaceBuffer::ref()
{
- qDebug() << Q_FUNC_INFO;
+ m_used = m_refCount.ref();
}
-void SurfaceBuffer::handleDisplayed()
+void SurfaceBuffer::deref()
{
- qDebug() << Q_FUNC_INFO;
+ m_used = m_refCount.deref();
+ if (!m_used)
+ disown();
}
-void *SurfaceBuffer::handle() const
+void SurfaceBuffer::setDestroyIfUnused(bool destroy)
{
- if (!m_buffer)
- return 0;
-
- if (!m_handle) {
- SurfaceBuffer *that = const_cast<SurfaceBuffer *>(this);
- if (isShmBuffer()) {
- const uchar *data = static_cast<const uchar *>(wl_shm_buffer_get_data(m_shmBuffer));
- int stride = wl_shm_buffer_get_stride(m_shmBuffer);
- int width = wl_shm_buffer_get_width(m_shmBuffer);
- int height = wl_shm_buffer_get_height(m_shmBuffer);
- QImage *image = new QImage(data,width,height,stride, QImage::Format_ARGB32_Premultiplied);
- that->m_handle = image;
-#ifdef QT_COMPOSITOR_WAYLAND_GL
- } else {
- ClientBufferIntegration *clientBufferIntegration = m_compositor->clientBufferIntegration();
- that->m_handle = clientBufferIntegration->lockNativeBuffer(m_buffer);
-#endif
- }
- }
- return m_handle;
+ m_destroyIfUnused = destroy;
+ destroyIfUnused();
}
-QImage SurfaceBuffer::image()
+void SurfaceBuffer::destroyIfUnused()
{
- /* This api may be available on non-shm buffer. But be sure about it's format. */
- if (!m_buffer || !isShmBuffer())
- return QImage();
-
- if (m_image.isNull())
- {
- const uchar *data = static_cast<const uchar *>(wl_shm_buffer_get_data(m_shmBuffer));
- int stride = wl_shm_buffer_get_stride(m_shmBuffer);
- int width = wl_shm_buffer_get_width(m_shmBuffer);
- int height = wl_shm_buffer_get_height(m_shmBuffer);
- QImage::Format format = QWaylandShmFormatHelper::fromWaylandShmFormat(wl_shm_format(wl_shm_buffer_get_format(m_shmBuffer)));
- m_image = QImage(data, width, height, stride, format);
- }
-
- return m_image;
+ if (!m_used && m_destroyIfUnused)
+ delete this;
}
-void SurfaceBuffer::destroy_listener_callback(wl_listener *listener, void *data)
+QSize SurfaceBuffer::size() const
{
- Q_UNUSED(data);
- struct surface_buffer_destroy_listener *destroy_listener =
- reinterpret_cast<struct surface_buffer_destroy_listener *>(listener);
- SurfaceBuffer *d = destroy_listener->surfaceBuffer;
-
- // Mark the buffer as destroyed and clear m_buffer right away to avoid
- // touching it before it is properly cleaned up.
- d->m_destroyed = true;
- d->m_buffer = 0;
-}
+ if (!m_buffer)
+ return QSize();
-void SurfaceBuffer::createTexture()
-{
- destroyTexture();
+ if (wl_shm_buffer *shmBuffer = wl_shm_buffer_get(m_buffer)) {
+ int width = wl_shm_buffer_get_width(shmBuffer);
+ int height = wl_shm_buffer_get_height(shmBuffer);
+ return QSize(width, height);
+ }
+ if (ClientBufferIntegration *integration = QWaylandCompositorPrivate::get(m_compositor)->clientBufferIntegration()) {
+ return integration->bufferSize(m_buffer);
+ }
- ClientBufferIntegration *hwIntegration = m_compositor->clientBufferIntegration();
-#ifdef QT_COMPOSITOR_WAYLAND_GL
- m_texture = hwIntegration->textureForBuffer(m_buffer);
- hwIntegration->bindTextureToBuffer(m_buffer);
-#else
- Q_UNUSED(hwIntegration);
-#endif
+ return QSize();
}
-void SurfaceBuffer::updateTexture()
+QWaylandSurface::Origin SurfaceBuffer::origin() const
{
-#ifdef QT_COMPOSITOR_WAYLAND_GL
- ClientBufferIntegration *hwIntegration = m_compositor->clientBufferIntegration();
- hwIntegration->updateTextureForBuffer(m_buffer);
-#endif
+ if (isShm()) {
+ return QWaylandSurface::OriginTopLeft;
+ }
+
+ if (ClientBufferIntegration *integration = QWaylandCompositorPrivate::get(m_compositor)->clientBufferIntegration()) {
+ return integration->origin(m_buffer);
+ }
+ return QWaylandSurface::OriginTopLeft;
}
-bool SurfaceBuffer::isYInverted() const
+QImage SurfaceBuffer::image() const
{
- bool ret = false;
- static bool negateReturn = qgetenv("QT_COMPOSITOR_NEGATE_INVERTED_Y").toInt();
- ClientBufferIntegration *clientBufferIntegration = m_compositor->clientBufferIntegration();
-
-#ifdef QT_COMPOSITOR_WAYLAND_GL
- if (clientBufferIntegration && waylandBufferHandle() && !isShmBuffer()) {
- ret = clientBufferIntegration->isYInverted(waylandBufferHandle());
- } else
-#endif
- ret = true;
+ if (wl_shm_buffer *shmBuffer = wl_shm_buffer_get(m_buffer)) {
+ int width = wl_shm_buffer_get_width(shmBuffer);
+ int height = wl_shm_buffer_get_height(shmBuffer);
+ int bytesPerLine = wl_shm_buffer_get_stride(shmBuffer);
+ uchar *data = static_cast<uchar *>(wl_shm_buffer_get_data(shmBuffer));
+ return QImage(data, width, height, bytesPerLine, QImage::Format_ARGB32_Premultiplied);
+ }
- return ret != negateReturn;
+ return QImage();
}
-void SurfaceBuffer::ref()
+void SurfaceBuffer::bindToTexture() const
{
- m_used = m_refCount.ref();
+ Q_ASSERT(m_compositor);
+ if (isShm()) {
+ QImage image = this->image();
+ if (image.hasAlphaChannel()) {
+ if (image.format() != QImage::Format_RGBA8888) {
+ image = image.convertToFormat(QImage::Format_RGBA8888);
+ }
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.width(), image.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, image.constBits());
+ } else {
+ if (image.format() != QImage::Format_RGBX8888) {
+ image = image.convertToFormat(QImage::Format_RGBX8888);
+ }
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, image.width(), image.height(), 0, GL_RGB, GL_UNSIGNED_BYTE, image.constBits());
+ }
+ } else {
+ if (QtWayland::ClientBufferIntegration *clientInt = QWaylandCompositorPrivate::get(m_compositor)->clientBufferIntegration()) {
+ clientInt->bindTextureToBuffer(m_buffer);
+ }
+ }
}
-void SurfaceBuffer::deref()
+int SurfaceBuffer::textureTarget() const
{
- m_used = m_refCount.deref();
- if (!m_used)
- disown();
-}
+ if (QtWayland::ClientBufferIntegration *clientInt = QWaylandCompositorPrivate::get(m_compositor)->clientBufferIntegration())
+ return clientInt->textureTargetForBuffer(m_buffer);
-void SurfaceBuffer::setDestroyIfUnused(bool destroy)
-{
- m_destroyIfUnused = destroy;
- destroyIfUnused();
+ return 0;
}
-void SurfaceBuffer::destroyIfUnused()
+void SurfaceBuffer::updateTexture() const
{
- if (!m_used && m_destroyIfUnused)
- delete this;
+ if (QtWayland::ClientBufferIntegration *clientInt = QWaylandCompositorPrivate::get(m_compositor)->clientBufferIntegration())
+ clientInt->updateTextureForBuffer(m_buffer);
}
}
diff --git a/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h b/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h
index eb7212dd4..a3866f285 100644
--- a/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h
+++ b/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h
@@ -3,36 +3,32 @@
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Compositor.
+** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
+** 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.LGPLv3 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.html.
**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
**
** $QT_END_LICENSE$
**
@@ -57,18 +53,18 @@
#include <QImage>
#include <QAtomicInt>
+#include <QtWaylandCompositor/QWaylandSurface>
+
#include <wayland-server.h>
QT_BEGIN_NAMESPACE
class QWaylandClientBufferIntegration;
class QWaylandBufferRef;
+class QWaylandCompositor;
namespace QtWayland {
-class Surface;
-class Compositor;
-
struct surface_buffer_destroy_listener
{
struct wl_listener listener;
@@ -78,18 +74,13 @@ struct surface_buffer_destroy_listener
class SurfaceBuffer
{
public:
- SurfaceBuffer(Surface *surface);
+ SurfaceBuffer(QWaylandSurface *surface);
~SurfaceBuffer();
void initialize(struct ::wl_resource *bufferResource);
void destructBufferState();
- QSize size() const;
-
- bool isShmBuffer() const;
- bool isYInverted() const;
-
inline bool isRegisteredWithBuffer() const { return m_is_registered_for_buffer; }
void sendRelease();
@@ -101,38 +92,29 @@ public:
inline void setCommitted() { m_committed = true; }
inline bool isDisplayed() const { return m_is_displayed; }
- inline bool textureCreated() const { return m_texture; }
-
bool isDestroyed() { return m_destroyed; }
- void createTexture();
- uint textureTarget() const;
- void updateTexture();
-#ifdef QT_COMPOSITOR_WAYLAND_GL
- inline GLuint texture() const;
-#else
- inline uint texture() const;
-#endif
-
- void destroyTexture();
-
inline struct ::wl_resource *waylandBufferHandle() const { return m_buffer; }
- void handleAboutToBeDisplayed();
- void handleDisplayed();
-
- void bufferWasDestroyed();
void setDestroyIfUnused(bool destroy);
- void *handle() const;
- QImage image();
+ QSize size() const;
+ QWaylandSurface::Origin origin() const;
+ bool isShm() const { return wl_shm_buffer_get(m_buffer); }
+
+ QImage image() const;
+ int textureTarget() const;
+ void bindToTexture() const;
+ void updateTexture() const;
+
+ static bool hasContent(SurfaceBuffer *buffer) { return buffer && buffer->waylandBufferHandle(); }
private:
void ref();
void deref();
void destroyIfUnused();
- Surface *m_surface;
- Compositor *m_compositor;
+ QWaylandSurface *m_surface;
+ QWaylandCompositor *m_compositor;
struct ::wl_resource *m_buffer;
struct surface_buffer_destroy_listener m_destroy_listener;
bool m_committed;
@@ -141,47 +123,16 @@ private:
bool m_destroyed;
bool m_is_displayed;
-#ifdef QT_COMPOSITOR_WAYLAND_GL
- GLuint m_texture;
-#else
- uint m_texture;
-#endif
- void *m_handle;
- mutable bool m_is_shm_resolved;
-
-#if (WAYLAND_VERSION_MAJOR >= 1) && (WAYLAND_VERSION_MINOR >= 2)
- mutable struct ::wl_shm_buffer *m_shmBuffer;
-#else
- mutable struct ::wl_buffer *m_shmBuffer;
-#endif
-
- mutable bool m_isSizeResolved;
- mutable QSize m_size;
+
QAtomicInt m_refCount;
bool m_used;
bool m_destroyIfUnused;
- QImage m_image;
-
static void destroy_listener_callback(wl_listener *listener, void *data);
friend class ::QWaylandBufferRef;
};
-#ifdef QT_COMPOSITOR_WAYLAND_GL
-GLuint SurfaceBuffer::texture() const
-{
- if (m_buffer)
- return m_texture;
- return 0;
-}
-#else
-uint SurfaceBuffer::texture() const
-{
- return 0;
-}
-#endif
-
}
QT_END_NAMESPACE
diff --git a/src/compositor/wayland_wrapper/qwltextinput.cpp b/src/compositor/wayland_wrapper/qwltextinput.cpp
deleted file mode 100644
index 992ca0dc5..000000000
--- a/src/compositor/wayland_wrapper/qwltextinput.cpp
+++ /dev/null
@@ -1,205 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwltextinput_p.h"
-
-#include "qwlcompositor_p.h"
-#include "qwlinputdevice_p.h"
-#include "qwlinputmethod_p.h"
-#include "qwlinputmethodcontext_p.h"
-#include "qwlinputpanel_p.h"
-#include "qwlsurface_p.h"
-
-#include <algorithm>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWayland {
-
-TextInput::TextInput(Compositor *compositor, struct ::wl_client *client, int id)
- : wl_text_input(client, id, 1)
- , m_compositor(compositor)
- , m_focus()
- , m_inputPanelVisible()
- , m_cursorRectangle()
-{
-}
-
-Surface *TextInput::focus() const
-{
- return m_focus;
-}
-
-bool TextInput::inputPanelVisible() const
-{
- return m_inputPanelVisible;
-}
-
-QRect TextInput::cursorRectangle() const
-{
- return m_cursorRectangle;
-}
-
-void TextInput::deactivate(InputMethod *inputMethod)
-{
- if (m_activeInputMethods.removeOne(inputMethod))
- inputMethod->deactivate();
-
- if (m_activeInputMethods.isEmpty())
- send_leave();
-}
-
-void TextInput::text_input_destroy_resource(Resource *)
-{
- Q_FOREACH (InputMethod *inputMethod, m_activeInputMethods) {
- deactivate(inputMethod);
- }
-
- delete this;
-}
-
-void TextInput::text_input_activate(Resource *, wl_resource *seat, wl_resource *surface)
-{
- Surface *oldSurface = m_focus;
- m_focus = Surface::fromResource(surface);
-
- if (oldSurface != m_focus)
- send_leave();
-
- bool wasEmpty = m_activeInputMethods.isEmpty();
-
- InputMethod *inputMethod = InputDevice::fromSeatResource(seat)->inputMethod();
-
- if (!m_activeInputMethods.contains(inputMethod)) {
- m_activeInputMethods.append(inputMethod);
- inputMethod->activate(this);
- }
-
- if (wasEmpty || oldSurface != m_focus)
- send_enter(surface);
-}
-
-void TextInput::text_input_deactivate(Resource *, wl_resource *seat)
-{
- InputMethod *inputMethod = InputDevice::fromSeatResource(seat)->inputMethod();
-
- deactivate(inputMethod);
-}
-
-static bool isInputMethodBound(InputMethod *inputMethod)
-{
- return inputMethod->isBound();
-}
-
-void TextInput::text_input_show_input_panel(Resource *)
-{
- m_inputPanelVisible = true;
-
- if (std::find_if(m_activeInputMethods.cbegin(), m_activeInputMethods.cend(), isInputMethodBound) != m_activeInputMethods.cend())
- m_compositor->inputPanel()->setInputPanelVisible(true);
-}
-
-void TextInput::text_input_hide_input_panel(Resource *)
-{
- m_inputPanelVisible = false;
-
- if (std::find_if(m_activeInputMethods.cbegin(), m_activeInputMethods.cend(), isInputMethodBound) != m_activeInputMethods.cend())
- m_compositor->inputPanel()->setInputPanelVisible(false);
-}
-
-void TextInput::text_input_set_cursor_rectangle(Resource *, int32_t x, int32_t y, int32_t width, int32_t height)
-{
- m_cursorRectangle = QRect(x, y, width, height);
-
- if (!m_activeInputMethods.isEmpty())
- m_compositor->inputPanel()->setCursorRectangle(m_cursorRectangle);
-}
-
-void TextInput::text_input_reset(Resource *)
-{
- Q_FOREACH (InputMethod *inputMethod, m_activeInputMethods) {
- if (inputMethod->context())
- inputMethod->context()->send_reset();
- }
-}
-
-void TextInput::text_input_commit_state(Resource *, uint32_t serial)
-{
- Q_FOREACH (InputMethod *inputMethod, m_activeInputMethods) {
- if (inputMethod->context())
- inputMethod->context()->send_commit_state(serial);
- }
-}
-
-void TextInput::text_input_set_content_type(Resource *, uint32_t hint, uint32_t purpose)
-{
- Q_FOREACH (InputMethod *inputMethod, m_activeInputMethods) {
- if (inputMethod->context())
- inputMethod->context()->send_content_type(hint, purpose);
- }
-}
-
-void TextInput::text_input_set_preferred_language(Resource *, const QString &language)
-{
- Q_FOREACH (InputMethod *inputMethod, m_activeInputMethods) {
- if (inputMethod->context())
- inputMethod->context()->send_preferred_language(language);
- }
-}
-
-void TextInput::text_input_set_surrounding_text(Resource *, const QString &text, uint32_t cursor, uint32_t anchor)
-{
- Q_FOREACH (InputMethod *inputMethod, m_activeInputMethods) {
- if (inputMethod->context())
- inputMethod->context()->send_surrounding_text(text, cursor, anchor);
- }
-}
-
-void TextInput::text_input_invoke_action(Resource *, uint32_t button, uint32_t index)
-{
- Q_FOREACH (InputMethod *inputMethod, m_activeInputMethods) {
- if (inputMethod->context())
- inputMethod->context()->send_invoke_action(button, index);
- }
-}
-
-} // namespace QtWayland
-
-QT_END_NAMESPACE
diff --git a/src/compositor/wayland_wrapper/qwltextinput_p.h b/src/compositor/wayland_wrapper/qwltextinput_p.h
deleted file mode 100644
index da09bca4f..000000000
--- a/src/compositor/wayland_wrapper/qwltextinput_p.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QTWAYLAND_QWLTEXTINPUT_P_H
-#define QTWAYLAND_QWLTEXTINPUT_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 <QtCompositor/private/qwayland-server-text.h>
-
-#include <QRect>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWayland {
-
-class Compositor;
-class InputMethod;
-class Surface;
-
-class TextInput : public QtWaylandServer::wl_text_input
-{
-public:
- explicit TextInput(Compositor *compositor, struct ::wl_client *client, int id);
-
- Surface *focus() const;
-
- bool inputPanelVisible() const;
- QRect cursorRectangle() const;
-
- void deactivate(InputMethod *inputMethod);
-
-protected:
- void text_input_destroy_resource(Resource *resource) Q_DECL_OVERRIDE;
-
- void text_input_activate(Resource *resource, wl_resource *seat, wl_resource *surface) Q_DECL_OVERRIDE;
- void text_input_deactivate(Resource *resource, wl_resource *seat) Q_DECL_OVERRIDE;
- void text_input_show_input_panel(Resource *resource) Q_DECL_OVERRIDE;
- void text_input_hide_input_panel(Resource *resource) Q_DECL_OVERRIDE;
- void text_input_reset(Resource *resource) Q_DECL_OVERRIDE;
- void text_input_commit_state(Resource *resource, uint32_t serial) Q_DECL_OVERRIDE;
- void text_input_set_content_type(Resource *resource, uint32_t hint, uint32_t purpose) Q_DECL_OVERRIDE;
- void text_input_set_cursor_rectangle(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) Q_DECL_OVERRIDE;
- void text_input_set_preferred_language(Resource *resource, const QString &language) Q_DECL_OVERRIDE;
- void text_input_set_surrounding_text(Resource *resource, const QString &text, uint32_t cursor, uint32_t anchor) Q_DECL_OVERRIDE;
- void text_input_invoke_action(Resource *resource, uint32_t button, uint32_t index) Q_DECL_OVERRIDE;
-
-private:
- Compositor *m_compositor;
- QList<InputMethod*> m_activeInputMethods;
- Surface *m_focus;
-
- bool m_inputPanelVisible;
- QRect m_cursorRectangle;
-
-};
-
-} // namespace QtWayland
-
-QT_END_NAMESPACE
-
-#endif // QTWAYLAND_QWLTEXTINPUT_P_H
diff --git a/src/compositor/wayland_wrapper/qwltextinputmanager.cpp b/src/compositor/wayland_wrapper/qwltextinputmanager.cpp
deleted file mode 100644
index ce16f01c9..000000000
--- a/src/compositor/wayland_wrapper/qwltextinputmanager.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwltextinputmanager_p.h"
-
-#include "qwlcompositor_p.h"
-#include "qwltextinput_p.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWayland {
-
-TextInputManager::TextInputManager(Compositor *compositor)
- : QtWaylandServer::wl_text_input_manager(compositor->wl_display(), 1)
- , m_compositor(compositor)
-{
-}
-
-TextInputManager::~TextInputManager()
-{
-}
-
-void TextInputManager::text_input_manager_create_text_input(Resource *resource, uint32_t id)
-{
- new TextInput(m_compositor, resource->client(), id);
-}
-
-} // namespace QtWayland
-
-QT_END_NAMESPACE
diff --git a/src/compositor/wayland_wrapper/qwltextinputmanager_p.h b/src/compositor/wayland_wrapper/qwltextinputmanager_p.h
deleted file mode 100644
index 4cb088e93..000000000
--- a/src/compositor/wayland_wrapper/qwltextinputmanager_p.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QTWAYLAND_QWLTEXTINPUTMANAGER_P_H
-#define QTWAYLAND_QWLTEXTINPUTMANAGER_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 <QtCompositor/private/qwayland-server-text.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWayland {
-
-class Compositor;
-
-class TextInputManager : public QtWaylandServer::wl_text_input_manager
-{
-public:
- TextInputManager(Compositor *compositor);
- ~TextInputManager();
-
-protected:
- void text_input_manager_create_text_input(Resource *resource, uint32_t id) Q_DECL_OVERRIDE;
-
-private:
- Compositor *m_compositor;
-};
-
-} // namespace QtWayland
-
-QT_END_NAMESPACE
-
-#endif // QTWAYLAND_QWLTEXTINPUTMANAGER_P_H
diff --git a/src/compositor/wayland_wrapper/qwltouch.cpp b/src/compositor/wayland_wrapper/qwltouch.cpp
deleted file mode 100644
index d15988940..000000000
--- a/src/compositor/wayland_wrapper/qwltouch.cpp
+++ /dev/null
@@ -1,187 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwltouch_p.h"
-
-#include "qwlcompositor_p.h"
-#include "qwlsurface_p.h"
-#include "qwaylandsurfaceview.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWayland {
-
-Touch::Touch(Compositor *compositor)
- : wl_touch()
- , m_compositor(compositor)
- , m_focus()
- , m_focusResource()
- , m_grab(this)
-{
- m_grab->setTouch(this);
- connect(&m_focusDestroyListener, &WlListener::fired, this, &Touch::focusDestroyed);
-}
-
-void Touch::setFocus(QWaylandSurfaceView *surface)
-{
- m_focusDestroyListener.reset();
- if (surface)
- m_focusDestroyListener.listenForDestruction(surface->surface()->handle()->resource()->handle);
-
- m_focus = surface;
- m_focusResource = surface ? resourceMap().value(surface->surface()->handle()->resource()->client()) : 0;
-}
-
-void Touch::startGrab(TouchGrabber *grab)
-{
- m_grab = grab;
- grab->setTouch(this);
-}
-
-void Touch::endGrab()
-{
- m_grab = this;
-}
-
-void Touch::focusDestroyed(void *data)
-{
- Q_UNUSED(data)
- m_focusDestroyListener.reset();
-
- m_focus = 0;
- m_focusResource = 0;
-}
-
-void Touch::touch_destroy_resource(Resource *resource)
-{
- if (m_focusResource == resource)
- m_focusResource = 0;
-}
-
-void Touch::touch_release(Resource *resource)
-{
- wl_resource_destroy(resource->handle);
-}
-
-void Touch::sendCancel()
-{
- if (m_focusResource)
- send_cancel(m_focusResource->handle);
-}
-
-void Touch::sendFrame()
-{
- if (m_focusResource)
- send_frame(m_focusResource->handle);
-}
-
-void Touch::sendDown(int touch_id, const QPointF &position)
-{
- m_grab->down(m_compositor->currentTimeMsecs(), touch_id, position);
-}
-
-void Touch::sendMotion(int touch_id, const QPointF &position)
-{
- m_grab->motion(m_compositor->currentTimeMsecs(), touch_id, position);
-}
-
-void Touch::sendUp(int touch_id)
-{
- m_grab->up(m_compositor->currentTimeMsecs(), touch_id);
-}
-
-void Touch::down(uint32_t time, int touch_id, const QPointF &position)
-{
- if (!m_focusResource || !m_focus)
- return;
-
- uint32_t serial = wl_display_next_serial(m_compositor->wl_display());
-
- send_down(m_focusResource->handle, serial, time, m_focus->surface()->handle()->resource()->handle, touch_id,
- wl_fixed_from_double(position.x()), wl_fixed_from_double(position.y()));
-}
-
-void Touch::up(uint32_t time, int touch_id)
-{
- if (!m_focusResource)
- return;
-
- uint32_t serial = wl_display_next_serial(m_compositor->wl_display());
-
- send_up(m_focusResource->handle, serial, time, touch_id);
-}
-
-void Touch::motion(uint32_t time, int touch_id, const QPointF &position)
-{
- if (!m_focusResource)
- return;
-
- send_motion(m_focusResource->handle, time, touch_id,
- wl_fixed_from_double(position.x()), wl_fixed_from_double(position.y()));
-}
-
-TouchGrabber::TouchGrabber()
- : m_touch(0)
-{
-}
-
-TouchGrabber::~TouchGrabber()
-{
-}
-
-const Touch *TouchGrabber::touch() const
-{
- return m_touch;
-}
-
-Touch *TouchGrabber::touch()
-{
- return m_touch;
-}
-
-void TouchGrabber::setTouch(Touch *touch)
-{
- m_touch = touch;
-}
-
-} // namespace QtWayland
-
-QT_END_NAMESPACE
diff --git a/src/compositor/wayland_wrapper/qwltouch_p.h b/src/compositor/wayland_wrapper/qwltouch_p.h
deleted file mode 100644
index febfb9303..000000000
--- a/src/compositor/wayland_wrapper/qwltouch_p.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QTWAYLAND_QWLTOUCH_P_H
-#define QTWAYLAND_QWLTOUCH_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 <QtCompositor/qwaylandexport.h>
-
-#include <QtCore/QPoint>
-#include <QtCore/QObject>
-
-#include <QtCompositor/private/qwayland-server-wayland.h>
-
-#include "qwllistener_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QWaylandSurfaceView;
-
-namespace QtWayland {
-
-class Compositor;
-class Surface;
-class Touch;
-
-class Q_COMPOSITOR_EXPORT TouchGrabber {
-public:
- TouchGrabber();
- virtual ~TouchGrabber();
-
- virtual void down(uint32_t time, int touch_id, const QPointF &position) = 0;
- virtual void up(uint32_t time, int touch_id) = 0;
- virtual void motion(uint32_t time, int touch_id, const QPointF &position) = 0;
-
- const Touch *touch() const;
- Touch *touch();
- void setTouch(Touch *touch);
-
-private:
- Touch *m_touch;
-};
-
-class Q_COMPOSITOR_EXPORT Touch : public QObject, public QtWaylandServer::wl_touch, public TouchGrabber
-{
-public:
- explicit Touch(Compositor *compositor);
-
- void setFocus(QWaylandSurfaceView *surface);
-
- void startGrab(TouchGrabber *grab);
- void endGrab();
-
- void sendCancel();
- void sendFrame();
-
- void sendDown(int touch_id, const QPointF &position);
- void sendMotion(int touch_id, const QPointF &position);
- void sendUp(int touch_id);
-
- void down(uint32_t time, int touch_id, const QPointF &position);
- void up(uint32_t time, int touch_id);
- void motion(uint32_t time, int touch_id, const QPointF &position);
-
-private:
- void focusDestroyed(void *data);
- void touch_destroy_resource(Resource *resource) Q_DECL_OVERRIDE;
- void touch_release(Resource *resource) Q_DECL_OVERRIDE;
-
- Compositor *m_compositor;
-
- QWaylandSurfaceView *m_focus;
- Resource *m_focusResource;
- WlListener m_focusDestroyListener;
-
- TouchGrabber *m_grab;
-};
-
-} // namespace QtWayland
-
-QT_END_NAMESPACE
-
-#endif // QTWAYLAND_QWLTOUCH_P_H
diff --git a/src/compositor/wayland_wrapper/wayland_wrapper.pri b/src/compositor/wayland_wrapper/wayland_wrapper.pri
index d65798711..91ccbe1f8 100644
--- a/src/compositor/wayland_wrapper/wayland_wrapper.pri
+++ b/src/compositor/wayland_wrapper/wayland_wrapper.pri
@@ -1,69 +1,23 @@
CONFIG += wayland-scanner
WAYLANDSERVERSOURCES += \
- ../extensions/surface-extension.xml \
- ../extensions/touch-extension.xml \
- ../extensions/qtkey-extension.xml \
- ../extensions/windowmanager.xml \
../3rdparty/protocol/wayland.xml \
- ../3rdparty/protocol/input-method.xml \
- ../3rdparty/protocol/text.xml
HEADERS += \
- wayland_wrapper/qwlcompositor_p.h \
wayland_wrapper/qwldatadevice_p.h \
wayland_wrapper/qwldatadevicemanager_p.h \
wayland_wrapper/qwldataoffer_p.h \
wayland_wrapper/qwldatasource_p.h \
- wayland_wrapper/qwldisplay_p.h \
- wayland_wrapper/qwlextendedsurface_p.h \
- wayland_wrapper/qwlinputdevice_p.h \
- wayland_wrapper/qwlinputmethod_p.h \
- wayland_wrapper/qwlinputmethodcontext_p.h \
- wayland_wrapper/qwlinputpanel_p.h \
- wayland_wrapper/qwlinputpanelsurface_p.h \
- wayland_wrapper/qwlkeyboard_p.h \
- wayland_wrapper/qwloutput_p.h \
- wayland_wrapper/qwlpointer_p.h \
- wayland_wrapper/qwlqtkey_p.h \
- wayland_wrapper/qwlqttouch_p.h \
wayland_wrapper/qwlregion_p.h \
- wayland_wrapper/qwlshellsurface_p.h \
- wayland_wrapper/qwlsubsurface_p.h \
- wayland_wrapper/qwlsurface_p.h \
wayland_wrapper/qwlsurfacebuffer_p.h \
- wayland_wrapper/qwltextinput_p.h \
- wayland_wrapper/qwltextinputmanager_p.h \
- wayland_wrapper/qwltouch_p.h \
- wayland_wrapper/qwllistener_p.h \
../shared/qwaylandxkb.h \
SOURCES += \
- wayland_wrapper/qwlcompositor.cpp \
wayland_wrapper/qwldatadevice.cpp \
wayland_wrapper/qwldatadevicemanager.cpp \
wayland_wrapper/qwldataoffer.cpp \
wayland_wrapper/qwldatasource.cpp \
- wayland_wrapper/qwldisplay.cpp \
- wayland_wrapper/qwlextendedsurface.cpp \
- wayland_wrapper/qwlinputdevice.cpp \
- wayland_wrapper/qwlinputmethod.cpp \
- wayland_wrapper/qwlinputmethodcontext.cpp \
- wayland_wrapper/qwlinputpanel.cpp \
- wayland_wrapper/qwlinputpanelsurface.cpp \
- wayland_wrapper/qwlkeyboard.cpp \
- wayland_wrapper/qwloutput.cpp \
- wayland_wrapper/qwlpointer.cpp \
- wayland_wrapper/qwlqtkey.cpp \
- wayland_wrapper/qwlqttouch.cpp \
wayland_wrapper/qwlregion.cpp \
- wayland_wrapper/qwlshellsurface.cpp \
- wayland_wrapper/qwlsubsurface.cpp \
- wayland_wrapper/qwlsurface.cpp \
wayland_wrapper/qwlsurfacebuffer.cpp \
- wayland_wrapper/qwltextinput.cpp \
- wayland_wrapper/qwltextinputmanager.cpp \
- wayland_wrapper/qwltouch.cpp \
- wayland_wrapper/qwllistener.cpp \
../shared/qwaylandxkb.cpp \
INCLUDEPATH += wayland_wrapper