3

I have bought a touch screen LCD display. LCD module is connected via HDMI and I can see desktop, no problem with that.

The touch screen part has a circuit which converts the pysical interaction into mouse-click and mouse-movement signals.

I opened a website and tried to navigate through pages. When I swiped up in order to see the bottom part of the page, it didn't behave as intended.

I touched (pressed to the screen), moved my finger upwards, and released my finger. Instead of scrolling, browser thinks that I had a mouse, clicked on the page, moved upwards and released; thus it selected some text in the page.

How can I tell the application that "this is not mouse pointer, this is a touch screen, you should scroll!"?

3
  • Have you tried handling mouse clicks and motion reports in your own handler and writing software to convert the events into swipe events?
    – joan
    Commented Aug 15, 2015 at 7:21
  • @joan even though this is possible, it will only count as a workaround. The graphical thing that I want to touch is an HTML document (see edit) and I can touch/swipe it if I open the page from my phone's browser.
    – ceremcem
    Commented Aug 15, 2015 at 12:03
  • How can I tell the application that "this is not mouse pointer, this is a touch screen"? -> As per my answer there's no point in doing that. The application knows what a mouse is and is programmed to respond to one. It does not know what a touchscreen is and has no "swipe" functionality. It is not the same as the browser on your phone.
    – goldilocks
    Commented Aug 15, 2015 at 13:48

1 Answer 1

2

How can I convert "left clicked and moving mouse" event into "swipe" event?

Conceptually this is fine, but literally there's no point because a "swipe" is meaningless to the desktop interface. This is why a touchscreen driver emulates a mouse. It does the reverse of what you want, that is, it translates a swipe, which is meaningless to the GUI, into a set of mouse events.

That is different than a touchscreen phone, where there is no mouse and so mouse events, if you could attach one (perhaps some tablets allow this via bluetooth), would have to be translated into touchscreen events.

Most desktop browsers (such as those used in Raspbian, which is a desktop PC OS, not a mobile phone OS) can be scrolled with a mouse wheel if the cursor is in the main window. I believe this is another form of translation by the GUI stack; it tells the browser that the scroll bar on the side of the window is being moved. In any case, that's what you want to simulate.

There is a simple way to do that for mice that do not have a wheel; there's an example here, see also man evdev. Note that it means dedicating one of the buttons to this purpose, so when you hold it down, movement is treated as a scroll. This may be a bit of a problem for you if the touchscreen driver only simulates a single button mouse and/or won't hold a button down when you swipe.

However, there's a chance it could be made to work, and it is easy enough to try. Add a file to /etc/X11/xorg.conf.d/ as in the example (you may have to create that directory) and try tweaking it various ways. For the changes to take effect, you will have to shut down and restart the X server. /var/log/Xorg.0.log may then say something about whether your configuration was accepted or not.

A sure fire way to do this would be to write your own touchscreen driver, but that would be a considerable amount of work and require proficiency with C and getting familiar with the linux kernel API.

5
  • Thank you for your answer. In fact, there is a driver distributed by the module and I'm putting it to github temporarily (you might want to inspect): github.com/ceremcem/tmp-touchpad-driver Here I found a forum thread that someone experienced exactly what I did: empegbbs.com/ubbthreads.php/topics/358549/…
    – ceremcem
    Commented Aug 15, 2015 at 22:00
  • So I understand that the application is responsible for translating mouse events into touch events? For example, Kivy framework behaved in that way by default . Even you can not use it on the desktop if you don't say "show mouse pointer" explicitly.
    – ceremcem
    Commented Aug 15, 2015 at 22:21
  • Of course there's a driver -- touching the screen wouldn't work to do anything otherwise. Modifying that to do what you want isn't something anyone is likely to do in 5 minutes; think more like 5+ hours for someone who already has a substantial understanding of the specifics involved, or between 5 days (full time) and 5 weeks for someone who does not, but is still a competent C programmer.
    – goldilocks
    Commented Aug 15, 2015 at 22:26
  • NO THE APPLICATION IS NOT RESPONSIBLE. The application has nothing to do with the touchscreen. All it understands is a mouse; a driver of one sort or another translates touch events into mouse events, because that's the only thing the application can understand.
    – goldilocks
    Commented Aug 15, 2015 at 22:32
  • My point is, unless the manufacturer of the screen (or someone else) has put the work into providing the functionality you want into a driver, you'd have to do that work yourself, and that is a fairly high skill task. No one is going to be able to answer a few questions online to allow you to do it yourself, in the same sense that many tasks involving surgery or engines cannot be reduced to a few easy steps for the layman. Basically, you're stuck with what you have.
    – goldilocks
    Commented Aug 15, 2015 at 23:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.