50
50
property bool holding: false
51
51
property bool wasMoved: false
52
52
property bool scrolling: false
53
+ property int pressedTime: - 1
53
54
54
55
PageHeader {
55
56
id: header
@@ -125,11 +126,16 @@ Page {
125
126
acceptedButtons: Qt .AllButtons // FIXME: is ignored
126
127
127
128
onPressed: {
129
+ console .log (" pressed" , wasMoved, mouse .x , mouse .y )
128
130
wasMoved = false
131
+ lastX = mouse .x
132
+ lastY = mouse .y
133
+ pressedTime = Date .now ()
129
134
scrolling = ((touchpad .x + touchpad .width - mouse .x ) < Theme .itemSizeSmall )
130
135
}
131
136
132
137
onPositionChanged: {
138
+ console .log (" moved" , pressed, mouse .x - lastX, mouse .y - lastY)
133
139
if (pressed) {
134
140
if (lastX !== 0xDEAD && plugin !== null ) {
135
141
if (scrolling) {
@@ -146,14 +152,19 @@ Page {
146
152
}
147
153
148
154
onReleased: {
155
+ console .log (" released" )
149
156
lastX = lastY = 0xDEAD
150
157
scrolling = false
151
158
}
152
159
153
160
onClicked: {
154
- if (! wasMoved && plugin !== null ) {
161
+ console .log (" clicked" , wasMoved)
162
+ if (plugin !== null ) {
155
163
if (! holding) {
156
- plugin .sendCommand ({" singleclick" : true })
164
+ var clickPeriod = Date .now () - pressedTime
165
+ if (clickPeriod <= 500 ) {
166
+ plugin .sendCommand ({" singleclick" : true })
167
+ }
157
168
} else {
158
169
plugin .sendCommand ({" singlerelease" : true })
159
170
holding = false
@@ -162,6 +173,7 @@ Page {
162
173
}
163
174
164
175
onDoubleClicked: {
176
+ console .log (" double clicked" , wasMoved)
165
177
if (! wasMoved && plugin !== null ) {
166
178
if (! holding) {
167
179
plugin .sendCommand ({" doubleclick" : true })
@@ -173,6 +185,7 @@ Page {
173
185
}
174
186
175
187
onPressAndHold: {
188
+ console .log (" pressed and hold" , wasMoved)
176
189
if (! wasMoved && plugin !== null ) {
177
190
plugin .sendCommand ({" singlehold" : true })
178
191
holding = true
0 commit comments