mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-19 09:39:25 -04:00
Changes
- [Custom control] Move source files. - [Input pipe] Force to trigger update screen size at least once to fix wrong cursor position.
This commit is contained in:
parent
2ffd62f09f
commit
44bac63dac
@ -28,7 +28,7 @@ import java.lang.reflect.*;
|
||||
import net.kdt.pojavlaunch.*;
|
||||
|
||||
import android.view.View.OnClickListener;
|
||||
import net.kdt.pojavlaunch.value.customcontrols.*;
|
||||
import net.kdt.pojavlaunch.customcontrols.*;
|
||||
import android.support.v7.app.*;
|
||||
|
||||
public class ActionPopupWindow extends PinnedPopupWindow implements OnClickListener {
|
||||
|
@ -28,7 +28,7 @@ import android.widget.*;
|
||||
import android.content.*;
|
||||
import java.lang.reflect.*;
|
||||
import net.kdt.pojavlaunch.*;
|
||||
import net.kdt.pojavlaunch.value.customcontrols.*;
|
||||
import net.kdt.pojavlaunch.customcontrols.*;
|
||||
|
||||
public abstract class HandleView extends View implements ViewPositionListener, View.OnLongClickListener
|
||||
{
|
||||
|
@ -23,7 +23,7 @@ import android.graphics.drawable.*;
|
||||
import android.text.*;
|
||||
import android.view.*;
|
||||
import android.os.*;
|
||||
import net.kdt.pojavlaunch.value.customcontrols.*;
|
||||
import net.kdt.pojavlaunch.customcontrols.*;
|
||||
|
||||
public class SelectionEndHandleView extends HandleView
|
||||
{
|
||||
|
@ -13,7 +13,7 @@ import com.kdt.filerapi.*;
|
||||
import java.io.*;
|
||||
import net.kdt.pojavlaunch.*;
|
||||
import net.kdt.pojavlaunch.prefs.*;
|
||||
import net.kdt.pojavlaunch.value.customcontrols.*;
|
||||
import net.kdt.pojavlaunch.customcontrols.*;
|
||||
|
||||
public class CustomControlsActivity extends AppCompatActivity
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ import java.lang.reflect.*;
|
||||
import java.util.*;
|
||||
import net.kdt.pojavlaunch.*;
|
||||
import net.kdt.pojavlaunch.prefs.*;
|
||||
import net.kdt.pojavlaunch.value.customcontrols.*;
|
||||
import net.kdt.pojavlaunch.customcontrols.*;
|
||||
import org.lwjgl.glfw.*;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
|
@ -5,7 +5,7 @@ import android.os.*;
|
||||
import android.content.pm.PackageManager.*;
|
||||
import android.content.pm.*;
|
||||
import net.kdt.pojavlaunch.prefs.*;
|
||||
import net.kdt.pojavlaunch.value.customcontrols.*;
|
||||
import net.kdt.pojavlaunch.customcontrols.*;
|
||||
import android.support.v7.preference.*;
|
||||
import java.io.*;
|
||||
import android.content.*;
|
||||
|
@ -17,7 +17,7 @@ import com.kdt.mojangauth.*;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import net.kdt.pojavlaunch.update.*;
|
||||
import net.kdt.pojavlaunch.value.customcontrols.*;
|
||||
import net.kdt.pojavlaunch.customcontrols.*;
|
||||
import org.apache.commons.compress.archivers.tar.*;
|
||||
import org.apache.commons.compress.compressors.xz.*;
|
||||
import org.apache.commons.io.*;
|
||||
|
@ -172,8 +172,8 @@ public final class Tools
|
||||
public static String[] getMinecraftArgs(MCProfile.Builder profile, JMinecraftVersionList.Version versionInfo) {
|
||||
String username = profile.getUsername();
|
||||
String versionName = profile.getVersion();
|
||||
if(versionInfo.inheritsFrom != null) {
|
||||
versionName=versionInfo.inheritsFrom;
|
||||
if (versionInfo.inheritsFrom != null) {
|
||||
versionName = versionInfo.inheritsFrom;
|
||||
}
|
||||
String mcAssetsDir = Tools.ASSETS_PATH;
|
||||
String userType = "mojang";
|
||||
|
@ -1,4 +1,4 @@
|
||||
package net.kdt.pojavlaunch.value.customcontrols;
|
||||
package net.kdt.pojavlaunch.customcontrols;
|
||||
|
||||
import java.util.*;
|
||||
import net.kdt.pojavlaunch.*;
|
@ -1,4 +1,4 @@
|
||||
package net.kdt.pojavlaunch.value.customcontrols;
|
||||
package net.kdt.pojavlaunch.customcontrols;
|
||||
|
||||
import android.content.*;
|
||||
import android.view.*;
|
@ -1,4 +1,4 @@
|
||||
package net.kdt.pojavlaunch.value.customcontrols;
|
||||
package net.kdt.pojavlaunch.customcontrols;
|
||||
import android.widget.*;
|
||||
import android.content.*;
|
||||
import android.util.*;
|
@ -1,4 +1,4 @@
|
||||
package net.kdt.pojavlaunch.value.customcontrols;
|
||||
package net.kdt.pojavlaunch.customcontrols;
|
||||
import android.content.*;
|
||||
import com.google.gson.*;
|
||||
import java.util.*;
|
@ -29,11 +29,14 @@ public class CallbackBridge {
|
||||
sendMouseKeycode(button, 0, state == 1);
|
||||
}
|
||||
|
||||
private static boolean threadAttached;
|
||||
private static boolean threadAttached, screenSizeSet;
|
||||
public static void sendCursorPos(int x, int y) {
|
||||
if (!threadAttached) {
|
||||
threadAttached = CallbackBridge.nativeAttachThreadToOther(true, isMinecraft1p12, MainActivity.isInputStackCall);
|
||||
}
|
||||
if (!screenSizeSet) {
|
||||
screenSizeSet = nativeSendScreenSize(windowWidth, windowHeight);
|
||||
}
|
||||
|
||||
DEBUG_STRING.append("CursorPos=" + x + ", " + y + "\n");
|
||||
mouseX = x;
|
||||
@ -73,8 +76,7 @@ public class CallbackBridge {
|
||||
}
|
||||
|
||||
public static void sendUpdateWindowSize(int w, int h) {
|
||||
nativeSendFramebufferSize(w, h);
|
||||
nativeSendWindowSize(w, h);
|
||||
nativeSendScreenSize(w, h);
|
||||
}
|
||||
|
||||
public static boolean isGrabbing() {
|
||||
@ -131,11 +133,10 @@ public class CallbackBridge {
|
||||
private static native boolean nativeSendCharMods(int codepoint, int mods);
|
||||
// private static native void nativeSendCursorEnter(int entered);
|
||||
private static native void nativeSendCursorPos(int x, int y);
|
||||
private static native void nativeSendFramebufferSize(int width, int height);
|
||||
private static native void nativeSendKey(int key, int scancode, int action, int mods);
|
||||
private static native void nativeSendMouseButton(int button, int action, int mods);
|
||||
private static native void nativeSendScroll(double xoffset, double yoffset);
|
||||
private static native void nativeSendWindowSize(int width, int height);
|
||||
private static native boolean nativeSendScreenSize(int width, int height);
|
||||
|
||||
public static native boolean nativeIsGrabbing();
|
||||
|
||||
|
@ -253,16 +253,6 @@ JNIEXPORT void JNICALL Java_org_lwjgl_glfw_CallbackBridge_nativeSendCursorPos(JN
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_glfw_CallbackBridge_nativeSendFramebufferSize(JNIEnv* env, jclass clazz, jint width, jint height) {
|
||||
if (GLFW_invoke_FramebufferSize && isInputReady) {
|
||||
if (isUseStackQueueCall) {
|
||||
sendData(EVENT_TYPE_FRAMEBUFFER_SIZE, width, height, 0, 0);
|
||||
} else {
|
||||
GLFW_invoke_FramebufferSize(showingWindow, width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_glfw_CallbackBridge_nativeSendKey(JNIEnv* env, jclass clazz, jint key, jint scancode, jint action, jint mods) {
|
||||
if (GLFW_invoke_Key && isInputReady) {
|
||||
if (isUseStackQueueCall) {
|
||||
@ -288,6 +278,28 @@ JNIEXPORT void JNICALL Java_org_lwjgl_glfw_CallbackBridge_nativeSendMouseButton(
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_CallbackBridge_nativeSendScreenSize(JNIEnv* env, jclass clazz, jint width, jint height) {
|
||||
if (isInputReady) {
|
||||
if (GLFW_invoke_FramebufferSize) {
|
||||
if (isUseStackQueueCall) {
|
||||
sendData(EVENT_TYPE_FRAMEBUFFER_SIZE, width, height, 0, 0);
|
||||
} else {
|
||||
GLFW_invoke_FramebufferSize(showingWindow, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
if (GLFW_invoke_WindowSize) {
|
||||
if (isUseStackQueueCall) {
|
||||
sendData(EVENT_TYPE_WINDOW_SIZE, width, height, 0, 0);
|
||||
} else {
|
||||
GLFW_invoke_WindowSize(showingWindow, width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (isInputReady && (GLFW_invoke_FramebufferSize || GLFW_invoke_WindowSize));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_glfw_CallbackBridge_nativeSendScroll(JNIEnv* env, jclass clazz, jdouble xoffset, jdouble yoffset) {
|
||||
if (GLFW_invoke_Scroll && isInputReady) {
|
||||
if (isUseStackQueueCall) {
|
||||
@ -298,16 +310,6 @@ JNIEXPORT void JNICALL Java_org_lwjgl_glfw_CallbackBridge_nativeSendScroll(JNIEn
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_glfw_CallbackBridge_nativeSendWindowSize(JNIEnv* env, jclass clazz, jint width, jint height) {
|
||||
if (GLFW_invoke_WindowSize && isInputReady) {
|
||||
if (isUseStackQueueCall) {
|
||||
sendData(EVENT_TYPE_WINDOW_SIZE, width, height, 0, 0);
|
||||
} else {
|
||||
GLFW_invoke_WindowSize(showingWindow, width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_glfw_GLFW_nglfwSetShowingWindow(JNIEnv* env, jclass clazz, jlong window) {
|
||||
showingWindow = (long) window;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@
|
||||
<!-- AlertDialog title -->
|
||||
<string name="alerttitle_install_jre">Install Java Runtime %s (.tar.xz)</string>
|
||||
<string name="alerttitle_selectkeymap">Select a keymap json</string>
|
||||
<string name="alerttitle_installmod">Select a mod to install</string>
|
||||
<string name="alerttitle_installmod">Select a mod installer</string>
|
||||
|
||||
<!-- Error messages -->
|
||||
<string name="error_fatal">PojavLauncher has unexpectedly crashed</string>
|
||||
@ -68,7 +68,8 @@
|
||||
-->
|
||||
|
||||
<!-- MCLauncherActivity: Tabs -->
|
||||
<string name="mcl_tab_news">Launcher news</string>
|
||||
<string name="mcl_tab_news">News</string>
|
||||
<string name="mcl_tab_mcje">Minecraft: Java Edition</string>
|
||||
<string name="mcl_tab_console">Development console</string>
|
||||
<string name="mcl_tab_crash">Crash log</string>
|
||||
|
||||
@ -189,7 +190,6 @@
|
||||
<string name="customctrl_specialkey">Special Key</string>
|
||||
<string name="customctrl_hidden">Hidden</string>
|
||||
<string name="customctrl_addbutton">Add button</string>
|
||||
<string name="customctrl_title_selectctrl">Select default Control json</string>
|
||||
<string name="customctrl_selectdefault">Select default Control json</string>
|
||||
|
||||
<!-- Update part (unused now) -->
|
||||
|
Loading…
x
Reference in New Issue
Block a user