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

View file

@ -14,17 +14,7 @@ import android.view.inputmethod.InputMethodManager;
public class MinecraftGLView extends TextureView
{
public MinecraftGLView(Context context) {
super(context);
//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);
}
}
});
this(context, null);
}
public MinecraftGLView(Context context, AttributeSet attributeSet) {
@ -52,6 +42,8 @@ public class MinecraftGLView extends TextureView
public static boolean isHardKB(Context ctx) {
return ctx.getResources().getConfiguration().keyboard == Configuration.KEYBOARD_QWERTY;
}
}
class MinecraftInputConnection extends BaseInputConnection {
private SpannableStringBuilder _editable;

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) {
if (srcStr == NULL) {
return NULL;
}
const char* srcStrC = (*srcEnv)->GetStringUTFChars(srcEnv, srcStr, 0);
jstring dstStr = (*dstEnv)->NewStringUTF(dstEnv, 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 boolean nativeSetInputReady(boolean ready);
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);
}

View file

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