[RFC] Un-trapping mouse while running fullscreen (SDL limitation/design-flaw)
#1
Question 
This has come up multiple times on the user forums. If you dual-head using separate X screens, and run XBMC fullscreen on one of the displays, the mouse is trapped and you can't do work on the other screen. This is the way the SDL_FULLSCREEN video mode works, so there does not seem to be an easy fix. switchscreen and wmctrl have been suggested as solutions, but switchscreen works poorly and I can't get wcmtrl to work at all - it just puts my windowed XBMC back into fullscreen with mouse grabbing.

In the hope of finding a solution I've been messing around with a simple SDL app. I think that having the ability to map an input command (mouse, lirc, keyboard, etc) to SDL_WM_ToggleFullScreen would go a long way towards alleviating this problem. Still kludgey, but better than the other solutions I've found.

The idea is that you toggle out of fullscreen, which should allow you to move the mouse to the other screen and do stuff, then when done move the mouse back to focus on the xbmc window and toggle back in. This actually seems to happen when I use switchscreen, but it's not reliable, and is actually unwanted in that case. Also I'm not sure if ToggleFullScreen will still work during video playback.

The downside is that if you want to watch video and work on the other monitor at the same time, you will have the window frame junk. I have never actually wanted to use it this way though - typically I will pause a video and then look up something on imdb or check email.

I will try to work up a patch implementing this. However I am not familiar with the XBMC codebase - I would be very grateful for any advice, or if someone with more experience wants implement it themselves.

Here is the demo app:

Code:
#include <SDL/SDL.h>
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
    SDL_Surface *screen;
    if(SDL_Init(SDL_INIT_VIDEO) != 0)
    {
        printf("SDL Init failed: %s", SDL_GetError());
        return 1;
    }

    atexit(SDL_Quit);

    screen = SDL_SetVideoMode(1600, 1200, 16, SDL_FULLSCREEN);
    if(screen == NULL)
    {
        printf("Setting video mode failed: %s", SDL_GetError());
        return 1;
    }

    SDL_Event event;
    int quitFlag = 0;

    while(quitFlag == 0)
    {
        while(SDL_PollEvent(&event))
        {
            if(event.type == SDL_KEYDOWN)
            {
                if (event.key.keysym.sym == SDLK_q
                    || event.key.keysym.sym == SDLK_ESCAPE)
                {
                    quitFlag = 1;
                }
                else if (event.key.keysym.sym == SDLK_f)
                {
                    int success = SDL_WM_ToggleFullScreen(screen);
                    printf("Called WM_ToggleFullScreen, returned %d\n",
                            success);
                }
            }
        }
    }

}
Reply


Messages In This Thread
[RFC] Un-trapping mouse while running fullscreen (SDL limitation/design-flaw) - by bdallen - 2008-09-19, 06:58
[No subject] - by bdallen - 2008-09-19, 22:09
[No subject] - by CapnBry - 2008-09-19, 22:14
[No subject] - by bdallen - 2008-09-19, 22:33
patch - by bdallen - 2008-09-20, 04:30
Thank you very much! - by Gamester17 - 2008-09-20, 21:23
[No subject] - by althekiller - 2008-09-20, 22:38
[No subject] - by bdallen - 2008-09-21, 07:19
[No subject] - by theuni - 2008-09-21, 17:26
[No subject] - by bdallen - 2008-09-21, 17:58
[No subject] - by bdallen - 2008-09-21, 18:31
proof of concept (demo app) - by bdallen - 2008-09-22, 04:20
[No subject] - by bdallen - 2008-09-22, 05:30
[No subject] - by althekiller - 2008-09-22, 06:15
[No subject] - by bdallen - 2008-09-22, 19:40
[No subject] - by bdallen - 2008-09-22, 21:14
[No subject] - by kevinneumann - 2008-09-23, 05:04
[No subject] - by CapnBry - 2008-09-25, 21:15
[No subject] - by bdallen - 2008-09-25, 23:28
[No subject] - by CapnBry - 2008-09-26, 16:24
[No subject] - by bdallen - 2008-09-29, 20:35
[No subject] - by CapnBry - 2008-09-30, 01:04
[No subject] - by bdallen - 2008-10-01, 02:29
[No subject] - by CapnBry - 2008-10-01, 02:56
[No subject] - by bdallen - 2008-10-02, 02:24
[No subject] - by bdallen - 2008-10-02, 04:08
[No subject] - by bdallen - 2008-10-02, 04:21
[No subject] - by bdallen - 2008-10-08, 23:54
[No subject] - by CapnBry - 2008-10-09, 15:27
[No subject] - by bdallen - 2008-10-11, 04:11
[No subject] - by funkknob - 2008-10-17, 14:36
[No subject] - by TobiasTheCommie - 2008-10-17, 21:36
[No subject] - by floe - 2008-11-30, 16:49
[No subject] - by bdallen - 2008-12-29, 04:29
[No subject] - by funkknob - 2008-12-29, 07:53
patch against 8.10 - by bdallen - 2009-02-02, 22:50
[No subject] - by joe_newbie - 2009-11-24, 06:05
Resurrection! - by bdallen - 2009-11-24, 06:35
[No subject] - by bdallen - 2009-11-25, 06:55
update - by bdallen - 2009-11-29, 19:09
[No subject] - by tidalf - 2009-12-04, 11:29
[No subject] - by MaienM - 2009-12-07, 01:12
[No subject] - by MaienM - 2009-12-07, 18:53
[No subject] - by tidalf - 2009-12-09, 11:48
[No subject] - by Spider - 2010-01-06, 20:24
[No subject] - by sergkhar - 2010-01-12, 07:56
[No subject] - by Spider - 2010-01-19, 21:23
[No subject] - by sergkhar - 2010-01-19, 22:18
[No subject] - by Spider - 2010-01-20, 20:17
[No subject] - by sergkhar - 2010-01-21, 22:06
[No subject] - by YaPaY - 2010-01-24, 02:30
[No subject] - by mocha - 2010-01-25, 03:38
[No subject] - by Spider - 2010-01-25, 22:00
[No subject] - by Digby Dude - 2010-03-18, 14:26
[No subject] - by spiff - 2010-03-18, 14:59
[No subject] - by Digby Dude - 2010-03-18, 15:05
[No subject] - by doobiest - 2010-03-23, 05:59
[No subject] - by doobiest - 2010-03-23, 06:03
[No subject] - by htpcero - 2010-04-01, 02:23
[No subject] - by Digby Dude - 2010-04-26, 17:06
[No subject] - by rivol - 2010-04-26, 19:50
[No subject] - by Digby Dude - 2010-05-21, 18:39
Logout Mark Read Team Forum Stats Members Help
[RFC] Un-trapping mouse while running fullscreen (SDL limitation/design-flaw)1