Q: How do you tell the difference between a mouse and a touchscreen?



  • A: Use Google Chrome.

    I still can’t figure out the how or why of this, but I’ve reached the conclusion that Google Chrome can tell the difference between a click generated by a mouse and a “click” generated by tapping a touchscreen even though Windows sees them both as mice.

    The situation: a museum display that uses a computer with a touchscreen to run an interactive display. The software that runs on this is client-server combination so that the content can be modified from a computer in another part of the building. This software is a horrible piece of shit both on the server and client sides, with a user interface to match on both sides as well.

    I volunteered to replace this by something more usable and more easily expandable. To do so, I chose a PHP-based web site, on the basis that it will allow museum staff to simply put files into directories on the server to make them visible on the client (thereby avoiding the need for staff to learn how to use software to manage all this), while giving the freedom for the client side to use any OS that runs a modern web browser and allowing the whole thing to be maintained by future generations of museum volunteers. I won’t claim my efforts are any better than the original code-wise, but they certainly are as far as usability is concerned.

    When I’d finished setting up the server side early this afternoon, it was time to do the client. I’d picked Chrome as my choice of browser, since it has a built-in kiosk mode (--kiosk --kiosk-printing — don’t ask me why it needs both those switches). After all kinds of trouble getting it to install on the computer¹ it turns out it didn’t respond to taps on the screen. After a lot of investigating, I can only conclude that Chrome can somehow tell that the touchscreen isn’t a mouse — even though every other program on the computer responds to it as if it is.

    I can hear you think: well, duh, it’s a touchscreen — Windows will know it is. Possibly, but the only place in Windows where I could find any reference to the touch capabilities of this screen, is in the mouse part of the system settings. The computer claims it has two mice connected to it: one generic PS/2 type and one [url=http://www.inexio.co.kr]iNexio[/url] blah blah blah USB mouse. It gives every impression that the screen’s driver simply tells Windows “I’m a mouse, and somebody just moved the pointer here and clicked.” It certainly doesn’t use Windows’ pen/tablet settings — tapping the screen doesn’t give those little circles where you tap, even though I checked that that setting is on.

    Chrome turns out to have some flags for touch devices, but setting those also makes no difference — yet at the same time, the damned thing refuses to treat a touchscreen that seems to claim to be a mouse, as a mouse …

    End result: the screen now has a piece of paper on it that says it’s out of order until we can figure out WTF is going on here.²

    ¹ Not caused by Chrome but by an F-Secure virus scanner that was about four years out of date, claiming Google Update.exe contained a trojan. I’ve not figured out why somebody back then decided a computer that is in a network with exactly one other computer — a network that’s isolated from the rest of the world — needs a virus scanner. I figure they thought, It’s Windows, slap one on.
    ² Turning the old software back on should be possible, but in tinkering with the network settings on the server I must have broken something that it depended on, as the client side wouldn’t do more than give a blank screen. Oops.



  • Is this relevant?

    @Gurth said:

    Chrome turns out to have some flags for touch devices, but setting those also makes no difference
    Was one of those the "Enable Touch Events" flag?

    (No idea why I am posting this, as you obviously did this yourself - just in case, I guess?)


  • SockDev

    @Gurth said:

    even though Windows sees them both as mice.

    windows knows one's a touch screen. It reports the touch screen as both a mouse and a touch screen because older programs don't know about touch screens but do know about mice.



  • Yes, the #touch-events flag that you can set to automatic, enabled or disabled. Searching the net, I discovered that Chrome in its latest versions apparently has trouble with Windows pen settings unless you set this flag to something other than automatic — but like I said, this particular touchscreen doesn’t use those, so I guess that’s why the flag had no effect either.



  • @Gurth said:

    don’t ask me why it needs both those switches

    It may have changed since then, but reading some old information suggests that --kiosk is for Chrome OS only and is meant for demoing Chromebooks in retail stores. That's one big undefined for Chrome - why does this flag do something completely unintuitive!?


  • Impossible Mission Players - A

    @Gurth said:

    I chose a PHP-based web site, on the basis that it will allow museum staff to simply put files into directories on the server to make them visible on the client (thereby avoiding the need for staff to learn how to use software to manage all this)

    This sounds oddly familiar to a site I scratched together to display a "dynamic" slideshow...


    Filed under: Each browser that uses the site controls the slideshow. It even sends the Refresh command to all the other shows, so they're always perfectly sync'd!



  • I applaud your intent but you seem to have painted yourself into a corner thereby leaving you up a, not very nice smelling, creek without a paddle.

    You stated that you intended the client to be non specific to the server or software, I.e. Anything capable of running a browser which, simply put, is similar to my own desires in providing "software".
    You imply you have only tested it with chrome and it don't work. You state that there is only one client and you indicate that the "system" is not working because of it.

    Have you tried other browsers, or older versions? After all, with one client you can be very specific, at least until you get a fix.

    The other obvious question, and I am sorry if I am using @accalia cluebat to beat you around the head, but did it work whilst you developed it? If so what has changed?



  • @accalia said:

    windows knows one's a touch screen. It reports the touch screen as both a mouse and a touch screen because older programs don't know about touch screens but do know about mice.

    Aha. I couldn’t find anything else related to the touch screen in Windows’ settings, but I may have overlooked something. Will have to check sometime soon …

    @loose said:

    You imply you have only tested it with chrome and it don't work. You state that there is only one client and you indicate that the "system" is not working because of it.

    I tested it in Safari, Chrome and Firefox on my own computer, and it worked fine in all of them — but I don’t have a touchscreen like the one in the museum. What is a (IMHO minor) failure of mine is that I didn’t expect that a browser responds differently to a touchscreen, but OTOH, I don’t think I could have seen that one coming anyway.

    As for using other browsers: I tried some on the museum computer. Firefox works, but is almost unusable because it requires you to touch the screen and lift your finger off cleanly, without moving it on the screen at all — moving by even one pixel between pressing and releasing the screen appears to be treated as a drag rather than a click. In addition, it didn’t play the videos (which are in MP4 format) even though my Firefox at home does … this is probably a matter of a plugin, though.

    The site worked in the version of IE on the computer, but that’s so old that it doesn’t seem to know CSS3; I could live without the animations, but not with everything being positioned as if no dimensions are supplied at all (since I scaled much of it using vw and vh measurements). IIRC it also had some other problems, but I don’t quite remember what they were. In any case I wasn’t in a position to test the site under IE on my computer at home, and so don’t want to run the live version under it either before I can actually test it and make sure it works correctly.



  • You are listening for touch events,right?
    It's a huge cluster fuck, I remember having similar problems before. AFAIR I fixed it by adding a few events to the click handler..



  • i can understand your pain.

    My next PHP Server driven project assumes, nay, requires User Input to be via touch, Either via browser or dedicated App from a mobile device.

    I, therefore, fully appreciate your detailing some of the "unexpected" pitfalls. Thank you,


  • SockDev

    @loose said:

    I am sorry if I am using @accalia cluebat to beat you around the head,

    ..... @accalia does not appreciate being used as a cluebat and is giving you three seconds to let go of her tail before she is forced to maul you.

    🤣



  • Ok, let's see if this can be fixed...

    "...using @accalia's cluebat..."


  • Discourse touched me in a no-no place

    @accalia said:

    @loose said:
    I am sorry if I am using @accalia cluebat to beat you around the head,

    ..... @accalia does not appreciate being used as a cluebat and is giving you three seconds to let go of her tail before she is forced to maul you.

    🤣

    I hear if you swing an @accalia around by the tail fast enough she can't turn on you before you stop.



  • If you let go while swinging her fast enough, you might be able to throw her far enough that you can get to safety before she can turn and get to you.



  • @FrostCat said:

    I hear if you swing an @accalia around by the tail fast enough she can't turn on you before you stop.

    The evil ideas thread is ⏫🔽undefined◀↪



  • @LB_ said:

    old information suggests that --kiosk is for Chrome OS only and is meant for demoing Chromebooks in retail stores

    I just tried Chrome with the --kiosk-printing switch only, and that just launches it in a window — whereas only --kiosk put it (as I recall) in fullscreen mode but with titlebar and tabs on Windows, while on my Mac it does hide those. Weird.

    @swayde said:

    You are listening for touch events,right?

    Time to own up that I don’t, I suppose … since I kind of took it for granted that Windows treated the touchscreen as a mouse, I didn’t see a need to specifically code for touch events. Which, though, still doesn’t make Chrome less of a undefined for treating them differently when literally every other program I tried on the machine doesn’t differentiate between them at all (that’s my excuse, anyway ;)).



  • @swayde said:

    You are listening for touch events,right?
    You're seriously suggesting overriding the browser's hyperlink handling and doing it the Discourse way? undefined

    If it's the only option...


  • SockDev

    @FrostCat said:

    hear if you swing an @accalia around by the tail fast enough she can't turn on you before you stop.

    I hear that if you do that your chances of being targeted by flying fox drones increases ten billion percent



  • @accalia said:

    I hear that if you do that your chances of being targeted by flying fox drones increases ten billion percent

    Yeah but there would be a typo when the target was set, so the drones would end up somewhere else anyway.


  • Discourse touched me in a no-no place

    @accalia said:

    I hear that if you do that your chances of being targeted by flying fox drones increases ten billion percent

    BRING IT! I haven't had a good THAAD test in a while!


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.