@@ -62,7 +62,7 @@ internal class GodotGestureHandler : SimpleOnGestureListener(), OnScaleGestureLi
6262 private var pointerCaptureInProgress = false
6363
6464 override fun onDown (event : MotionEvent ): Boolean {
65- GodotInputHandler .handleMotionEvent(event.source , MotionEvent .ACTION_DOWN , event.buttonState, event.x, event.y , nextDownIsDoubleTap)
65+ GodotInputHandler .handleMotionEvent(event, MotionEvent .ACTION_DOWN , nextDownIsDoubleTap)
6666 nextDownIsDoubleTap = false
6767 return true
6868 }
@@ -82,20 +82,14 @@ internal class GodotGestureHandler : SimpleOnGestureListener(), OnScaleGestureLi
8282 }
8383
8484 // Cancel the previous down event
85- GodotInputHandler .handleMotionEvent(
86- event.source,
87- MotionEvent .ACTION_CANCEL ,
88- event.buttonState,
89- event.x,
90- event.y
91- )
85+ GodotInputHandler .handleMotionEvent(event, MotionEvent .ACTION_CANCEL )
9286
9387 // Turn a context click into a single tap right mouse button click.
9488 GodotInputHandler .handleMouseEvent(
89+ event,
9590 MotionEvent .ACTION_DOWN ,
9691 MotionEvent .BUTTON_SECONDARY ,
97- event.x,
98- event.y
92+ false
9993 )
10094 contextClickInProgress = true
10195 }
@@ -107,16 +101,7 @@ internal class GodotGestureHandler : SimpleOnGestureListener(), OnScaleGestureLi
107101
108102 if (! hasCapture) {
109103 // Dispatch a mouse relative ACTION_UP event to signal the end of the capture
110- GodotInputHandler .handleMouseEvent(
111- MotionEvent .ACTION_UP ,
112- 0 ,
113- 0f ,
114- 0f ,
115- 0f ,
116- 0f ,
117- false ,
118- true
119- )
104+ GodotInputHandler .handleMouseEvent(MotionEvent .ACTION_UP , true )
120105 }
121106 pointerCaptureInProgress = hasCapture
122107 }
@@ -139,26 +124,11 @@ internal class GodotGestureHandler : SimpleOnGestureListener(), OnScaleGestureLi
139124 return true
140125 }
141126
142- val sourceMouseRelative = if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .O ) {
143- event.isFromSource(InputDevice .SOURCE_MOUSE_RELATIVE )
144- } else {
145- false
146- }
147-
148127 if (pointerCaptureInProgress || dragInProgress || contextClickInProgress) {
149128 if (contextClickInProgress || GodotInputHandler .isMouseEvent(event)) {
150129 // This may be an ACTION_BUTTON_RELEASE event which we don't handle,
151130 // so we convert it to an ACTION_UP event.
152- GodotInputHandler .handleMouseEvent(
153- MotionEvent .ACTION_UP ,
154- event.buttonState,
155- event.x,
156- event.y,
157- 0f ,
158- 0f ,
159- false ,
160- sourceMouseRelative
161- )
131+ GodotInputHandler .handleMouseEvent(event, MotionEvent .ACTION_UP )
162132 } else {
163133 GodotInputHandler .handleTouchEvent(event)
164134 }
@@ -173,21 +143,7 @@ internal class GodotGestureHandler : SimpleOnGestureListener(), OnScaleGestureLi
173143
174144 private fun onActionMove (event : MotionEvent ): Boolean {
175145 if (contextClickInProgress) {
176- val sourceMouseRelative = if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .O ) {
177- event.isFromSource(InputDevice .SOURCE_MOUSE_RELATIVE )
178- } else {
179- false
180- }
181- GodotInputHandler .handleMouseEvent(
182- event.actionMasked,
183- MotionEvent .BUTTON_SECONDARY ,
184- event.x,
185- event.y,
186- 0f ,
187- 0f ,
188- false ,
189- sourceMouseRelative
190- )
146+ GodotInputHandler .handleMouseEvent(event, event.actionMasked, MotionEvent .BUTTON_SECONDARY , false )
191147 return true
192148 }
193149 return false
@@ -197,7 +153,7 @@ internal class GodotGestureHandler : SimpleOnGestureListener(), OnScaleGestureLi
197153 if (event.actionMasked == MotionEvent .ACTION_UP ) {
198154 nextDownIsDoubleTap = false
199155 GodotInputHandler .handleMotionEvent(event)
200- } else if (event.actionMasked == MotionEvent .ACTION_MOVE && panningAndScalingEnabled == false ) {
156+ } else if (event.actionMasked == MotionEvent .ACTION_MOVE && ! panningAndScalingEnabled) {
201157 GodotInputHandler .handleMotionEvent(event)
202158 }
203159
@@ -219,13 +175,7 @@ internal class GodotGestureHandler : SimpleOnGestureListener(), OnScaleGestureLi
219175 if (dragInProgress) {
220176 if (originEvent != null ) {
221177 // Cancel the drag
222- GodotInputHandler .handleMotionEvent(
223- originEvent.source,
224- MotionEvent .ACTION_CANCEL ,
225- originEvent.buttonState,
226- originEvent.x,
227- originEvent.y
228- )
178+ GodotInputHandler .handleMotionEvent(originEvent, MotionEvent .ACTION_CANCEL )
229179 }
230180 dragInProgress = false
231181 }
0 commit comments