Cleanup: Remove debug input textview

It was unused after the second version of the input system
This commit is contained in:
Mathias-Boulay 2023-03-02 16:12:30 +01:00
parent 7c3aacd2af
commit 84a09b26b3
6 changed files with 4 additions and 63 deletions

View File

@ -93,8 +93,6 @@ public class JavaGUILauncherActivity extends BaseActivity implements View.OnTouc
}
}
// debugText.setText(CallbackBridge.DEBUG_STRING.toString());
CallbackBridge.DEBUG_STRING.setLength(0);
prevY = y;
prevX = x;
return true;

View File

@ -167,11 +167,10 @@ public class MainActivity extends BaseActivity implements ControlButtonMenuListe
switch(position) {
case 0: dialogForceClose(MainActivity.this); break;
case 1: openLogOutput(); break;
case 2: minecraftGLView.togglepointerDebugging(); break;
case 3: dialogSendCustomKey(); break;
case 4: adjustMouseSpeedLive(); break;
case 5: adjustGyroSensitivityLive(); break;
case 6: openCustomControls(); break;
case 2: dialogSendCustomKey(); break;
case 3: adjustMouseSpeedLive(); break;
case 4: adjustGyroSensitivityLive(); break;
case 5: openCustomControls(); break;
}
drawerLayout.closeDrawers();
};

View File

@ -46,8 +46,6 @@ import org.lwjgl.glfw.CallbackBridge;
public class MinecraftGLSurface extends View implements GrabListener{
/* Gamepad object for gamepad inputs, instantiated on need */
private Gamepad mGamepad = null;
/* Pointer Debug textview, used to show info about the pointer state */
private TextView mPointerDebugTextView;
/* Resolution scaler option, allow downsizing a window */
private final float mScaleFactor = LauncherPreferences.PREF_SCALE_FACTOR/100f;
/* Sensitivity, adjusted according to screen size */
@ -130,13 +128,6 @@ public class MinecraftGLSurface extends View implements GrabListener{
/** Initialize the view and all its settings */
public void start(){
// Add the pointer debug textview
mPointerDebugTextView = new TextView(getContext());
mPointerDebugTextView.setX(0);
mPointerDebugTextView.setY(0);
mPointerDebugTextView.setVisibility(GONE);
((ViewGroup)getParent()).addView(mPointerDebugTextView);
if(LauncherPreferences.PREF_USE_ALTERNATE_SURFACE){
SurfaceView surfaceView = new SurfaceView(getContext());
mSurface = surfaceView;
@ -380,9 +371,6 @@ public class MinecraftGLSurface extends View implements GrabListener{
// Actualise the pointer count
mLastPointerCount = e.getPointerCount();
//debugText.setText(CallbackBridge.DEBUG_STRING.toString());
CallbackBridge.DEBUG_STRING.setLength(0);
return true;
}
@ -419,8 +407,6 @@ public class MinecraftGLSurface extends View implements GrabListener{
CallbackBridge.mouseX = (event.getX(mouseCursorIndex) * mScaleFactor);
CallbackBridge.mouseY = (event.getY(mouseCursorIndex) * mScaleFactor);
CallbackBridge.sendCursorPos(CallbackBridge.mouseX, CallbackBridge.mouseY);
//debugText.setText(CallbackBridge.DEBUG_STRING.toString());
CallbackBridge.DEBUG_STRING.setLength(0);
return true;
case MotionEvent.ACTION_SCROLL:
CallbackBridge.sendScroll((double) event.getAxisValue(MotionEvent.AXIS_HSCROLL), (double) event.getAxisValue(MotionEvent.AXIS_VSCROLL));
@ -443,33 +429,6 @@ public class MinecraftGLSurface extends View implements GrabListener{
CallbackBridge.mouseX += (e.getX()* mScaleFactor);
CallbackBridge.mouseY += (e.getY()* mScaleFactor);
if (mPointerDebugTextView.getVisibility() == View.VISIBLE && !debugErrored) {
StringBuilder builder = new StringBuilder();
try {
builder.append("PointerCapture debug\n");
builder.append("MotionEvent=").append(e.getActionMasked()).append("\n");
builder.append("PressingBtn=").append(MotionEvent.class.getDeclaredMethod("buttonStateToString").invoke(null, e.getButtonState())).append("\n\n");
builder.append("PointerX=").append(e.getX()).append("\n");
builder.append("PointerY=").append(e.getY()).append("\n");
builder.append("RawX=").append(e.getRawX()).append("\n");
builder.append("RawY=").append(e.getRawY()).append("\n\n");
builder.append("XPos=").append(CallbackBridge.mouseX).append("\n");
builder.append("YPos=").append(CallbackBridge.mouseY).append("\n\n");
builder.append("MovingX=").append(getMoving(e.getX(), true)).append("\n");
builder.append("MovingY=").append(getMoving(e.getY(), false)).append("\n");
} catch (Throwable th) {
debugErrored = true;
builder.append("Error getting debug. The debug will be stopped!\n").append(Log.getStackTraceString(th));
} finally {
mPointerDebugTextView.setText(builder.toString());
builder.setLength(0);
}
}
mPointerDebugTextView.setText(CallbackBridge.DEBUG_STRING.toString());
CallbackBridge.DEBUG_STRING.setLength(0);
switch (e.getActionMasked()) {
case MotionEvent.ACTION_MOVE:
CallbackBridge.sendCursorPos(CallbackBridge.mouseX, CallbackBridge.mouseY);
@ -590,11 +549,6 @@ public class MinecraftGLSurface extends View implements GrabListener{
return (int)((mGuiScale * input)/ mScaleFactor);
}
/** Toggle the pointerDebugText visibility state */
public void togglepointerDebugging() {
mPointerDebugTextView.setVisibility(mPointerDebugTextView.getVisibility() == View.GONE ? View.VISIBLE : View.GONE);
}
/** Called when the size need to be set at any point during the surface lifecycle **/
public void refreshSize(){
windowWidth = Tools.getDisplayFriendlyRes(Tools.currentDisplayMetrics.widthPixels, mScaleFactor);

View File

@ -124,9 +124,6 @@ public class Touchpad extends FrameLayout implements GrabListener{
break;
}
//debugText.setText(CallbackBridge.DEBUG_STRING.toString());
CallbackBridge.DEBUG_STRING.setLength(0);
return true;
}

View File

@ -22,7 +22,6 @@ public class CallbackBridge {
public static volatile int windowWidth, windowHeight;
public static volatile int physicalWidth, physicalHeight;
public static float mouseX, mouseY;
public static StringBuilder DEBUG_STRING = new StringBuilder();
private static boolean threadAttached;
public volatile static boolean holdingAlt, holdingCapslock, holdingCtrl,
holdingNumlock, holdingShift;
@ -44,19 +43,16 @@ public class CallbackBridge {
threadAttached = CallbackBridge.nativeAttachThreadToOther(true, MainActivity.isInputStackCall);
}
DEBUG_STRING.append("CursorPos=").append(x).append(", ").append(y).append("\n");
mouseX = x;
mouseY = y;
nativeSendCursorPos(mouseX, mouseY);
}
public static void sendPrepareGrabInitialPos() {
DEBUG_STRING.append("Prepare set grab initial posititon: ignored");
//sendMouseKeycode(-1, CallbackBridge.getCurrentMods(), false);
}
public static void sendKeycode(int keycode, char keychar, int scancode, int modifiers, boolean isDown) {
DEBUG_STRING.append("KeyCode=").append(keycode).append(", Char=").append(keychar);
// TODO CHECK: This may cause input issue, not receive input!
/*
if (!nativeSendCharMods((int) keychar, modifiers) || !nativeSendChar(keychar)) {
@ -102,7 +98,6 @@ public class CallbackBridge {
}
public static void sendMouseKeycode(int button, int modifiers, boolean isDown) {
DEBUG_STRING.append("MouseKey=").append(button).append(", down=").append(isDown).append("\n");
// if (isGrabbing()) DEBUG_STRING.append("MouseGrabStrace: " + android.util.Log.getStackTraceString(new Throwable()) + "\n");
nativeSendMouseButton(button, isDown ? 1 : 0, modifiers);
}
@ -113,7 +108,6 @@ public class CallbackBridge {
}
public static void sendScroll(double xoffset, double yoffset) {
DEBUG_STRING.append("ScrollX=").append(xoffset).append(",ScrollY=").append(yoffset);
nativeSendScroll(xoffset, yoffset);
}

View File

@ -27,7 +27,6 @@
<string-array name="menu_ingame">
<item>@string/control_forceclose</item>
<item>@string/control_viewout</item>
<item>@string/control_adebug</item>
<item>@string/control_customkey</item>
<item>@string/mcl_setting_title_mousespeed</item>
<item>@string/preference_gyro_sensitivity_title</item>