Skip to content

Commit

Permalink
Merge pull request #11 from cagnulein/touch_not_accurate_tablet
Browse files Browse the repository at this point in the history
reverting the scaled coordinates fix for the tablet
  • Loading branch information
cagnulein authored Jun 26, 2024
2 parents b2d3025 + c868e1d commit e9720d9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ android {
applicationId "org.cagnulein.android_remote"
minSdkVersion 29
targetSdkVersion 32
versionCode 13
versionCode 16
versionName "2.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
setProperty("archivesBaseName", "android_remote")
Expand Down
Binary file modified app/src/main/assets/scrcpy-server.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions app/src/main/java/org/cagnulein/android_remote/Scrcpy.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ public boolean touchevent(MotionEvent touch_event, int displayW, int displayH, b

int[] buf;
if(!landscape) {
buf = new int[]{touch_event.getAction(), touch_event.getButtonState(), (int) touch_event.getX() * screenWidth / displayW, (int) touch_event.getY() * screenHeight / displayH};
buf = new int[]{touch_event.getAction(), touch_event.getButtonState(), (int) touch_event.getX() * remote_dev_resolution[0] / displayW, (int) touch_event.getY() * remote_dev_resolution[1] / displayH};
} else {
buf = new int[]{touch_event.getAction(), touch_event.getButtonState(), (int) touch_event.getX() * screenHeight / displayW, (int) touch_event.getY() * screenWidth / displayH};
buf = new int[]{touch_event.getAction(), touch_event.getButtonState(), (int) touch_event.getX() * remote_dev_resolution[1] / displayW, (int) touch_event.getY() * remote_dev_resolution[0] / displayH};
}
String bufStr = Arrays.toString(buf).replaceAll(",", "");
logger.info("touchevent " + bufStr + " " + landscape + " " + displayW + " " + screenWidth + " " +displayH + " " + screenHeight);
Expand Down
7 changes: 4 additions & 3 deletions server/src/main/java/org/cagnulein/android_remote/Device.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,11 @@ public Point NewgetPhysicalPoint(Point point) {
// Point point = position.getPoint();
int scaledX = point.x * deviceSize.getWidth() / videoSize.getWidth();
int scaledY = point.y * deviceSize.getHeight() / videoSize.getHeight();
if(isPortrait)
return new Point(point.x, scaledY);
/*if(isPortrait)
return new Point(scaledX, scaledY);
else
return new Point(scaledX, point.y);
return new Point(scaledX, scaledY);*/
return point;
}

public interface RotationListener {
Expand Down

0 comments on commit e9720d9

Please sign in to comment.