Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDL mouse driver ignores touchscreen events #96

Closed
stawnPTL opened this issue Apr 22, 2020 · 2 comments
Closed

SDL mouse driver ignores touchscreen events #96

stawnPTL opened this issue Apr 22, 2020 · 2 comments

Comments

@stawnPTL
Copy link
Contributor

We're using the SDL display and mouse drivers. We had naively assumed that if the UI worked with a mouse then it'd work with a touchscreen, however touchscreen events are completely ignored.

In our use case I fixed this by adding the following to mouse_handler(), but not sure if this is the correct general solution. Maybe you'd prefer it if this went into a separate touchscreen driver.

        case SDL_FINGERUP:
            left_button_down = false;
            last_x = LV_HOR_RES_MAX * event->tfinger.x / MONITOR_ZOOM;
            last_y = LV_VER_RES_MAX * event->tfinger.y / MONITOR_ZOOM;
            break;
        case SDL_FINGERDOWN:
            left_button_down = true;
            last_x = LV_HOR_RES_MAX * event->tfinger.x / MONITOR_ZOOM;
            last_y = LV_VER_RES_MAX * event->tfinger.y / MONITOR_ZOOM;
            break;
        case SDL_FINGERMOTION:
            last_x = LV_HOR_RES_MAX * event->tfinger.x / MONITOR_ZOOM;
            last_y = LV_VER_RES_MAX * event->tfinger.y / MONITOR_ZOOM;
            break;
@embeddedt
Copy link
Member

Hmm, that's interesting. I thought that mouse events would still be emulated for compatibility purposes.

I think your solution is reasonable and shouldn't break anything on non-touchscreen devices.

@kisvegabor
Copy link
Member

I think it's fine to add it to the mouse driver for simplicity.

Can you send a Pull request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants