|
1 | 1 | package net.kdt.pojavlaunch; |
2 | 2 |
|
3 | 3 | import static net.kdt.pojavlaunch.MainActivity.touchCharInput; |
| 4 | +import static net.kdt.pojavlaunch.prefs.LauncherPreferences.PREF_MOUSE_GRAB_FORCE; |
4 | 5 | import static net.kdt.pojavlaunch.utils.MCOptionUtils.getMcScale; |
5 | 6 | import static org.lwjgl.glfw.CallbackBridge.sendMouseButton; |
6 | 7 | import static org.lwjgl.glfw.CallbackBridge.windowHeight; |
@@ -193,6 +194,13 @@ public boolean onTouchEvent(MotionEvent e) { |
193 | 194 | if(toolType == MotionEvent.TOOL_TYPE_MOUSE) { |
194 | 195 | if(Tools.isAndroid8OrHigher() && |
195 | 196 | mPointerCapture != null) { |
| 197 | + // Can't handleAutomaticCapture if mouse isn't captured |
| 198 | + if (!CallbackBridge.isGrabbing() // Only capture if not in menu and user said so |
| 199 | + && !PREF_MOUSE_GRAB_FORCE) { |
| 200 | + // This returns true but we really can't consume this. |
| 201 | + // Else we don't receive ACTION_MOVE |
| 202 | + return !dispatchGenericMotionEvent(e); |
| 203 | + } |
196 | 204 | mPointerCapture.handleAutomaticCapture(); |
197 | 205 | return true; |
198 | 206 | } |
@@ -241,9 +249,9 @@ public boolean dispatchGenericMotionEvent(MotionEvent event) { |
241 | 249 |
|
242 | 250 | // Make sure we grabbed the mouse if necessary |
243 | 251 | updateGrabState(CallbackBridge.isGrabbing()); |
244 | | - |
245 | 252 | switch(event.getActionMasked()) { |
246 | 253 | case MotionEvent.ACTION_HOVER_MOVE: |
| 254 | + case MotionEvent.ACTION_MOVE: |
247 | 255 | CallbackBridge.mouseX = (event.getX(mouseCursorIndex) * LauncherPreferences.PREF_SCALE_FACTOR); |
248 | 256 | CallbackBridge.mouseY = (event.getY(mouseCursorIndex) * LauncherPreferences.PREF_SCALE_FACTOR); |
249 | 257 | CallbackBridge.sendCursorPos(CallbackBridge.mouseX, CallbackBridge.mouseY); |
|
0 commit comments