Touch screen problem

hi,
I’m using sdl 2.0.1 on embedded device with touchscreen.
I can see the cursor and if I touch the screen the cursor moves in the
new position correctly, but SDL_GetMouseState(&x, &y) return always 0
and x and y values are both 0. Is it a bug or isn’t correct the use of
SDL_GetMouseState ?
The same program on my laptop works fine.
thank you
Andrea

That may be considered a bug, but I recommend that you treat mouse and
touch devices separately. You should be able to use SDL_GetTouchFinger (
http://wiki.libsdl.org/SDL_GetTouchFinger) to check the touch state. Mouse
state is technically separate although mouse events might be sent even for
touch devices. Check for SDL_FINGERDOWN and similar events to properly
handle touch events apart from mouse events.

Jonny DOn Wed, Nov 20, 2013 at 5:18 PM, Andrea <andrea.seraghiti at uniurb.it> wrote:

hi,
I’m using sdl 2.0.1 on embedded device with touchscreen.
I can see the cursor and if I touch the screen the cursor moves in the
new position correctly, but SDL_GetMouseState(&x, &y) return always 0
and x and y values are both 0. Is it a bug or isn’t correct the use of
SDL_GetMouseState ?
The same program on my laptop works fine.
thank you
Andrea


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I think that my touch is recognized only as mouse becouse
SDL_GetNumTouchDevices() SDL_GetTouchDevice(0) return always 0.
My touch drivers is based on:

Another information, I use framebuffer and to enable the cursor I set:
export SDL_DIRECTFB_LINUX_INPUT=1

Why the cursor moves correctly? don’t uses SDL_GetMouseState?

I would also hide the cursor with:
SDL_ShowCursor(SDL_FALSE);
but works only on laptop :frowning:

thank you
Andrea

2013/11/20 Jonathan Dearborn :> That may be considered a bug, but I recommend that you treat mouse and touch

devices separately. You should be able to use SDL_GetTouchFinger
(http://wiki.libsdl.org/SDL_GetTouchFinger) to check the touch state. Mouse
state is technically separate although mouse events might be sent even for
touch devices. Check for SDL_FINGERDOWN and similar events to properly
handle touch events apart from mouse events.

Jonny D

On Wed, Nov 20, 2013 at 5:18 PM, Andrea <@Andrea2> wrote:

hi,
I’m using sdl 2.0.1 on embedded device with touchscreen.
I can see the cursor and if I touch the screen the cursor moves in the
new position correctly, but SDL_GetMouseState(&x, &y) return always 0
and x and y values are both 0. Is it a bug or isn’t correct the use of
SDL_GetMouseState ?
The same program on my laptop works fine.
thank you
Andrea


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

2013/11/20, Andrea <andrea.seraghiti at uniurb.it>:

Why the cursor moves correctly? don’t uses SDL_GetMouseState?

Because SDL isn’t handling that cursor at all, the operating system
is. SDL_GetMouseState relies on SDL getting the appropriate mouse
events and then updating its own copy of the mouse state, but that’s
just bookkeeping.

This is probably a bug though. Taking a guess, SDL is not converting
the touch events, just the mouse ones. Can you fill a report in
bugzilla? (does anybody remember the URL? :P)