这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

<uses-feature android:name="android.hardware.vr.headtracking" android:required="false" />
<uses-feature android:name="com.oculus.feature.PASSTHROUGH" android:required="false" />
<uses-feature android:name="oculus.software.handtracking" android:required="false" />
<uses-feature android:name="oculus.software.overlay_keyboard" android:required="false" />

<application
Expand Down
11 changes: 9 additions & 2 deletions app/src/main/java/com/termux/x11/LorieView.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ void getDimensionsFromSettings() {
Prefs prefs = MainActivity.getPrefs();
int width = getMeasuredWidth();
int height = getMeasuredHeight();
if (XrActivity.isEnabled()) {
width = 1024;
height = 768;
}
int w = width;
int h = height;
switch(prefs.displayResolutionMode.get()) {
Expand Down Expand Up @@ -180,8 +184,11 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if (prefs.displayStretch.get()
|| "native".equals(prefs.displayResolutionMode.get())
|| "scaled".equals(prefs.displayResolutionMode.get())) {
getHolder().setSizeFromLayout();
return;

if (!XrActivity.isEnabled()) {
getHolder().setSizeFromLayout();
return;
}
}

getDimensionsFromSettings();
Expand Down
21 changes: 21 additions & 0 deletions app/src/main/java/com/termux/x11/XrActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import android.opengl.GLSurfaceView;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.RemoteException;
import android.util.Log;
import android.view.Display;
Expand Down Expand Up @@ -48,6 +49,7 @@ public enum RenderParam {

private boolean isImmersive = false;
private boolean isSBS = false;
private boolean keyboardDisabled;
private long lastEnter;
private final float[] lastAxes = new float[ControllerAxis.values().length];
private final boolean[] lastButtons = new boolean[ControllerButton.values().length];
Expand Down Expand Up @@ -183,8 +185,27 @@ public void onDrawFrame(GL10 gl10) {
}
}

@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
keyboardDisabled = true;
new Handler().postDelayed(() -> keyboardDisabled = false, 250);
}
}

@Override
public boolean dispatchKeyEvent(KeyEvent event) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does LorieView's dispatchKeyEventPreIme work in the case if Activity's dispatchKeyEvent is overridden?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Software keyboard sends randomly event with KEYCODE_MEDIA_PLAY into dispatchKeyEventPreIme.
Hardware keyboard works sends correct events into dispatchKeyEventPreIme.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am sorry, I do not understand how is your question related to the code.

What change do you require here?

// Ignore event madness when disabling software keyboard
if (keyboardDisabled) {
return true;
}

// Bluetooth/OTG keyboards work properly with the standard flow
if (hasWindowFocus()) {
return super.dispatchKeyEvent(event);
}

// Meta HorizonOS sends up event only (as for in v66)
if (event.getAction() == KeyEvent.ACTION_UP) {

Expand Down