-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
touch support in wayland (gnome, phosh) #1536
Comments
Oh, that's unfortunate. 😞 However, scrcpy uses SDL to receive input events ( |
i asked in #SDL on IRC and got a reply that touch might be only implemented for wayland when using QT on further investigation i found that on wayland touch is actually working, however the surface that recognizes touch seems to be scaled down to a small area of the screen (i'd say a 1/8) compared to the real window-dimensions |
Oh, interesting! And the mouse works as expected? It might be #15, but specific to touch events. Is it better with this change? diff --git a/app/src/input_manager.c b/app/src/input_manager.c
index e8ba9f79..588432c6 100644
--- a/app/src/input_manager.c
+++ b/app/src/input_manager.c
@@ -467,7 +467,7 @@ convert_touch(const SDL_TouchFingerEvent *from, struct screen *screen,
int ww;
int wh;
- SDL_GL_GetDrawableSize(screen->window, &ww, &wh);
+ SDL_GetWindowSize(screen->window, &ww, &wh);
// SDL touch event coordinates are normalized in the range [0; 1]
int32_t x = from->x * ww; |
this actually fixed it, thanks for looking into it! will test mouse later also |
OK, thank you, so I'll write a better fix. I'll ask you to test again when it's done :) |
Touch events were HiDPI-scaled twice: - once because the position (provided as floats between 0 and 1) were converted in pixels using the drawable size (not the window size) - once due to screen_convert_to_frame_coords() One possible fix could be to compute the position in pixels from the window size instead, but this would unnecessarily round the event position to the nearest window coordinates (instead of drawable coordinates). Instead, expose two separate functions to convert to frame coordinates from either window or drawable coordinates. Fixes #1536 <#1536> Refs #15 <#15> Refs e40532a
Here is a proper fix: fb5e619 Could you confirm that it works, please? |
working perfect, thanks for looking into this! |
Touch events were HiDPI-scaled twice: - once because the position (provided as floats between 0 and 1) were converted in pixels using the drawable size (not the window size) - once due to screen_convert_to_frame_coords() One possible fix could be to compute the position in pixels from the window size instead, but this would unnecessarily round the event position to the nearest window coordinates (instead of drawable coordinates). Instead, expose two separate functions to convert to frame coordinates from either window or drawable coordinates. Fixes #1536 <#1536> Refs #15 <#15> Refs e40532a
Thank you for your report and feedback 👍 Merged into |
Environment
Describe the bug
using phosh (phone sized wayland client) on my pinephone no touch events are registered in scrcpy, while it is working flawlessly with X11. i tested this also under gnome using wayland, and touch is also not recognized
The text was updated successfully, but these errors were encountered: