-
Notifications
You must be signed in to change notification settings - Fork 180
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 screen not working with new build. #1577
Comments
So weird discovery. If touchscreen=1 I can select by using a 2 button press. I'm guessing it's a side effect of this being designed for non-multitouch screens? |
I think this could be very well be solved in the latest build, as there have been many changes and cleanup to the input system. |
So I'm just getting this setup again. on the latest official build and on the latest git this still seems to be happening. I can select if I double click with 2 fingers. I'm trying to setup input logging that was recommended when I was working on this last year but I'm finding my coding skills in this case to be lacking. I'll keep poking at it. |
I've been going back through commits trying to find where it actually broke. Right now it looks like it broke right after the SDL 2 migration as suspected. I've traced it back to these commits: interestingly, in these commits single pressing will highlight the button I want to press then using 2 fingers it will select like I clicked so it's still seeing the input on this commit, just not treating it like a click. |
I found a post on discord I missed with instructions for logging. I'm back to trying to fix this again. Sorry to spam this. |
I think I located most of the issues with this. Many of the gui button presses ignore the ID of the press and just return true when pressed. Using two fingers sends two signals and it also gets two singlas when fingers are are removed. No real way to track this however as the gui bits do not record the state of the finger presses individualy. Might fidle with it, I got me one of those dell touch screen pc's I gave to my grandma so it should be fully compatable to how SDL2 does it. |
So I've finally managed to finagle ints out of Serious Proton for my touch screen. for the down and up events. Which looks like those are mouse down and mouse up events? |
1792 and 3 are SDL_FINGERDOWN and SDL_FINGERUP, respectively. 1025 and 6 are SDL_MOUSEBUTTONDOWN and SDL_MOUSEBUTTONUP, respectively. I would want to know which button event is being passed by SDL_MOUSEBUTTONDOWN/UP at the point when you're collecting the event type. I'd typically expect a single-finger touch to send a left click and a two-finger touch to send a right click, but maybe that's reversed here, or they're sending unexpected buttons. https://wiki.libsdl.org/SDL2/SDL_MouseButtonEvent: button may be one of: SDL_BUTTON_LEFT which may be SDL_TOUCH_MOUSEID, for events that were generated by a touch input device, and not a real mouse. You might want to ignore such events, if your application already handles SDL_TouchFingerEvent. SP handles each button as a different
|
INFO: keybindings timestamp: 17317 So here's the output from clicking around a couple of parts of the screen. Interestingly it appears that the system thinks I'm always clicking at 958:549. Here's output from a mouse click a few places on the screen for comparison: NFO: keybindings type: 1025 So I'm not sure what's going on there. Just to make sure something else hadn't broken it I removed my test deb and installed the Linux_EmptyEpsilon_EE-2021.06.23.deb that previously worked before the SDL2 upgrade and it's still working as expected. |
Can you dump the diff you're using to test in a comment so I can reproduce and play around with this? There are a ton of variables and I can't reproduce the behavior yet, so I'm poking around blindly and it'd help to confirm exactly where these logged values are coming from. I feel like I'm safely assuming it's from the SDL event, but SP has its own Button enum, SDL can report position coordinates differently for touch and mouse, and there are some variable outcomes depending on SDL version (ie. EE 2022.10.28 for Windows bundles a 2.0.16 DLL, Ubuntu 22.04 ships 2.0.20, SDL2 2.0.22 fixes and breaks a bunch of touch/mouse emulation, like libsdl-org/SDL#5652 and libsdl-org/SDL#4518). |
Also,
|
Bus 001 Device 004: ID 0457:1122 Silicon Integrated Systems Corp. |
Dug up a touchscreen Lenovo P40 (Wacom digitizer supporting finger input) running pop_OS! 22.04 and built EE on it off the master branch. It seems to register only fingerdown/up on the touchscreen, no mouse events. SDL 2.0.20, X11, GNOME 3, with this SeriousProton patch: diff --git a/src/io/keybinding.cpp b/src/io/keybinding.cpp
index 3c7584f..21fc213 100644
--- a/src/io/keybinding.cpp
+++ b/src/io/keybinding.cpp
@@ -527,6 +527,7 @@ void Keybinding::handleEvent(const SDL_Event& event)
break;
case SDL_MOUSEBUTTONDOWN:
{
+ LOG(INFO) << "SDL_MOUSEBUTTONDOWN button: " << (int)event.button.button << "\nx.y: " << event.button.x << "," << event.button.y << "\nwhich: " << event.button.which << "\nclicks:" << event.button.clicks << "\nwindowID: " << event.button.windowID;
io::Pointer::Button button = io::Pointer::Button::Unknown;
switch(event.button.button)
{
@@ -543,6 +544,7 @@ void Keybinding::handleEvent(const SDL_Event& event)
break;
case SDL_MOUSEBUTTONUP:
{
+ LOG(INFO) << "SDL_MOUSEBUTTONUP button: " << (int)event.button.button << "\nx.y: " << event.button.x << "," << event.button.y << "\nwhich: " << event.button.which << "\nclicks:" << event.button.clicks << "\nwindowID: " << event.button.windowID;
io::Pointer::Button button = io::Pointer::Button::Unknown;
switch(event.button.button)
{
@@ -595,10 +597,12 @@ void Keybinding::handleEvent(const SDL_Event& event)
break;
case SDL_FINGERDOWN:
//event.tfinger.x, event.tfinger.x
+ LOG(INFO) << "SDL_FINGERDOWN event.tfinger.x,y: " << event.tfinger.x << " " << event.tfinger.y << "\ntouchId: " << event.tfinger.touchId << "\nfingerId: " << event.tfinger.fingerId << "\nwindowID: " << event.tfinger.windowID;
updateKeys(int(io::Pointer::Button::Touch) | pointer_mask, 1.0);
break;
case SDL_FINGERUP:
//event.tfinger.x, event.tfinger.x
+ LOG(INFO) << "SDL_FINGERUP event.tfinger.x,y: " << event.tfinger.x << " " << event.tfinger.y << "\ntouchId: " << event.tfinger.touchId << "\nfingerId: " << event.tfinger.fingerId << "\nwindowID: " << event.tfinger.windowID;
updateKeys(int(io::Pointer::Button::Touch) | pointer_mask, 0.0);
break;
case SDL_JOYBUTTONDOWN: I get output like this using trackpad input only:
All mousebutton events, no fingerdown/up. I get this from touchscreen finger input only:
All fingerdown/up, no mousebutton events registered. EDIT: Same behavior with the same patch on an aarch64 ChromeOS touchscreen device in Crostini/"Linux container" mode. Trackpad reports mousebutton events only, touchscreen reports fingerup/down events only. Didn't get logs but I've not seen weird touch behavior on several Android phones and tablets, with or without keyboards involved. I suspect that either the touchscreen device is doing something unusual and SFML allowed/ignored it but SDL doesn't, or you've got a specific set of circumstances between installed SDL libs and drivers that I don't have any way to reproduce. |
Yeah that's what I expect too. But with these displays at least the finger only events only happen with 2 or more fingers pressed. |
This might be something: there were three models of that display, one with a standard SiS digitizer, and one with an optical TPV digitizer, and one with a TPV driver that had a relative mouse mode, where the touch device behaved like a joystick: https://forum.odroid.com/viewtopic.php?p=115380&sid=27193017ee17c72834ef3e95e4477ab5#p115380
This mode was inherently not multitouch, so putting a second finger on the display passes a normal touch event.
In this case, I think that behavior is either coming from the device or the kernel. Why SFML ever worked with it, I don't know. |
Yeah I dunno. I'm guessing SFML just pulled from the standard X input? I'm currently installing ubuntu 22.04 on the sd card for the hp T610 and the touch screen is registering just fine for the install. |
So I'm fairly confident it's got to be something in the minimal configuration that's causing the events to not read right. I did a full desktop install of ubuntu 22.04 and installed my logging version of EE on the system and the touch screen appears to work with the fingerup and fingerdown code that exists. Now I just have to figure out what the full desktop experience has installed that's missing. |
I wonder if there's a difference using a minimal WM, like openbox? SDL has some checks for whether a window manager's in use. |
On linux, with Also, which SDL2 version is your linux system running? This could just be an SDL2 bug that is fixed upstream. |
I played with evtest last night before bed. If I run it with no window manager it gives me the same output we're seeing in EE, (x,y always 958,459). I get the same with TWM. but as soon as I moved up to icewm it switched from from mouse button at 948,459 to touch at the correct coordinates. So there's SOMETHING getting flipped with the window managers. So now my hunt is for a small window manager that will autostart the ee script I have and doesn't need to write to the file system since this is for an environment where only /tmp is writeable. :p But I've made a ton of progress on this thorn in my side the last few days. Thank you for the help. :) |
I am surprised Xorg has influence on input events like that... |
Yeah I'm not sure what's going on but I'm not going to question it after how long I've been fighting this. :p I've now got icewm starting underneath the application and the touch screens are functioning as expected. As such I'm going to close this issue. Thanks again. |
From
If nothing's changing in the kernel and nothing's changing in the device, then There might be two differently behaving driver layers, the kernel ( So I'm curious if some WMs, or even your minimal environment, use or install (SDL had known issues with libinput and ibus, including duplicated events, and - again - I'm still very very very curious what version of SDL you're using to build, because some of those issues are also fixed or introduced in SDL 2.0.22. ) libinput provides some troubleshooting tools: https://wayland.freedesktop.org/libinput/doc/latest/tools.html If libinput's already installed I'd especially be interested in the output of
and then the output of running EDIT: Started writing this before it got closed, but if you reopen this, I'd still be curious. EDIT: The X.org log linked in the ticket suggests libinput was present:
|
I don't pretend to understand what's happening. I just know when it was just xterm and evdev with no WM I got one output and when it was icewm and evdev I got another. But it's been 2 years of fighting with it to get it to work so now that it works I'm ready to quit thinking about it. :p Well that was a pain. the libinput command wasn't installed so I had to go chase down what provided it. root@ee-client:~# sudo libinput list-devices Device: Power Button Device: HD-Audio Generic HDMI/DP,pcm=3 Device: SEM USB Keyboard Device: SEM USB Keyboard Consumer Control Device: SEM USB Keyboard System Control Device: SINO WEALTH Gaming KB Device: SINO WEALTH Gaming KB System Control Device: SINO WEALTH Gaming KB Consumer Control Device: SINO WEALTH Gaming KB Keyboard Device: Optical Mouse Device: USBest Technology SiS HID Touch Controller Device: HDA ATI SB Mic Device: HDA ATI SB Headphone Device: HP WMI hotkeys root@ee-client: the SDL versions of the two build environments I used: ii libsdl2-2.0-0:amd64 2.0.10+dfsg1-3 amd64 Simple DirectMedia Layer ii libsdl2-2.0-0:i386 2.0.14+dfsg2-3+deb11u1 i386 Simple DirectMedia Layer |
My touch screens are no longer working with the latest updates. I tested with the 2021623 debian build and they are working. when I build the latest from source they become unreactive.
I've attempted to use it as a mouse by setting touchscreen=0. the mouse pointer does not respond without touch enabled.
The text was updated successfully, but these errors were encountered: