2
* GesturalWindowSwitcher.h
3
* This file is part of Unity
5
* Copyright (C) 2012 - Canonical Ltd.
7
* Unity is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 2 of the License, or
10
* (at your option) any later version.
12
* Unity is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20
* Authored by: Daniel d'Andrada <daniel.dandrada@canonical.com>
23
#ifndef GESTURAL_WINDOW_SWITCHER_H
24
#define GESTURAL_WINDOW_SWITCHER_H
26
#include <Nux/Gesture.h>
27
#include "CompoundGestureRecognizer.h"
28
#include "SwitcherController.h"
29
#include <core/timer.h>
35
class GesturalWindowSwitcherPrivate;
38
Manipulates the window switcher according to multi-touch gestures
40
The following gestural interactions with the window switcher are implemented:
42
1. 3-fingers double tap -> switches to previous window
44
2. 3-fingers tap followed by 3-fingers hold -> shows window switcher
45
- drag those 3-fingers -> change selected window icon
46
- release fingers -> selects window and closes switcher
48
3. 3-fingers tap followed by 3-fingers hold -> shows window switcher
49
- release fingers -> switcher will kept being shown for some seconds still
50
- drag with one or three fingers -> change selected window
51
- release finger(s) -> selects window and closes switcher
53
4. 3-fingers tap followed by 3-fingers hold -> shows window switcher
54
- release fingers -> switcher will kept being shown for some seconds still
55
- tap on some window icon -> selects that icon and closes the switcher
58
class GesturalWindowSwitcher : public nux::GestureTarget
61
GesturalWindowSwitcher();
62
virtual ~GesturalWindowSwitcher();
65
static const int SWITCHER_TIME_AFTER_DOUBLE_TAP = 350;
66
static const int SWITCHER_TIME_AFTER_HOLD_RELEASED = 7000;
68
// How far, in screen pixels, a drag gesture must go in order
69
// to trigger a change in the selected window.
70
static const float DRAG_DELTA_FOR_CHANGING_SELECTION;
72
// How far, in screen pixels, a mouse pointer must move in order
73
// to be considered dragging the switcher.
74
static const float MOUSE_DRAG_THRESHOLD;
76
virtual nux::GestureDeliveryRequest GestureEvent(nux::GestureEvent const& event);
79
GesturalWindowSwitcherPrivate* p;
81
typedef std::shared_ptr<GesturalWindowSwitcher> ShPtGesturalWindowSwitcher;
85
#endif // GESTURAL_WINDOW_SWITCHER_H