Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initializing SDL 1.3 (Multimonitor) #338

Closed
SDLBugzilla opened this issue Feb 10, 2021 · 0 comments
Closed

Initializing SDL 1.3 (Multimonitor) #338

SDLBugzilla opened this issue Feb 10, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

Reported in version: HG 2.0
Reported for operating system, platform: Windows (All), All

Comments on the original bug report:

On 2011-01-25 11:02:26 +0000, Sam Lantinga wrote:

Alexander Hofmann

On Win32, what's the correct sequence of commands for creating 2 or more
fullscreen Windows?

So far, here's what I got:

  • SDL_Init (of course...)
  • SDL_GetNumVideoDisplays()
  • Select the appropriate display and Create a Window with specified size
    and SDL_WINDOW_FULLSCREEN flag
  • Do some tasks and call SDL_ShowWindow

It work's great if all Windows are created with the same size as the
resolution of the desktop of every screen was at the time of
initializing SDL, but when I try to specify some other size (800x600
Pixels e.g. on former 1280x1024 and 1024x768 displays), the first Window
get's positioned correctly, but the second one is initialized at 480
pixels right of the top left corner of the 2. screen (1280-800). A
second problem is, that somehow the Event-Queue gets filled with events
if that happens, and the SDL_PollEvent command never returns from the
first call...

I took a look a the code and as far as I could understand it, the
position of a newly created Window is calculated using the coordinates
of the desktop-position of every display, which is being read on
initialization of SDL - is that correct?

At the moment, my workaround is to set all displays to the desired
resolution prior to SDL initialization using standard Windows-API, is
there any more elegant solution using SDL, or did I miss something?

On 2011-02-16 03:22:49 +0000, Sam Lantinga wrote:

I just did a bunch of work on multi-monitor and fullscreen support on Windows.

The way you set things up changed a little bit. Create each of your windows with the desired size and the fullscreen flag, and use this macro for the position: SDL_WINDOWPOS_CENTERED_DISPLAY(N), where N is the index of the display you want to create the window on.

e.g.
window = SDL_CreateWindow("Window on Monitor 1",
SDL_WINDOWPOS_CENTERED_DISPLAY(1),
SDL_WINDOWPOS_CENTERED_DISPLAY(1),
640, 480, SDL_WINDOW_FULLSCREEN|SDL_WINDOW_SHOWN);

Can you try the latest snapshot and see if this works for you?
http://www.libsdl.org/tmp/SDL-1.3.zip

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant