Allegro windows show up on incorrect monitor
Schyfis

So I'm working with Allegro again lately, and one thing is bugging me. Whenever I start any Allegro program (I'm using 5.0.7), including the A5 demos (5.0.5), they show up on the incorrect monitor. I'm using Windows 7 x64, and the Allegro windows always spawn on the monitor Windows identifies as #1, instead of the monitor designated as the primary monitor.

It's not a huge issue, but it is slightly annoying!

J-Gamer

A similar problem: When compiling allegro programs for windows, I have to use al_set_new_window_position to make it even appear.

Thomas Fjellstrom
Schyfis said:

It's not a huge issue, but it is slightly annoying!

How would you suggest that be fixed? If windows is telling us that monitor is #1, then it's #1. You'd have to somehow swap IDs, but which ones do you swap? You could have 6 or more screens plugged in.

Elias

Is monitor #1 the one which has the taskbar on it?

Thomas Fjellstrom
Elias said:

Is monitor #1 the one which has the taskbar on it?

No, that's the primary monitor. Windows will happily move monitors around, and change which is the primary, but it doesn't change the order in which they were detected. IIRC.

Schyfis

Correct Thomas, monitor #1 is not the monitor with the taskbar. (That happens to be monitor #4!)

How would you suggest that be fixed? If windows is telling us that monitor is #1, then it's #1. You'd have to somehow swap IDs, but which ones do you swap? You could have 6 or more screens plugged in.

Maybe there's a way to figure out which monitor the taskbar is on, and spawn the window on that monitor?

Thomas Fjellstrom
Schyfis said:

Maybe there's a way to figure out which monitor the taskbar is on, and spawn the window on that monitor?

Yeah, ok. That makes sense. In fact, you've reminded me thats how I tried to implement it for X. It'll try and find the "primary" screen via a number of methods, and then fall back to screen 0. It's not perfect, and there may be a better way of finding out which screen is primary, but I bet it depends on the DE, or possibly some obscure WM_HINT.

Peter Wang

Is it because of our _al_win_get_window_center function? If we just passed CW_USEDEFAULT to CreateWindowEx in_al_win_create_window, would that do the right thing in the common case? Somebody with multiple monitors should fiddle with it.

Thread #611148. Printed from Allegro.cc