![]() |
|
This thread is locked; no one can reply to it.
![]() ![]() |
1
2
|
[4.9.23] Windows7, MultiMonitor, Display is created on the wrong screen |
Dennis
Member #1,090
July 2003
![]() |
EDIT: DO NOT BOTHER READING THIS THREAD. THE ISSUE IS ALREADY FIXED IN THE LATEST SVN REVISION. {"name":"602361","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/1\/b\/1bf7917daae0f76487527aec963c23d7.png","w":686,"h":287,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/1\/b\/1bf7917daae0f76487527aec963c23d7"} I run a two screen system with Windows 7. The screens are arranged as seen in the image above. Pressing "identify" in the hardware configuration gives the numbers seen in the upper left corners. However, the second screen is configured as the "primary screen" and all applications open their windows on that screen, except for the ones using Allegro. They always open the display (via al_create_display) on the wrong (1 but not primary) screen. --- 0xDB | @dennisbusch_de --- |
Thomas Fjellstrom
Member #476
June 2000
![]() |
The code should be letting windows do the positioning (As long as you aren't trying to force it yourself), but I didn't write that code so I don't know for sure. -- |
Elias
Member #358
May 2000
|
Looks like a bug to me. And rather annoying as well, I hate it when in X11 programs think they are smarter than the window manager. And the same seems to happen here under Windows. If nobody shows up who knows how to fix it right now, can you enter it to the bug tracker? Then it won't be forgotten to fix it. -- |
Dennis
Member #1,090
July 2003
![]() |
append (found some more information while debugging it) The origin (0,0) of the virtual screen space seems to be mapped to the upper left corner of the primary display. That way, my secondary displays(first adapter but not primary display) upper left corner ends up being at (-1280, 0). To fix that, the system initialization code (I couldn't find it yet) would have to set the default display adapter for new displays (currently 0) to the adapter which reports (0,0) as the upper left corner in "win_get_monitor_info". screenshot to illustrate the issue (ignore the green comments in the code, that was just a lazy fix (which works to open the window on the primary display but doesn't center the new window)): append 2: --- 0xDB | @dennisbusch_de --- |
wonsungi
Member #11,799
March 2010
![]() |
I was able to reproduce Dennis' bug, and I confirm his patch works on my system. On a related note, how can you force an Allegro program to open in the active monitor? For example, if the folder containing the Allegro exe is on monitor 2, the Allegro program opens on monitor 2; if on monitor 1, the Allegro program also opens on monitor 1. Picasa Photo viewer works like this. It is very handy to select which monitor a full screen application will open in by first moving the containing folder to that monitor.
|
Thomas Fjellstrom
Member #476
June 2000
![]() |
edit: nevermind. I misread. I don't think theres a way to get the "active" monitor. If allegro isn't already doing that it may be a bug. -- |
Arthur Kalliokoski
Second in Command
February 2005
![]() |
Thomas Fjellstrom said: I don't think theres a way to get the "active" monitor. Active monitor? You mean the monitor that's displaying the program that has current focus? They all watch too much MSNBC... they get ideas. |
Thomas Fjellstrom
Member #476
June 2000
![]() |
Arthur Kalliokoski said: Active monitor? You mean the monitor that's displaying the program that has current focus? That or the one with the mouse. Either way, I don't know if allegro has a way to give you that info at the moment. -- |
Evert
Member #794
November 2000
![]() |
So what happens if we don't specify any display at all and just let the OS pick what it thinks is the best display for the window to pop-up? Does that do what's expected? And yes... that will possibly not be compatible with the solution to the problem that the OP posted in this thread. |
Arthur Kalliokoski
Second in Command
February 2005
![]() |
I think a nice touch would be that if an Allegro program is started from a console, then the graphical window would open on the other monitor. It's a pain switching back and forth to view the windows in their entirety if they have any size to them. They all watch too much MSNBC... they get ideas. |
Dennis
Member #1,090
July 2003
![]() |
Just posting to tell that this issue is fixed. The patch has already been applied to the SVN and Trent fixed it up further so it's still possible to override the default display adapter manually. If the display adapter is set to -1 (or not at all) now, Windows will always open the window centered on the primary display (regardless of it's display adapter index number). --- 0xDB | @dennisbusch_de --- |
Chris Katko
Member #1,881
January 2002
![]() |
How long would this take to apply to a pre-compiled version of Allegro 5? I use the pre-compiled version and just realized this affects me now (I just got a second monitor). -----sig: |
Trent Gamblin
Member #261
April 2000
![]() |
The patch Dennis posted is kind of... incomplete and wrong. What actually got committed to svn is different. So you'd be better of just starting from SVN IMO. It's no buggier than the latest release (If anything, it's better).
|
Michał Cichoń
Member #11,736
March 2010
|
For me the reason of such behavior (see first Denis post) lie in the implementation of monitor enumeration. Brief look at the implementation...
I will run some tests on multi-monitor machine to make sure what results using EnumDisplayDevices() I got. Edit: Edit2: "God starts from scratch too" |
Trent Gamblin
Member #261
April 2000
![]() |
Do you have a use case right now where it's broken? Cause if it ain't broke...
|
Michał Cichoń
Member #11,736
March 2010
|
A little investigation. I did trough following steps: Four session has been found. Conclusions: I propose to switch the implementation into pair GetSystemMetrics()/EnumDisplayMonitors(). Also al_get_primary_adapter() should be added, because adapter with zero index doesn't have to be primary one. --- SESSION --- -- GetSystemMetrics -- Monitors: 1 -- EnumDisplayDevices -- Monitors: 1 Attached to desktop Monitors: 5 All -- EnumDisplayDevices -- Device: \\.\DISPLAY1 NVIDIA GeForce 8600M GT Rect: (0, 0), (1920, 1080) State: Attached to Desktop, Primary Device Monitor: \\.\DISPLAY1\Monitor0 Generic PnP Monitor State: Active, Attached Monitor: \\.\DISPLAY1\Monitor1 Generic PnP Monitor State: Active, Attached Device: \\.\DISPLAY2 NVIDIA GeForce 8600M GT State: <empty> Device: \\.\DISPLAYV1 RDPDD Chained DD State: Mirroring Driver Device: \\.\DISPLAYV2 RDP Encoder Mirror Driver State: Mirroring Driver, TS Compatible Device: \\.\DISPLAYV3 RDP Reflector Display Driver State: Mirroring Driver, TS Compatible -- EnumDisplayMonitors -- Monitor: \\.\DISPLAY1 Rect: (0, 0), (1920, 1080) State: Primary --- SESSION --- -- GetSystemMetrics -- Monitors: 1 -- EnumDisplayDevices -- Monitors: 1 Attached to desktop Monitors: 5 All -- EnumDisplayDevices -- Device: \\.\DISPLAY1 NVIDIA GeForce 8600M GT Rect: (0, 0), (1920, 1200) State: Attached to Desktop, Primary Device Monitor: \\.\DISPLAY1\Monitor0 Generic PnP Monitor State: Active, Attached Device: \\.\DISPLAY2 NVIDIA GeForce 8600M GT State: <empty> Monitor: \\.\DISPLAY2\Monitor0 Generic PnP Monitor State: Attached Device: \\.\DISPLAYV1 RDPDD Chained DD State: Mirroring Driver Device: \\.\DISPLAYV2 RDP Encoder Mirror Driver State: Mirroring Driver, TS Compatible Device: \\.\DISPLAYV3 RDP Reflector Display Driver State: Mirroring Driver, TS Compatible -- EnumDisplayMonitors -- Monitor: \\.\DISPLAY1 Rect: (0, 0), (1920, 1200) State: Primary --- SESSION --- -- GetSystemMetrics -- Monitors: 1 -- EnumDisplayDevices -- Monitors: 1 Attached to desktop Monitors: 5 All -- EnumDisplayDevices -- Device: \\.\DISPLAY1 NVIDIA GeForce 8600M GT Rect: (0, 0), (1920, 1080) State: Attached to Desktop, Primary Device Monitor: \\.\DISPLAY1\Monitor0 Generic PnP Monitor State: Active, Attached Monitor: \\.\DISPLAY1\Monitor1 Generic PnP Monitor State: Attached Device: \\.\DISPLAY2 NVIDIA GeForce 8600M GT State: <empty> Monitor: \\.\DISPLAY2\Monitor0 Generic PnP Monitor State: Attached Device: \\.\DISPLAYV1 RDPDD Chained DD State: Mirroring Driver Device: \\.\DISPLAYV2 RDP Encoder Mirror Driver State: Mirroring Driver, TS Compatible Device: \\.\DISPLAYV3 RDP Reflector Display Driver State: Mirroring Driver, TS Compatible -- EnumDisplayMonitors -- Monitor: \\.\DISPLAY1 Rect: (0, 0), (1920, 1080) State: Primary --- SESSION --- -- GetSystemMetrics -- Monitors: 2 -- EnumDisplayDevices -- Monitors: 2 Attached to desktop Monitors: 5 All -- EnumDisplayDevices -- Device: \\.\DISPLAY1 NVIDIA GeForce 8600M GT Rect: (-1920, 0), (0, 1200) State: Attached to Desktop Monitor: \\.\DISPLAY1\Monitor0 Generic PnP Monitor State: Active, Attached Device: \\.\DISPLAY2 NVIDIA GeForce 8600M GT Rect: (0, 0), (1920, 1080) State: Attached to Desktop, Primary Device Monitor: \\.\DISPLAY2\Monitor0 Generic PnP Monitor State: Active, Attached Device: \\.\DISPLAYV1 RDPDD Chained DD State: Mirroring Driver Device: \\.\DISPLAYV2 RDP Encoder Mirror Driver State: Mirroring Driver, TS Compatible Device: \\.\DISPLAYV3 RDP Reflector Display Driver State: Mirroring Driver, TS Compatible -- EnumDisplayMonitors -- Monitor: \\.\DISPLAY1 Rect: (-1920, 0), (0, 1200) State: <empty> Monitor: \\.\DISPLAY2 Rect: (0, 0), (1920, 1080) State: Primary
"God starts from scratch too" |
Trent Gamblin
Member #261
April 2000
![]() |
Michał Cichoń said:
Conclusions: I propose to switch the implementation into pair GetSystemMetrics()/EnumDisplayMonitors(). Also al_get_primary_adapter() should be added, because adapter with zero index doesn't have to be primary one. Ok. Can you open a bug on Sourceforge? And since you already have some code, attach it there? Unless you plan on fixing it yourself. Also I think the new function is a good idea too. EDIT: What about the initial value for the current adapter? I assume that can be found without installing a display driver, on all platforms, rather than using 0?
|
Michał Cichoń
Member #11,736
March 2010
|
I can prepare a patch, which address those issues. Primary adapter can be detected without initializing display driver. This is simple result of monitor enumeration. That's true for Windows. Mac OS should handle this easily and Linux... Who knows, there is X11 under the hood. I will put xxx_get_primary_adapter in system driver vtable. Committing changes is an another issue, due to feature freeze. I will probably release a patch and unofficial build with it. "God starts from scratch too" |
Evert
Member #794
November 2000
![]() |
Michał Cichoń said: Mac OS should handle this easily
You mean the first element returned by [NSScreen screens]? Currently, I think, the default is the return value of [NSScreen mainScreen], which gives you the one that "the user currently interacts with". |
Thomas Fjellstrom
Member #476
June 2000
![]() |
Primary for OSX would be which ever monitor the dock and menu are both on. -- |
Evert
Member #794
November 2000
![]() |
Thomas Fjellstrom said: Primary for OSX would be which ever monitor the dock and menu are both on.
Ok, that's the first entry that's returned by [NSScreen screens] (which makes sense, for "primary" to be "the first"). In other words, it's always the first screen reported. |
Thomas Fjellstrom
Member #476
June 2000
![]() |
I think you probably want an app to launch on the "currently active" screen. At least I generally do. If I start an app while on my secondary screen, I tend to want it to pop up there since thats where I have my focus. But I think the only way to start an app on a secondary screen on osx is with some kind of icon or bundle on the desktop. -- |
Evert
Member #794
November 2000
![]() |
Thomas Fjellstrom said: But I think the only way to start an app on a secondary screen on osx is with some kind of icon or bundle on the desktop. I don't think so. Finder or commandline should do as well. |
Thomas Fjellstrom
Member #476
June 2000
![]() |
Evert said: I don't think so. Finder or commandline should do as well. Ah, ok. I suppose that'd work too. Wasn't thinking. -- |
Elias
Member #358
May 2000
|
In X11 an app by default is started on the same monitor i start it from. I.e. if I type "./my_game" into a console and that console is on the right monitor, that's where the window is created. That is, that's how it worked under Ubuntu 10.04 with NVidia's TwinView - only setup I tried multiple monitors on. -- |
|
1
2
|