touchscreen & mousedown events

This forum is for topics specific to the Raspberry Pi and Arch Linux ARM

touchscreen & mousedown events

Postby crankshaft » Tue Sep 23, 2014 6:49 am

I have been working on this for several days and are unable to find a solution, and are not really sure what to try next.

I have a small touch screen (320 x 240) which runs a kiosk browser (surf & xorg) running html5 / javascript.

The problem that I am facing is that using the "onmousedown" event, finger presses on buttons do not register until the finger is released, whereas with a mouse click it registers on the down-click. so effectively there is no "mousedown" event, only a "mouseup" event when using the touch screen.

I thought that the solution would be to use the javascript "touchstart" and "touchend" events, but these don't work at all despite the fact that the browser acknowledges with 'true' that it supports touch events:

$this->bbcode_second_pass_code('', '
alert( 'ontouchstart' in document.documentElement ) - true

document.getElementById("but").addEventListener("touchstart", function(){
alert('touchstart');
}, true);

')

But I have read elsewhere that some browsers will report a "false true" when in fact it is not supported.

Because of this problem, the user cannot tell if the button press was successful as the button style does not change when pressed.

I have tried this with a diffrent browser with the same results, and so I am starting to think that this may be related to the way that xorg sees and handles the touch events.

Any help or suggestions would be appreciated !
crankshaft
 
Posts: 15
Joined: Sat Feb 16, 2013 8:49 am

Re: touchscreen & mousedown events

Postby sdjf » Sun Sep 28, 2014 7:30 am

I do not totally understand your setup, but know that when I do keyboard mouse emulation, not everything is recognized whether or no I go through VNC to most websites, but is recognized if I type the equivalent xdotool command on the commandline. I am suspicious it may have something to do with openbox.

The solution for me until I got a "real" mouse I could use, was to create aliases for the xdotool commands for various mouse events, and then type those single words in a console, and then the events worked. But I did not try mousedown/mouseup, these were left clicks I cannot get websites to see going through openbox for them.

xdotool does have the ability to emulate mousedown/mouseup, I don't know if your kiosk browser setup would enable you to enter xdotool commands to tell the system what you want. Sounds like a real pain, you really just want events to register without typing, but maybe something here might help.
sdjf
 
Posts: 178
Joined: Wed May 08, 2013 1:55 pm


Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 69 guests