Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enabeling touch events in Chrome from touch screen

I have a Ubuntu machine with a 24" touchscreen and it is working fine. I can move the mouse, do gestures with several touch points and such so the hardware is working fine. Now I wonder if it is possible to make a browser interpret the events as touch and not as mousedown, mousedrag etc. HTML5 has really good support for touch and multiple touch and I would like to develop web applications for this setup. Does anyone have a clue on how to do this? I've tried enabling the --enable-touch-events switch with no success. Tho it seems that this is only implemented in the ms windows version.

~$ xinput -version
xinput version 1.6.0
XI version on server: 2.2

~$ xinput
⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ Advanced Silicon S.A CoolTouch(TM) System id=9    [slave  pointer  (2)]
⎜   ↳ USBest Technology SiS HID Touch Controller    id=10   [slave  pointer  (2)]
⎜   ↳ Logitech USB Optical Mouse                id=11   [slave  pointer  (2)]
⎜   ↳ MCE IR Keyboard/Mouse (nuvoton-cir)       id=14   [slave  pointer  (2)]
⎣ Virtual core keyboard                     id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Video Bus                                 id=7    [slave  keyboard (3)]
    ↳ Power Button                              id=8    [slave  keyboard (3)]
    ↳ CHICONY HP Basic USB Keyboard             id=12   [slave  keyboard (3)]
    ↳ Nuvoton w836x7hg Infrared Remote Transceiver  id=13   [slave  keyboard (3)]

I've read about building with the touch-UI flag but im not shure it will help?

like image 414
user2244067 Avatar asked Oct 21 '22 13:10

user2244067


2 Answers

Chrome didn't support touch screens on Linux when it was built using GTK. As of Chrome 35, Linux no longer uses GTK but is built on the same UI framework ("Aura") used on Windows and ChromeOS. This means it should now support touchscreens properly (although I often see touchscreen bugs in Ubuntu - especially when using multiple monitors).

like image 184
Rick Byers Avatar answered Oct 24 '22 02:10

Rick Byers


See http://www.html5rocks.com/en/mobile/touchandmouse/ for good answers to your questions.

You say

I've tried enabling the --enable-touch-events switch

Did you start chrome with that command-line switch?

Perhaps you are referring to the following, which would not be the wrong thing to use in your case since you want to receive real touch events.

https://developers.google.com/chrome-developer-tools/docs/mobile-emulation#emulate-touch-events

Try experimenting in the JavaScript console with a little event handler installed for any event types you are interested in (see below).

["click", "mousemove", "touchmove"].forEach(function(value, index, object) {
    document.addEventListener(value, function(event) {
        console.log(JSON.stringify([event.type,
            event.srcElement.localName + (event.srcElement.id ? '#'
            + event.srcElement.id : "")
            + (event.srcElement.classList.length ? '[class='
            + event.srcElement.classList + ']' : ""),
            (new Date(event.timeStamp)).toJSON()]));
    }, false);
});

Does this help?

like image 38
stackunderflow Avatar answered Oct 24 '22 03:10

stackunderflow