Skip to content

Commit ac3de41

Browse files
committed
InputService: make takeScreenShots() display-specific
1 parent 027ac79 commit ac3de41

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

app/src/main/java/net/christianbeier/droidvnc_ng/InputService.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ public static void onCutText(String text, long client) {
690690
}
691691

692692
@RequiresApi(api = Build.VERSION_CODES.R)
693-
public static void takeScreenShots(boolean enable) {
693+
public static void takeScreenShots(boolean enable, int displayId) {
694694
try {
695695
if (enable) {
696696
instance.mTakeScreenShotCallback = new TakeScreenshotCallback() {
@@ -725,7 +725,7 @@ public void onSuccess(@NonNull ScreenshotResult screenshot) {
725725
instance.mMainHandler.postDelayed(() ->
726726
{
727727
try {
728-
instance.takeScreenshot(Display.DEFAULT_DISPLAY,
728+
instance.takeScreenshot(displayId,
729729
instance.getMainExecutor(),
730730
this);
731731
} catch (Exception ignored) {
@@ -749,7 +749,7 @@ public void onFailure(int errorCode) {
749749
// try again later, incrementing delay
750750
instance.mMainHandler.postDelayed(() -> {
751751
try {
752-
instance.takeScreenshot(Display.DEFAULT_DISPLAY,
752+
instance.takeScreenshot(displayId,
753753
instance.getMainExecutor(),
754754
this
755755
);
@@ -771,7 +771,7 @@ public void onFailure(int errorCode) {
771771

772772
// first screenshot
773773
Log.d(TAG, "takeScreenShots: start");
774-
instance.takeScreenshot(Display.DEFAULT_DISPLAY,
774+
instance.takeScreenshot(displayId,
775775
instance.getMainExecutor(),
776776
instance.mTakeScreenShotCallback
777777
);

app/src/main/java/net/christianbeier/droidvnc_ng/MainService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ private void startScreenCapture() {
737737
} else {
738738
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
739739
Log.d(TAG, "startScreenCapture: trying takeScreenShot backend");
740-
InputService.takeScreenShots(true);
740+
InputService.takeScreenShots(true, Display.DEFAULT_DISPLAY);
741741
} else {
742742
Log.w(TAG, "startScreenCapture: no backend available");
743743
}
@@ -748,7 +748,7 @@ private void stopScreenCapture() {
748748
// stop all backends unconditionally
749749
stopService(new Intent(this, MediaProjectionService.class));
750750
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
751-
InputService.takeScreenShots(false);
751+
InputService.takeScreenShots(false, Display.DEFAULT_DISPLAY);
752752
}
753753
}
754754

0 commit comments

Comments
 (0)