v1.4.0: several text input improvements for Steam Deck

This commit is contained in:
Evan Debenham
2022-08-12 11:05:28 -04:00
parent dcc84e4e7e
commit 4ae3bf9336
7 changed files with 45 additions and 27 deletions

View File

@@ -121,14 +121,6 @@ public class PointerEvent {
}
return lastHoverPos.clone();
}
public static synchronized void emulateMouseButton( int button, boolean down ){
if (down){
addPointerEvent(new PointerEvent((int)lastHoverPos.x, (int)lastHoverPos.y, 1000+button, Type.DOWN, button));
} else {
addPointerEvent(new PointerEvent((int)lastHoverPos.x, (int)lastHoverPos.y, 1000+button, Type.UP, button));
}
}
public static synchronized void addPointerEvent( PointerEvent event ){
pointerEvents.add( event );
@@ -155,10 +147,9 @@ public class PointerEvent {
//add drag events for any emulated presses
if (hovered){
for (int i = 1000+LEFT; i <= 1000+FORWARD; i++){
for (int i = 10+LEFT; i <= 10+FORWARD; i++){
if (activePointers.containsKey(i)){
//add to front in case pointer is also being released this frame
pointerEvents.add(0, new PointerEvent((int)lastHoverPos.x, (int)lastHoverPos.y, i, Type.DOWN, i));
Game.inputHandler.emulateDrag(i-10);
}
}
}
@@ -187,7 +178,7 @@ public class PointerEvent {
}
if (clearKeyboardThisPress){
//most press events should clear the keyboard
Gdx.input.setOnscreenKeyboardVisible(false);
Game.platform.setOnscreenKeyboardVisible(false);
}
}
pointerEvents.clear();