[Input pipe] Still trying to get copy-paste works

This commit is contained in:
khanhduytran0 2021-01-22 14:22:55 +07:00
parent c320d96a76
commit 666c822b4a
6 changed files with 14 additions and 14 deletions

View file

@ -264,6 +264,10 @@ public class BaseMainActivity extends LoggableActivity {
} }
}).start(); }).start();
if (isAndroid8OrHigher()) {
touchPad.setDefaultFocusHighlightEnabled(false);
}
touchPad.setOnTouchListener(new OnTouchListener(){ touchPad.setOnTouchListener(new OnTouchListener(){
private float prevX, prevY; private float prevX, prevY;
@Override @Override
@ -692,8 +696,6 @@ public class BaseMainActivity extends LoggableActivity {
CallbackBridge.windowHeight = (int)(height/scaleFactor); CallbackBridge.windowHeight = (int)(height/scaleFactor);
CallbackBridge.sendUpdateWindowSize((int)(width/scaleFactor),(int)(height/scaleFactor)); CallbackBridge.sendUpdateWindowSize((int)(width/scaleFactor),(int)(height/scaleFactor));
calculateMcScale(); calculateMcScale();
// TODO: Implement this method for GLFW window size callback
} }
@Override @Override

View file

@ -14,17 +14,7 @@ import android.view.inputmethod.InputMethodManager;
public class MinecraftGLView extends TextureView public class MinecraftGLView extends TextureView
{ {
public MinecraftGLView(Context context) { public MinecraftGLView(Context context) {
super(context); this(context, null);
//setPreserveEGLContextOnPause(true);
setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View view, boolean b) {
if(!b) {
((InputMethodManager)view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(view.getWindowToken(),0);
}
}
});
} }
public MinecraftGLView(Context context, AttributeSet attributeSet) { public MinecraftGLView(Context context, AttributeSet attributeSet) {
@ -52,6 +42,8 @@ public class MinecraftGLView extends TextureView
public static boolean isHardKB(Context ctx) { public static boolean isHardKB(Context ctx) {
return ctx.getResources().getConfiguration().keyboard == Configuration.KEYBOARD_QWERTY; return ctx.getResources().getConfiguration().keyboard == Configuration.KEYBOARD_QWERTY;
} }
} }
class MinecraftInputConnection extends BaseInputConnection { class MinecraftInputConnection extends BaseInputConnection {
private SpannableStringBuilder _editable; private SpannableStringBuilder _editable;

View file

@ -175,7 +175,7 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_CallbackBridge_nativeAttachThread
if (isUseStackQueueCall && isAndroid && result) { if (isUseStackQueueCall && isAndroid && result) {
isPrepareGrabPos = true; isPrepareGrabPos = true;
} }
getJavaInputBridge(&inputBridgeClass_ANDROID, &inputBridgeMethod_ANDROID); getJavaInputBridge(&inputBridgeClass_ANDROID, &inputBridgeMethod_ANDROID);
return result; return result;
} }

View file

@ -49,6 +49,10 @@ void free_char_array(JNIEnv *env, jobjectArray jstringArray, const char **charAr
} }
jstring convertStringJVM(JNIEnv* srcEnv, JNIEnv* dstEnv, jstring srcStr) { jstring convertStringJVM(JNIEnv* srcEnv, JNIEnv* dstEnv, jstring srcStr) {
if (srcStr == NULL) {
return NULL;
}
const char* srcStrC = (*srcEnv)->GetStringUTFChars(srcEnv, srcStr, 0); const char* srcStrC = (*srcEnv)->GetStringUTFChars(srcEnv, srcStr, 0);
jstring dstStr = (*dstEnv)->NewStringUTF(dstEnv, srcStrC); jstring dstStr = (*dstEnv)->NewStringUTF(dstEnv, srcStrC);
(*srcEnv)->ReleaseStringUTFChars(srcEnv, srcStr, srcStrC); (*srcEnv)->ReleaseStringUTFChars(srcEnv, srcStr, srcStrC);

View file

@ -76,6 +76,7 @@ public class CallbackBridge {
public static native void nativeSendData(boolean isAndroid, int type, String data); public static native void nativeSendData(boolean isAndroid, int type, String data);
public static native boolean nativeSetInputReady(boolean ready); public static native boolean nativeSetInputReady(boolean ready);
public static native String nativeClipboard(int action, String copy); public static native String nativeClipboard(int action, String copy);
public static native void nativeAttachThreadToOther(boolean isAndroid, boolean isUseStackQueueBool);
private static native void nativeSetGrabbing(boolean grab, int xset, int yset); private static native void nativeSetGrabbing(boolean grab, int xset, int yset);
} }

View file

@ -772,6 +772,7 @@ public class GLFW
static boolean isGLFWReady; static boolean isGLFWReady;
public static boolean glfwInit() { public static boolean glfwInit() {
if (!isGLFWReady) { if (!isGLFWReady) {
CallbackBridge.nativeAttachThreadToOther(false, false);
mGLFWInitialTime = (double) System.nanoTime(); mGLFWInitialTime = (double) System.nanoTime();
isGLFWReady = nativeEglInit(); isGLFWReady = nativeEglInit();
} }