We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5457 - SDL_MOUSEMOTION not generated when app run without window manager under Linux
Summary: SDL_MOUSEMOTION not generated when app run without window manager under Linux
Status: ASSIGNED
Alias: None
Product: SDL
Classification: Unclassified
Component: events (show other bugs)
Version: 2.0.14
Hardware: x86_64 Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords: target-2.0.16
Depends on:
Blocks:
 
Reported: 2021-01-10 17:06 UTC by Jarosław Siebert
Modified: 2021-01-10 17:34 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jarosław Siebert 2021-01-10 17:06:45 UTC
Hello,
I don't know if it is a libsdl bug or may be my setup problem.
I use libsdl in my app on panel pc with touchscreen and mouse connected to usb port.
If I run my app in fluxbox, then both input devices (mouse and touchscreen) works without problems. I need only 3 input events: SDL_MOUSEMOTION, SDL_MOUSEBUTTONUP and SDL_MOUSEBUTTONDOWN. When I move finger on touchscreen then I get SDL_MOUSEMOTION event and the same event when I use mouse. Coordinates (x and y) are correct in button.x, motion.x, button.y and motion.y.
There are updated with correct posistions.

The problem begin when I run the same app from twm window manager or without any window manager (from .xinitrc directly).
At the begining I got always the same 3 events:
SDL_MOUSEMOTION: x = 640, y = 512
SDL_MOUSEMOTION: x = 0, y = 0
SDL_MOUSEMOTION: x = 640, y = 512
and then, when I use touchscreen and move finger over it, I get only SDL_MOUSEBUTTONDOWN and SDL_MOUSEBUTTONUP events. There is no SDL_MOUSEMOTION event any more. Other problem is, that these events doesn't have right coordinates (x and y). When I move finger on screen I always get the same coordinates from SDL_MOUSEBUTTONDOWN and SDL_MOUSEBUTTONUP events: x= 640, y = 512.
When I use mouse connected to usb, then I get all 3 events: SDL_MOUSEBUTTONUP, SDL_MOUSEBUTTONDOWN and SDL_MOUSEMOTION with right coordinates (x and y).
When I use touch screen again (after I move cursor with usb mouse) then I read SDL_MOUSEBUTTONDOWN and SDL_MOUSEBUTTONUP with last coordynates read from last SDL_MOUSEMOTION event.
Do I need to make some input events setup to work correctly without window manager or with simple window manager like twm?
When I move finger on touchscreen - then I can see that cursor pointer moves with my finger, but there is no SDL_MOUSEMOTION event.
When I run the app with fluxbox or other wm, then SDL_MOUSEMOTION is present on touchscreen and mouse actions.
Can you check it?
I initialize SDL with functions:
SDL_Init(SDL_INIT_VIDEO|SDL_INIT_EVENTS|SDL_INIT_AUDIO);
TTF_Init();
(...)
for(e = SDL_FIRSTEVENT+1; e < SDL_LASTEVENT; ++e) {
                SDL_EventState(e, SDL_IGNORE);
}
SDL_EventState(SDL_QUIT, SDL_ENABLE);
SDL_EventState(SDL_KEYDOWN, SDL_ENABLE);
SDL_EventState(SDL_KEYUP, SDL_ENABLE);
SDL_EventState(SDL_MOUSEBUTTONDOWN, SDL_ENABLE);
SDL_EventState(SDL_MOUSEBUTTONUP, SDL_ENABLE);
SDL_EventState(SDL_MOUSEMOTION, SDL_ENABLE);
(...)

I use slackware64-current with Xorg.
I hope you can help me to find fix for app with touch input and without window manager.
Thanks for any help.
Comment 1 Jarosław Siebert 2021-01-10 17:09:40 UTC
I would like to add some more informations. When I run similar app but with sdl-1.2.15 (no sdl2) then touch events works correct with right x and y coordinates with and without window manager.
I would like to get similar efect using SDL2.