~feng-kylin/unity8/OpenUrlInIndicator

« back to all changes in this revision

Viewing changes to libs/UbuntuGestures/UnownedTouchEvent.h

  • Committer: Daniel d'Andrada
  • Date: 2014-10-01 13:20:32 UTC
  • mto: (1354.2.4 unity8-update-quicklist)
  • mto: This revision was merged to the branch mainline in revision 1364.
  • Revision ID: daniel.dandrada@canonical.com-20141001132032-t4ag3a1or9k2fwz8
Add touch ownership logic on top of qt input handling

It does mainly 3 things:
- Adds TouchRegistry.
- Adds TouchGate
- Modifies DirectionalDragArea so that it uses TouchRegistry and only grabs a touch once it has recognized a gesture done by it.

TouchRegistry was put into a library as both unity8 and Ubuntu.Gestures plugin need to use it.

The next step is to have surfaces participating in the touch ownership negotiation. But for now they're put behind TouchGates so that they only receive thouches whose ownership has already been settled.

The most noticeable improvement of this patch is that taps near screen edges will now reach applications.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2014 Canonical, Ltd.
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; version 3.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 */
 
16
 
 
17
#ifndef UBUNTU_UNOWNEDTOUCHEVENT_H
 
18
#define UBUNTU_UNOWNEDTOUCHEVENT_H
 
19
 
 
20
#include <QTouchEvent>
 
21
#include <QScopedPointer>
 
22
#include "UbuntuGesturesGlobal.h"
 
23
 
 
24
/*
 
25
 A touch event with touch points that do not belong the item receiving it.
 
26
 
 
27
 See TouchRegistry::addCandidateOwnerForTouch and TouchRegistry::addTouchWatcher
 
28
 */
 
29
class UBUNTUGESTURES_EXPORT UnownedTouchEvent : public QEvent
 
30
{
 
31
public:
 
32
    UnownedTouchEvent(QTouchEvent *touchEvent);
 
33
    static Type unownedTouchEventType();
 
34
 
 
35
    // TODO: It might be cleaner to store the information directly in UnownedTouchEvent
 
36
    //       instead of carrying around a synthesized QTouchEvent. But the latter option
 
37
    //       is very convenient.
 
38
    QTouchEvent *touchEvent();
 
39
 
 
40
private:
 
41
    static Type m_unownedTouchEventType;
 
42
    QScopedPointer<QTouchEvent> m_touchEvent;
 
43
};
 
44
 
 
45
#endif // UBUNTU_UNOWNEDTOUCHEVENT_H