[SDL] Xinerama mouse issues?

Sam Lantinga slouken at devolution.com
Mon Sep 16 01:46:01 PDT 2002

> https://bugzilla.icculus.org/show_bug.cgi?id=72

> I don't have a multihead setup here, but I _do_ have a free copy of the
> full version of UT2003 for whomever fixes the bug in SDL.  :)

First, with regards to the mouse pointer disappearing and making the view
jump, it seems like DGA may not be working correctly with his setup.  Have
him try setting the environment variable: 

Second, in general the way X11 fullscreen mode works it doesn't lend itself
to sharing the mouse with the rest of the desktop in Xinerama mode.  What
Xinerama does (for the uninitiated) is convert two distinct monitors into
a single seamless desktop.  What SDL fullscreen mode does is change the
screen resolution of the primary monitor, move the SDL window into place,
and lock the mouse and keyboard input.  The way the XFree86 VidMode
extension works is that it changes the video mode but leaves the rest
of the desktop there allowing you to scroll around in it using the mouse.

So, what the video display really looks like is this:

        SCREEN #1               SCREEN #2
/-------------\--------\ /----------------------\
|             |        | |                      |
|             |        | |                      |
|     SDL     |        | |                      |
|             |        | |                      |
|             |        | |       VISIBLE        |
\-------------/        | |                      |
|                      | |                      |
|    HIDDEN DESKTOP    | |                      |
|                      | |                      |
\----------------------/ \----------------------/

Note that the "SDL" portion of screen #1 is filling the entire monitor.
This means that if the mouse moves off of the SDL window, screen #1 will
scroll with the mouse, showing a portion of the SDL window and a portion
of the previously hidden desktop.  When the mouse reaches the edge of the
desktop on screen #1, then it will move onto screen #2.  The problem is
actually the same with both Xinerama and the normal multi-monitor case.

Ideally what would happen is if the mouse reached the right edge of the
SDL window, the mouse would be warped onto the left edge of screen #2,
and if the mouse reached the left edge of screen #2, it would be warped
onto the right edge of the SDL window.  However, I don't know of any way
to get that behavior using the current X11 extensions.

So, for the moment, all you fortunate people with multi-head setups are
stuck with having SDL lock the keyboard and mouse in fullscreen mode.
If you want to interact with the rest of your desktop, you'll have to
run in windowed mode like the rest of us mortals. :)

Finally, Ryan, I cleaned up the SDL_WINDOW_POS implementation and renamed
it.  It turns out that there was already an environment variable doing
exactly what you wanted, so I moved your variable there, renamed it, and
extended it to support the x,y notation. :)

        1.2.5: Changed SDL_WINDOW_POS to SDL_VIDEO_WINDOW_POS
        1.2.5: Implemented support for SDL_VIDEO_WINDOW_POS=x,y

See ya!
	-Sam Lantinga, Software Engineer, Blizzard Entertainment

More information about the SDL mailing list