KWin
Loading...
Searching...
No Matches
touch_input.h
Go to the documentation of this file.
1/*
2 KWin - the KDE window manager
3 This file is part of the KDE project.
4
5 SPDX-FileCopyrightText: 2013, 2016 Martin Gräßlin <mgraesslin@kde.org>
6 SPDX-FileCopyrightText: 2018 Roman Gilg <subdiff@gmail.com>
7
8 SPDX-License-Identifier: GPL-2.0-or-later
9*/
10#pragma once
11#include "input.h"
12
13#include <QHash>
14#include <QObject>
15#include <QPointF>
16#include <QPointer>
17
18namespace KWin
19{
20
21class InputDevice;
22class InputRedirection;
23class Window;
24
25namespace Decoration
26{
27class DecoratedClientImpl;
28}
29
30class KWIN_EXPORT TouchInputRedirection : public InputDeviceHandler
31{
32 Q_OBJECT
33public:
36
37 bool positionValid() const override;
38 bool focusUpdatesBlocked() override;
39 void init() override;
40
41 void processDown(qint32 id, const QPointF &pos, std::chrono::microseconds time, InputDevice *device = nullptr);
42 void processUp(qint32 id, std::chrono::microseconds time, InputDevice *device = nullptr);
43 void processMotion(qint32 id, const QPointF &pos, std::chrono::microseconds time, InputDevice *device = nullptr);
44 void cancel();
45 void frame();
46
47 void setDecorationPressId(qint32 id)
48 {
49 m_decorationId = id;
50 }
51 qint32 decorationPressId() const
52 {
53 return m_decorationId;
54 }
55 void setInternalPressId(qint32 id)
56 {
57 m_internalId = id;
58 }
59 qint32 internalPressId() const
60 {
61 return m_internalId;
62 }
63
64 QPointF position() const override
65 {
66 return m_lastPosition;
67 }
68
69 int touchPointCount() const
70 {
71 return m_activeTouchPoints.count();
72 }
73
74private:
75 void cleanupDecoration(Decoration::DecoratedClientImpl *old, Decoration::DecoratedClientImpl *now) override;
76
77 void focusUpdate(Window *focusOld, Window *focusNow) override;
78
79 QSet<qint32> m_activeTouchPoints;
80 qint32 m_decorationId = -1;
81 qint32 m_internalId = -1;
82 QMetaObject::Connection m_focusGeometryConnection;
83 bool m_windowUpdatedInCycle = false;
84 QPointF m_lastPosition;
85};
86
87}
This class is responsible for redirecting incoming input to the surface which currently has input or ...
Definition input.h:70
void setDecorationPressId(qint32 id)
Definition touch_input.h:47
qint32 decorationPressId() const
Definition touch_input.h:51
qint32 internalPressId() const
Definition touch_input.h:59
QPointF position() const override
Definition touch_input.h:64
void setInternalPressId(qint32 id)
Definition touch_input.h:55