Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: No touch events on Surface devices  (Read 3315 times)

0 Members and 1 Guest are viewing this topic.

Herb

  • Newbie
  • *
  • Posts: 4
    • View Profile
No touch events on Surface devices
« on: October 20, 2016, 05:51:07 pm »
On a MS Surface 3, all touch events come in as mouse events:

- sf::EventType::MouseButtonPressed
- sf::EventType::MouseButtonReleased  <-- rarely receive this one
- sf::EventType::MouseMoved

This would be okay if the Released messages were reliable, but rarely receive them.

Also tried using sf::Touch::isDown() but it never returns true.  It's like SFML is completely unable to hook the touchscreen at all on these Surface devices.

I searched the forum before posting this.  Does anyone know of a reliable workaround?

Thanks.

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: No touch events on Surface devices
« Reply #1 on: October 20, 2016, 10:45:52 pm »
If possible, try using a debug build and step through related window messages. Don't think any of us has a Surface 3 for testing (unless anyone is up for buying me one… :P).

Herb

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: No touch events on Surface devices
« Reply #2 on: October 21, 2016, 01:24:04 am »
Hi Mario,

Yes, I did step through with a debugger, and set breakpoints.  That is how I verified that only mouse events are coming in.  Besides events, the sf::Touch class is not returning any activity at all.  Am I missing an SFML setup or initialization call for touchscreen?

Thanks.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: No touch events on Surface devices
« Reply #3 on: October 21, 2016, 07:38:36 am »
Touch events are not implemented in the Windows back-end. So unless the OS correctly maps them to mouse events, you won't get anything.
Laurent Gomila - SFML developer

Herb

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: No touch events on Surface devices
« Reply #4 on: October 21, 2016, 04:41:47 pm »
Thanks for the reply, Laurent.  *Please* add that to the documentation.  I spent about 16 hours on this unnecessarily.

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: No touch events on Surface devices
« Reply #5 on: October 21, 2016, 07:16:14 pm »
Argh, right, now I remember that pull request still isn't merged!

You can check out SFML's branch "feature/windows_touch", which includes touch support for Windows – although it's untested on actual devices.

You can find the details in this pull request.

If you want to give it a spin, leave your feedback in the PR. :)

Just keep in mind this branch implements the touch events but not the functions to check directly (i.e. sf::Touch*()).