-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
[feature request] Add option to clamp events coordinates inside the device screen (swipe from left/right edge) #1581
Comments
The click/move events are already forwarded outside the device screen. For example, in some photo app (or even your home), start a drag which ends outside the screen, it should work (and continue to move when you move your mouse outside). This is also the case for events starting outside the screen. You can see it by just adding a log: diff --git a/server/src/main/java/com/genymobile/scrcpy/Controller.java b/server/src/main/java/com/genymobile/scrcpy/Controller.java
index 71e7ec9c..1921188d 100644
--- a/server/src/main/java/com/genymobile/scrcpy/Controller.java
+++ b/server/src/main/java/com/genymobile/scrcpy/Controller.java
@@ -195,6 +195,7 @@ public class Controller {
}
}
+ Ln.i("point = " + point);
MotionEvent event = MotionEvent
.obtain(lastTouchDown, now, action, pointerCount, pointerProperties, pointerCoords, 0, buttons, 1f, 1f, DEVICE_ID_VIRTUAL, 0,
InputDevice.SOURCE_TOUCHSCREEN, 0);
(notice the negative x coordinate) Your system may just ignore it (and consider only events in the screen rectangle). But on my device (OnePlus 7 pro), it works, I can start a swipe event from outside the device to generate BACK. (note that if you just want BACK and HOME, right-click is BACK, middle-click is HOME) |
If you use the binaries from #1580 (comment), what is the output in the console when you click in the black borders? |
Below is the gif and the Console Output Console Dump
|
OK, thank you for the results. So the events outside the screen are correctly forwarded. Your device software just don't consider them for gestures. So I'm closing, there is no problem on scrcpy side. |
Could we rewrite the x axis inside and screen zone before sending to device? |
That would break the expected behavior on devices which correctly handle the events outside the screen :/ |
Then could this be a flag on startup? So it would rewrite the value of axis that is on the black zone. So if the black zone is on the x axis, then rewrite x, and opposite. |
(converted to a feature request) |
Btw, what happens if you open some gallery app, and swipe the photo until outside the device screen, does it continue to move it? |
Yeah, it would continue scrolling between photo when I start the scroll from screen to outside at end of padding zone, not outside of the app windows. |
It just depends how each app decided to handle the out-of-bounds events. |
Well, i am not android developer so i would take your god words. |
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
I am using Samsung Note 10 and I setup my phone to remove Navigation Bar and using One Hand Operation+ for swipe gesture from left/right edge of the screen for navigation.
Like swipe left from right edge to back, swipe left + down from right edge for home.
For that setup, currently I increase horizontal of the window to add black padding zone
But the mouse drag from black padding zone is not recognized.
Describe the solution you'd like
A clear and concise description of what you want to happen.
I am using follow coordinate:
^
|
y
x ->
So when a swipe start from padding zone, we would wait only until the mouse click and being dragged into the screen as filter condition of mistake.
When condition meet, the gesture would start from same Y of the coordinate but we would rewrite the start X coordinator to be inside of screen
The end gesture would be where mouse ended the drag
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: