-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinteractionsource.cpp
More file actions
46 lines (39 loc) · 823 Bytes
/
interactionsource.cpp
File metadata and controls
46 lines (39 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "interactionsource.h"
#include <QCoreApplication>
#include <QDebug>
InteractionSource &
InteractionSource::instance()
{
static InteractionSource source;
QCoreApplication::instance()->installNativeEventFilter(&source);
return source;
}
bool
InteractionSource::isBlockClicksDown()
{
return _metaDown && !(_zDown || _xDown);
}
bool
InteractionSource::isRightClickDown()
{
return _metaDown && _zDown;
}
bool
InteractionSource::isDoubleClickDown()
{
return _metaDown && _xDown;
}
bool
InteractionSource::isLeftButtonDown()
{
return _leftButtonDown;
}
void
InteractionSource::_timerExpired()
{
if (_distanceSinceLastTimer > 5)
emit userDwelled();
else
qDebug() << "Ignored small move:" << _distanceSinceLastTimer << "pixels";
_distanceSinceLastTimer = 0;
}