XBMC Fullscreen Pointer Issues
When setting up a Linux based HTPC, 'waf' criteria require a remote to be added to the setup, as keyboard mouse combination usually don't get accepted for the living room. While many button based remotes work fine out-of-the-box with XBMC, sometimes a real pointer devices is needed to control different applications (e.g. flash games). Also, XBMC can be fully controlled by just using the mouse.
One of the best pointer devices if have used to control TV based applications is the Wiimote. Even if not providing the fanciest graphics or highest resolutions, the Wii is really easy to control for kids, and even girlfriends. Also, if you compare the main menu of a Nintendo Wii to an Iphone or Ipod touch, you'll find them very similar, just that Nintendo calls the icons "Channels" instead of "Apps", and "Shopping Channel" instead of "Appstore". Ah, yes, Nintendo uses a white background, Apple a black one. Please correct me if I'm wrong, but the Wii had been published about a year earlier than the Iphone...
So, using the Wiimote with XBMC seemed to be straightforward, but unfortunately isn't. There are currently two ways to connect a Wiimote to XBMC running on Linux:
- by using the xbmc-eventclients-wiiremote: might always work for XBMC, but then it's not possible to use the pointer device for other applications that could be started from within XBMC.
- by using the wminput program with ir_ptr: works fine for the Linux desktop and XBMC or other apps in window mode, but when using XBMC fullscreen, the pointer jumps on the screen, making it unusable.
The issue of using XBMC fullscreen with external pointer devices is not limited to the Wiimote, but using a touchscreen has the same effect of a jumping pointer. Of course there's always the possibility of using the Wiimote as a button-only device, but then there's no real advantage compared to a button based remote.
The issue with the jumping pointer is caused by libSDL, which XBMC uses for it's platform independence. libSDL uses a different way to access the mouse in Linux when going fullscreen (DGA).
The solution is to add the following to the environment before starting XBMC (e.g. by adding it to the xbmc-standalone script or the global environment config, /etc/environment):
SDL_VIDEO_X11_DGAMOUSE=0
Setting this environment fully resolves the issue with XBMC (and other apps using sdl) going fullscreen while using a pointer device != mouse. Futher sdl environment vars can be found here:
http://www.libsdl.org/docs/html/sdlenvvars.html
As I'm currently developing my own Wiimote daemon for Linux which amongst some other stuff provides a pointer without using the IR sensorbar (yes, got it perfectly working already, and will publish the software when finished), I did some tests that might shed light on what happens (interesting for X/sdl developers only):
When using the xtest extension to fake pointer movements events, I've changed my code from relative to abolute positions. Of course this is nonsense, but for some reason I now got correct movements in XBMC fullscreen using DGAMOUSE - at least when moving right or down! So when faking an event with the absolute position x=20 and y=10, the pointer moves right by 20 pixels and down by 10 pixels in XBMC.
Moving left or top however hasn't had any effect. I assume that this is related to the xtest event using 16 bit for coordinates, while sdl uses int's with 32 bit. But that's just an assumption. This could e.g. cause a 16 bit value of -10 becoming 65525 when converted to a 32 bit int.
Debugging this further is currently out-of-scope for me, and I got it working the way I like it, but maybe this info is helpful for libSDL developers.
Comments
Alberto (not verified)
Fri, 08/24/2012 - 23:52
Permalink
Some difficults to aply this pretty solution
Hi, this is just the solution I need for my media center. The problem is that I don't have too enought knowledge to follow this instructions. Could you help me?
I'm using Ubuntu 12.04 and i've configured the Wiican aplication to start at the sistem. So I only have to put 1+2 and it works. (i think it's based in wminput)
Is there any other way who works better in XBMC?
Another cuestion I consider insteresting is the future possibility of install your daemon as a XBMC plugin running on OpenElec for some machines like Raspberry Pi.
I admire your work. Sorry for my bad english I'm spanish.
Thanks you so much!
Alberto (not verified)
Sat, 08/25/2012 - 00:19
Permalink
Solved!
Hey, I've solved the problem!
could you post your updates about your daemon?
Regards!
Add new comment