Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigation gestures no longer work using a mouse in fullscreen apps #5545

Closed
livingator opened this issue Nov 27, 2024 · 4 comments
Closed

Comments

@livingator
Copy link

Environment

  • OS: Windows 10
  • Scrcpy version: 3.0
  • Installation method: Windows release
  • Device model: S22 Ultra
  • Android version: Android 14

Describe the bug

Can no longer use navigation gestures (back/home app switch) in fullscreen apps with immersion mode through mouse swiping since upgrading to Scrcpy 3.0 (it's still fine in 2.7).

@rom1v
Copy link
Collaborator

rom1v commented Nov 27, 2024

As I expected, the change is caused by d193967.

With this dirty hack (the position mapper is not updated), it "works":

diff --git server/src/main/java/com/genymobile/scrcpy/control/Controller.java server/src/main/java/com/genymobile/scrcpy/control/Controller.java
index f0e4c0374..e0533fff9 100644
--- server/src/main/java/com/genymobile/scrcpy/control/Controller.java
+++ server/src/main/java/com/genymobile/scrcpy/control/Controller.java
@@ -139,7 +139,7 @@ public class Controller implements AsyncProcessor, VirtualDisplayListener {
 
     @Override
     public void onNewVirtualDisplay(int virtualDisplayId, PositionMapper positionMapper) {
-        DisplayData data = new DisplayData(virtualDisplayId, positionMapper);
+        DisplayData data = new DisplayData(0, positionMapper); // hack
         DisplayData old = this.displayData.getAndSet(data);
         if (old == null) {
             // The very first time the Controller is notified of a new virtual display

But I think the correct way is to send mouse events to the (mirroring) virtual display, not the main display. I have no control over how Android reacts to these events though.

Side-note: you can press BACK using right-click and HOME using middle-click by default.

@rom1v
Copy link
Collaborator

rom1v commented Dec 4, 2024

Please test #5605 (comment)

rom1v added a commit that referenced this issue Dec 5, 2024
When mirroring a secondary display, touch and scroll events must be sent
to the mirroring virtual display id (with coordinates relative to the
virtual display size), rather than to the original display (with
coordinates relative to the original display size).

This behavior, introduced by d193967,
was also applied for the main display for consistency.

However, this mechanism has been found to cause some UI elements to
become unclickable.

To minimize inconveniences, restore the previous behavior when mirroring
the main display: send all events to the original display id (0) with
coordinates relative to the original display size.

Fixes #5545 <#5545>
Fixes #5605 <#5605>
Refs #4598 <#4598>
Refs #5137 <#5137>
Refs #5370 <#5370>
rom1v added a commit that referenced this issue Dec 5, 2024
When mirroring a secondary display, touch and scroll events must be sent
to the mirroring virtual display id (with coordinates relative to the
virtual display size), rather than to the original display (with
coordinates relative to the original display size).

This behavior, introduced by d193967,
was also applied for the main display for consistency. However, it has
been found to cause some UI elements to become unclickable.

To minimize inconveniences, restore the previous behavior when mirroring
the main display: send all events to the original display id (0) with
coordinates relative to the original display size.

Fixes #5545 <#5545>
Fixes #5605 <#5605>
Refs #4598 <#4598>
Refs #5137 <#5137>
Refs #5370 <#5370>
@rom1v
Copy link
Collaborator

rom1v commented Dec 5, 2024

Please test #5614.

@livingator
Copy link
Author

Please test #5614.

tested and it works

@rom1v rom1v closed this as completed in 97fa77c Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants