Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » Allegro windows show up on incorrect monitor

This thread is locked; no one can reply to it. rss feed Print
Allegro windows show up on incorrect monitor
Schyfis
Member #9,752
May 2008
avatar

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!

________________________________________________________________________________________________________
[freedwill.us]
[unTied Games]

J-Gamer
Member #12,491
January 2011
avatar

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

" There are plenty of wonderful ideas in The Bible, but God isn't one of them." - Derezo
"If your body was a business, thought would be like micro-management and emotions would be like macro-management. If you primarily live your life with emotions, then you are prone to error on the details. If you over-think things all the time you tend to lose scope of priorities." - Mark Oates

Thomas Fjellstrom
Member #476
June 2000
avatar

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.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Elias
Member #358
May 2000

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

--
"Either help out or stop whining" - Evert

Thomas Fjellstrom
Member #476
June 2000
avatar

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.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Schyfis
Member #9,752
May 2008
avatar

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?

________________________________________________________________________________________________________
[freedwill.us]
[unTied Games]

Thomas Fjellstrom
Member #476
June 2000
avatar

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.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Peter Wang
Member #23
April 2000

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.

Go to: