We are creating a game that does not use a mouse or keyboard, only a touchscreen. We are using Ubuntu 16.04 for the OS. I found that after cross-compiling our game on Linux and running, there was no Linux touchscreen support. So we added code to LinuxApplication.cpp using the SDL_Event library documentation and the existing mouse events that works for simple touch and swipe/drag events.
The only issue that we have now is that if we turn on the computer and boot up then launch the game without first using the touchscreen, we get no input. Once the touchscreen is “touched” just once, we can launch the game without any issue and it works fine. If we fail to touch the screen before we launch the game, however, we must quit the game and relaunch. We need to be able to launch the game after startup, so we must have the touchscreen work without first having to touch the screen.
I am looking at all options, from scripting a fake touch (not sure if this is possible) before scripting the game launch after startup of the computer, to perhaps modifying more of the engine code or possibly some of the Linux OS code. I was hoping that a post here would ilicit some good ideas or suggestions.
I would suggest first understanding why the issue happens and trying to fix it properly before attempting a workaround. Try figuring out if this is a SDL issue or UE4 issue, then try narrowing it down - if the bug can be reproduced in a standalone “hello touch” it would be easier to test (or, in case it is a UE4 issue, use a more lightweight SlateViewer). Once the issue is understood it’ll be easier to suggest a fix (or workaround, if fixing is too hard).
I completely agree. I have a basic blueprint only project using the Umg quickstart tutorial in the documentation that I have been using for testing. Seems its as if the code I have written to solve this issue does not run unless you touch the screen before you run the project. In other words I think either the SDL or Linux OS is sending a mouse event instead of a touch event unless you use the touchscreen in the OS first, if that makes sense.
I’m afraid this is still not low level enough to understand the problem, at least for me. Would you mind using one of non-UE4 SDL examples to see if the same behavior is reproducible there?
If you don’t have time or motivation to drill deeper, I suggest implementing whatever workaround works best for you. We don’t have a Linux system with a touchscreen currently, so unfortunately it may take time to get the issue fixed on our side. Reaching out to Linux community (like you did by posting here on AnswerHub) is a valid option too; I suggest soliciting ideas on other communication channels too (UE forums, IRC - whatever you have time for).
Figured it out, at least part of the way. Unreal is not the only application that has the issue and apparently it is related to how X11 apps queue up drivers for their Virtual Master input through xinput. For more information here is the same issue using Chromium. 439914 - chromium - An open-source project to help move the web forward. - Monorail. I am currently looking into a way to possibly repoll the application for touch inputs after the initial game launch or perhaps using the SDL framework. Not my forte by any stretch of the imagination.
Sure there are two machines we are testing on. We have an Acer ASPIRE Z3-715 with a USBest SiS HID Touch Controller vendor 0457 product 109f and a custom built machine that uses Ilitek Multi-Touch-V3000 vendor 222a product 004d.
I submitted a pull request to the 4.12 branch as that is what we are currently working in: https://github.com/EpicGames/UnrealEngine/pull/2916
You’ll notice I added some notes. I never had a remote debugger going between my windows box and the dev linux machines I was testing on, so I have no doubt that you might want to make some changes or refactorings if the code is something that you might want to use.
Thank you for sharing the code. Over the last weekend I added a simpler implementation that uses Slate’s OnTouch*() API. If you want to try it, I can let you know when it hits Main branch, but if you are fine with your version it is also fine.