Kodi Community Forum
Linux phase out SDL - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93)
+--- Thread: Linux phase out SDL (/showthread.php?tid=130910)



phase out SDL - FernetMenta - 2012-05-07

Problem:
SDL_SetVideoMode does not work if screen was rotated left/right. It matches given width/height with non rotated video modes and refuses to set correct dimensions for rotated screen.

Solution:
Phase out SDL_SetVideoMode

SDL acually opens 3 windows, one for fullscreen, one for windowed mode, and the actual drawing window. Then creates an OpenGL context which we don't use in XBMC. I am no aware of any reason why we should follow this approach. A single window should do as well, then changing window attributes when changing between fullscreen and windowed mode. Do I miss something here?

Implication:
The SDL event system only works when the video system is used. This means WinEventsSDL has to be substituted as well. I have tried WinEventsLinux already but it does not find a sing input device on Ubuntu 12.04
- What I am doing wrong?
- How would this work in windowed mode if XBMC does not have focus?


RE: phase out SDL - davilla - 2012-05-07

WinEventsLinux is designed for embedded boxes when you own everything, it's going to be problematic under desktop where the window system (x11 or whatever) owns them.

What really needs to happen is to extract the code from SDL that handles events and windowing and implement it as a new WinEventsXXX and change WinSystemX11 for direct x11 communication. Then you can ditch sdl.


RE: phase out SDL - theuni - 2012-05-08

I think for the desktop, an evdev manager (WinEventsEVdev) is probably the way to go, rather than messing with stuff at such a low level.


RE: phase out SDL - FernetMenta - 2012-05-09

I have studied some code:

SDL makes use of XEvents and XutfLookupString. Then transforms the string to unicode and sends an event for each unicode. On the last one it sends keysym.
This sounds very reasonable to me. We only get the events targeted to our window. I would keep this strategy and put it in a WinEventsX11

On Linux (not Apple) we call SymFromScancode (WinEventsSDL) if SDL has not found a keysym.
This does not look right to me. Don't we want to map Xkeysyms to XBMCkeysyms? E.g. a user has mapped some key to XF86AudioLowerVolume we substitute this keysym with XBMCK_VOLUME_DOWN in order to get desired behavior. This would require a SubstKeySym for X11.

Joystick:
If possible I would keep SDL for Joysticks in this iteration.