summaryrefslogtreecommitdiffstats
path: root/src/compositor/wayland_wrapper/qwlinputdevice.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/compositor/wayland_wrapper/qwlinputdevice.cpp')
-rw-r--r--src/compositor/wayland_wrapper/qwlinputdevice.cpp311
1 files changed, 0 insertions, 311 deletions
diff --git a/src/compositor/wayland_wrapper/qwlinputdevice.cpp b/src/compositor/wayland_wrapper/qwlinputdevice.cpp
deleted file mode 100644
index 12c38bf83..000000000
--- a/src/compositor/wayland_wrapper/qwlinputdevice.cpp
+++ /dev/null
@@ -1,311 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $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.
-**
-** 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.
-**
-** 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$
-**
-****************************************************************************/
-
-#include "qwlinputdevice_p.h"
-
-#include <QtCompositor/QWaylandCompositor>
-#include <QtCompositor/private/qwaylandcompositor_p.h>
-#include "qwldatadevice_p.h"
-#include "qwlinputmethod_p.h"
-#include "qwlqttouch_p.h"
-#include "qwlqtkey_p.h"
-#include "qwaylanddrag.h"
-#include "qwlpointer_p.h"
-#include "qwlkeyboard_p.h"
-#include "qwltouch_p.h"
-#include "qwaylandview.h"
-#include <QtCompositor/QWaylandClient>
-
-#include <QtGui/QTouchEvent>
-
-QT_BEGIN_NAMESPACE
-
-QWaylandInputDevicePrivate::QWaylandInputDevicePrivate(QWaylandInputDevice *inputdevice, QWaylandCompositor *compositor)
- : QObjectPrivate()
- , QtWaylandServer::wl_seat(compositor->display(), 3)
- , m_dragHandle(new QWaylandDrag(inputdevice))
- , m_compositor(compositor)
- , m_outputSpace(compositor->primaryOutputSpace())
- , m_mouseFocus(Q_NULLPTR)
- , m_capabilities()
- , m_inputMethod(m_compositor->extensionFlags() & QWaylandCompositor::TextInputExtension ? new QtWayland::InputMethod(m_compositor, inputdevice) : 0)
- , m_data_device()
-{
-}
-
-QWaylandInputDevicePrivate::~QWaylandInputDevicePrivate()
-{
-}
-
-QWaylandPointer *QWaylandInputDevicePrivate::pointerDevice() const
-{
- return m_pointer.data();
-}
-
-QWaylandKeyboard *QWaylandInputDevicePrivate::keyboardDevice() const
-{
- return m_keyboard.data();
-}
-
-QWaylandTouch *QWaylandInputDevicePrivate::touchDevice() const
-{
- return m_touch.data();
-}
-
-QtWayland::InputMethod *QWaylandInputDevicePrivate::inputMethod()
-{
- return m_inputMethod.data();
-}
-
-
-void QWaylandInputDevicePrivate::seat_destroy_resource(wl_seat::Resource *)
-{
-// cleanupDataDeviceForClient(resource->client(), true);
-}
-
-void QWaylandInputDevicePrivate::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 QWaylandInputDevicePrivate::setCapabilities(QWaylandInputDevice::CapabilityFlags caps)
-{
- Q_Q(QWaylandInputDevice);
- if (m_capabilities != caps) {
- QWaylandInputDevice::CapabilityFlags changed = caps ^ m_capabilities;
-
- if (changed & QWaylandInputDevice::Pointer) {
- m_pointer.reset(m_pointer.isNull() ? QWaylandCompositorPrivate::get(compositor())->callCreatePointerDevice(q) : 0);
- }
-
- if (changed & QWaylandInputDevice::Keyboard) {
- m_keyboard.reset(m_keyboard.isNull() ? QWaylandCompositorPrivate::get(compositor())->callCreateKeyboardDevice(q) : 0);
- }
-
- if (changed & QWaylandInputDevice::Touch) {
- m_touch.reset(m_touch.isNull() ? QWaylandCompositorPrivate::get(compositor())->callCreateTouchDevice(q) : 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 QWaylandInputDevicePrivate::seat_get_pointer(wl_seat::Resource *resource, uint32_t id)
-{
- if (!m_pointer.isNull()) {
- m_pointer->addClient(QWaylandClient::fromWlClient(m_compositor, resource->client()), id);
- }
-}
-
-void QWaylandInputDevicePrivate::seat_get_keyboard(wl_seat::Resource *resource, uint32_t id)
-{
- if (!m_keyboard.isNull()) {
- m_keyboard->addClient(QWaylandClient::fromWlClient(m_compositor, resource->client()), id);
- }
-}
-
-void QWaylandInputDevicePrivate::seat_get_touch(wl_seat::Resource *resource, uint32_t id)
-{
- if (!m_touch.isNull()) {
- m_touch->addClient(QWaylandClient::fromWlClient(m_compositor, resource->client()), id);
- }
-}
-
-void QWaylandInputDevicePrivate::sendMousePressEvent(Qt::MouseButton button)
-{
- pointerDevice()->sendMousePressEvent(button);
-}
-
-void QWaylandInputDevicePrivate::sendMouseReleaseEvent(Qt::MouseButton button)
-{
- pointerDevice()->sendMouseReleaseEvent(button);
-}
-
-void QWaylandInputDevicePrivate::sendMouseMoveEvent(QWaylandView *view, const QPointF &localPos, const QPointF &globalPos)
-{
- pointerDevice()->sendMouseMoveEvent(view, localPos,globalPos);
-}
-
-void QWaylandInputDevicePrivate::sendMouseWheelEvent(Qt::Orientation orientation, int delta)
-{
- pointerDevice()->sendMouseWheelEvent(orientation, delta);
-}
-
-void QWaylandInputDevicePrivate::sendTouchPointEvent(int id, const QPointF &point, Qt::TouchPointState state)
-{
- if (m_touch.isNull()) {
- return;
- }
- m_touch->sendTouchPointEvent(id, point,state);
-}
-
-void QWaylandInputDevicePrivate::sendTouchFrameEvent()
-{
- if (!m_touch.isNull()) {
- m_touch->sendFrameEvent();
- }
-}
-
-void QWaylandInputDevicePrivate::sendTouchCancelEvent()
-{
- if (!m_touch.isNull()) {
- m_touch->sendCancelEvent();
- }
-}
-
-void QWaylandInputDevicePrivate::sendFullKeyEvent(QKeyEvent *event)
-{
- if (!keyboardFocus()) {
- qWarning("Cannot send key event, no keyboard focus, fix the compositor");
- return;
- }
-
- QtWayland::QtKeyExtensionGlobal *ext = QtWayland::QtKeyExtensionGlobal::findIn(m_compositor);
- 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 QWaylandInputDevicePrivate::sendFullKeyEvent(QWaylandSurface *surface, QKeyEvent *event)
-{
- QtWayland::QtKeyExtensionGlobal *ext = QtWayland::QtKeyExtensionGlobal::findIn(m_compositor);
- if (ext)
- ext->postQtKeyEvent(event, surface);
-}
-
-void QWaylandInputDevicePrivate::sendFullTouchEvent(QTouchEvent *event)
-{
- if (!mouseFocus()) {
- qWarning("Cannot send touch event, no pointer focus, fix the compositor");
- return;
- }
-
- if (!m_touch)
- return;
-
- m_touch->sendFullTouchEvent(event);
-}
-
-QWaylandSurface *QWaylandInputDevicePrivate::keyboardFocus() const
-{
- if (m_keyboard.isNull() || !m_keyboard->focus())
- return Q_NULLPTR;
-
- return m_keyboard->focus();
-}
-
-/*!
- * \return True if the keyboard focus is changed successfully. False for inactive transient surfaces.
- */
-bool QWaylandInputDevicePrivate::setKeyboardFocus(QWaylandSurface *surface)
-{
- if (surface && surface->isDestroyed())
- return false;
-
- if (!m_keyboard.isNull() && m_keyboard->setFocus(surface)) {
- if (m_data_device)
- m_data_device->setFocus(m_keyboard->focusClient());
- return true;
- }
- return false;
-}
-
-QWaylandView *QWaylandInputDevicePrivate::mouseFocus() const
-{
- return m_mouseFocus;
-}
-
-void QWaylandInputDevicePrivate::setMouseFocus(QWaylandView *focus)
-{
- Q_Q(QWaylandInputDevice);
- if (focus == m_mouseFocus)
- return;
-
- QWaylandView *oldFocus = m_mouseFocus;
- m_mouseFocus = focus;
- q->mouseFocusChanged(m_mouseFocus, oldFocus);
-}
-
-void QWaylandInputDevicePrivate::clientRequestedDataDevice(QtWayland::DataDeviceManager *, struct wl_client *client, uint32_t id)
-{
- Q_Q(QWaylandInputDevice);
- if (!m_data_device)
- m_data_device.reset(new QtWayland::DataDevice(q));
- m_data_device->add(client, id, 1);
-}
-
-QWaylandCompositor *QWaylandInputDevicePrivate::compositor() const
-{
- return m_compositor;
-}
-
-QWaylandDrag *QWaylandInputDevicePrivate::dragHandle() const
-{
- return m_dragHandle.data();
-}
-
-const QtWayland::DataDevice *QWaylandInputDevicePrivate::dataDevice() const
-{
- return m_data_device.data();
-}
-
-QWaylandOutputSpace *QWaylandInputDevicePrivate::outputSpace() const
-{
- return m_outputSpace;
-}
-
-void QWaylandInputDevicePrivate::setOutputSpace(QWaylandOutputSpace *outputSpace)
-{
- m_outputSpace = outputSpace;
-}
-
-QWaylandInputDevicePrivate *QWaylandInputDevicePrivate::get(QWaylandInputDevice *device)
-{
- return device->d_func();
-}
-
-QT_END_NAMESPACE