[SDL] Opening windows on different X displays (Ubuntu 12)

Alex Barry alex.barry at gmail.com
Sat Mar 23 20:05:03 PDT 2013


SDL_GetWindowDisplayIndex is relative to the X/Display instance, so if each
of your monitors runs within it's own X/Display, then the display index
will always be 0.  This isn't an SDL issue, this is how X11 works.

On Sat, Mar 23, 2013 at 10:52 PM, Reto Schneider <
mailinglisten at reto-schneider.ch> wrote:

> On 03/24/2013 01:09 AM, Sam Lantinga wrote:
> > I don't have a multi-X server configuration here.  Can you build
> > a debug version of SDL and trace through what it's doing?
>
> Yep. It does result in the same observation reported in the forum:
>
> a) In the function SDL_CreateWindow, the x and y variables created with
> the SDL_WINDOWPOS_CENTERED_DISPLAY macro do not get propagated to the
> window variable. [1]
> b) The variable window gets passed to the X11_CreateWindow function [2].
> c) Within X11_CreateWindow, the function SDL_GetDisplayForWindow[3] gets
> called with the variable window passed (note: the window variable does
> not have the magic values set by the SDL_WINDOWPOS_CENTERED_DISPLAY macro)
> d) SDL_GetWindowDisplayIndex gets called by SDL_GetDisplayForWindow
> e) SDL_GetWindowDisplayIndex always returns 0. Reason for this:
> The code tries to figure out, based on the display bounds, on which
> screen the window should be placed[4]. As there are three screens and
> all of them start at 0/0 (unlike Xinerama, Twinview), this approach does
> not work and pretty much always returns the first display index.
>
> I guess we have to fix SDL_GetWindowDisplayIndex.
>
> 1: http://hg.libsdl.org/SDL/file/d9f3d2e3bd07/src/video/SDL_video.c#l1229
> 2: http://hg.libsdl.org/SDL/file/d9f3d2e3bd07/src/video/SDL_video.c#l1252
> 3:
>
> http://hg.libsdl.org/SDL/file/d9f3d2e3bd07/src/video/x11/SDL_x11window.c#l333
> 4: http://hg.libsdl.org/SDL/file/d9f3d2e3bd07/src/video/SDL_video.c#l973
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20130323/109537ae/attachment-0009.htm>


More information about the SDL mailing list