Skip to content

Commit

Permalink
Release 2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
downthecrop committed Nov 30, 2023
1 parent 8d41a6c commit f0726f0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 30 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -220,30 +220,14 @@ public boolean onSurfaceTextureDestroyed(@NonNull SurfaceTexture surface) {
public void onSurfaceTextureUpdated(@NonNull SurfaceTexture surface) {}
});

this.longPressDetector = new GestureDetector(getContext(), new GestureDetector.SimpleOnGestureListener() {

boolean isDragClicking = false;
longPressDetector = new GestureDetector(getContext(), new GestureDetector.SimpleOnGestureListener() {
@Override
public void onLongPress(MotionEvent e) {
super.onLongPress(e);
if(!isDragClicking) {
isDragClicking = true;
AWTInputBridge.sendKey((char) AWTInputEvent.VK_F5, AWTInputEvent.VK_F5);
}
}

@Override
public boolean onSingleTapUp(MotionEvent e) {
if(isDragClicking) {
isDragClicking = false;
AWTInputBridge.sendKey((char)AWTInputEvent.VK_F5, AWTInputEvent.VK_F5);
}
return super.onSingleTapUp(e);
CallbackBridge.putMouseEventWithCoords(LwjglGlfwKeycode.GLFW_MOUSE_BUTTON_RIGHT, CallbackBridge.mouseX, CallbackBridge.mouseY);
}
});

//this.longPressDetector.setIsLongpressEnabled(true);

((ViewGroup)getParent()).addView(textureView);
}
}
Expand All @@ -257,7 +241,7 @@ public boolean onSingleTapUp(MotionEvent e) {
@SuppressWarnings("accessibility")
public boolean onTouchEvent(MotionEvent e) {
scaleGestureDetector.onTouchEvent(e);
//longPressDetector.onTouchEvent(e);
longPressDetector.onTouchEvent(e);
// Kinda need to send this back to the layout
if(((ControlLayout)getParent()).getModifiable()) return false;

Expand All @@ -280,7 +264,6 @@ public boolean onTouchEvent(MotionEvent e) {
CallbackBridge.mouseY = (e.getY() * mScaleFactor);
//One android click = one MC click
if(mSingleTapDetector.onTouchEvent(e)){ //
//longPressDetector.onTouchEvent(e);// Touch Mode
CallbackBridge.putMouseEventWithCoords(LwjglGlfwKeycode.GLFW_MOUSE_BUTTON_LEFT, CallbackBridge.mouseX, CallbackBridge.mouseY);
return true;
}
Expand Down Expand Up @@ -429,6 +412,7 @@ public boolean onTouchEvent(MotionEvent e) {

// Actualise the pointer count
mLastPointerCount = e.getPointerCount();
longPressDetector.onTouchEvent(e);

return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public class JavaGUILauncherActivity extends BaseActivity implements View.OnTouc
private TouchCharInput mTouchCharInput;

private LinearLayout mTouchPad;
boolean isDragClicking = false;
private ImageView mMousePointerImageView;
private GestureDetector mGestureDetector;

Expand Down Expand Up @@ -187,20 +186,14 @@ public boolean onTouch(View v, MotionEvent event) {
longPressDetector = new GestureDetector(this, new GestureDetector.SimpleOnGestureListener() {
@Override
public void onLongPress(MotionEvent e) {
// Send RightClick
AWTInputBridge.sendKey((char)AWTInputEvent.VK_F11,AWTInputEvent.VK_F11);
AWTInputBridge.sendMousePress(AWTInputEvent.BUTTON1_DOWN_MASK);
super.onLongPress(e);
Log.i("downthecrop","Hi from a long press!");
if(!isDragClicking) {
isDragClicking = true;
//AWTInputBridge.sendKey((char) AWTInputEvent.VK_F5, AWTInputEvent.VK_F5);
}
}

@Override
public boolean onSingleTapUp(MotionEvent e) {
if(isDragClicking) {
isDragClicking = false;
//AWTInputBridge.sendKey((char)AWTInputEvent.VK_F5, AWTInputEvent.VK_F5);
}
return super.onSingleTapUp(e);
}
});
Expand Down

0 comments on commit f0726f0

Please sign in to comment.