![]() |
|
This thread is locked; no one can reply to it.
![]() ![]() |
1
2
|
[4.9.23] Windows7, MultiMonitor, Display is created on the wrong screen |
Thomas Fjellstrom
Member #476
June 2000
![]() |
Thats entirely up to the window manager, at least if the user didn't force the position. -- |
Elias
Member #358
May 2000
|
Yes, but if we add a function to return the primary monitor, should it be the one where the WM would run the app? -- |
Thomas Fjellstrom
Member #476
June 2000
![]() |
Elias said: Yes, but if we add a function to return the primary monitor, should it be the one where the WM would run the app? I guess it depends if we mean "primary" or "active". If its primary, it aught to be the actual primary monitor, the one at 0x0. -- |
Evert
Member #794
November 2000
![]() |
Thomas Fjellstrom said: I guess it depends if we mean "primary" or "active". If its primary, it aught to be the actual primary monitor, the one at 0x0.
I think we should avoid the use of the name "primary". For one thing, if that's really what the user wants, he/she could just select the first screen (afterall, that's what "primary" means) and be done with it. This is already the current behaviour on OS X (since screen 0 is always the one with the Dock and the menu bar, which starts at 0,0) and, as I understand it, Linux. For the sake of clarity I think we should maybe avoid the use of "primary" to refer to anything other than the first display (for which we don't need a function to tell us what it is, since it's the first one). It seems to me that this is mainly a Windows problem, where the first display is the one that is "on the left" rather than the one containing the taskbar (in other words, different operating systems mean different things by "primary display"). In which case, perhaps we need to have the following:
With those two functions, I think we have all we need. I don't think we should force our own ordering on screens (for instance, force "0" to be the display containing the taskbar (dock) on every operating system, since I see that become messy and confusing in the future) beside that: whether screen "0" is "the one on the left" or "the one that contains the taskbar" depends on the platform. |
Thomas Fjellstrom
Member #476
June 2000
![]() |
Evert said: What we would need then is a function that tells the user what the "active" or "default" display is where the OS will show a window, which is what [NSScreen mainScreen] returns on OS X. Except that changes when the user moves their mouse, and I'm not sure X even has such a concept. It probably doesn't. AFAIK Its completely up to X WMs. Quote: No idea on how to get this information on X11 though. Which taskbar? I can have many. Some WMs don't have any. append: Quote: whether screen "0" is "the one on the left" or "the one that contains the taskbar" depends on the platform. Indeed. X can have "the one that contains the taskbar" on the right or left. It can place secondary screens on either side of 0x0. And it all depends on how the user sets up their config. -- |
Evert
Member #794
November 2000
![]() |
Thomas Fjellstrom said: Except that changes when the user moves their mouse, No. It changes when the user changes the key window. In other words, it's the screen that the currently active window is on. The location of the mouse has nothing to do with it (obviously, OS X doesn't have focus-follows-mouse, which I still find annoying). But in the current context, that's irrelevant: what matters is that it's the screen that the display will appear on if we go with the default. Quote: and I'm not sure X even has such a concept. It probably doesn't. AFAIK Its completely up to X WMs.
There is absolutely no way to ask where the window is going to show up if we don't specify anything? Quote: Which taskbar? I can have many. Some WMs don't have any. Sure. You probably understand what I meant though. |
gnolam
Member #2,030
March 2002
![]() |
Evert said: It seems to me that this is mainly a Windows problem, where the first display is the one that is "on the left" rather than the one containing the taskbar What? -- |
Thomas Fjellstrom
Member #476
June 2000
![]() |
Evert said: Sure. You probably understand what I meant though. X doesn't though I think in the end thats what the "default" monitor has to be at any given time. The monitor with a window on it that has focus. -- |
Evert
Member #794
November 2000
![]() |
Quote: What?
See first post. Thomas Fjellstrom said: The closest thing to a primary monitor is the one at 0x0, and the closest thing to a default is the one that contains a window that has focus.
That's exactly what it is on OS X. And, looking at the earlier discussion again, it seems that this is what it is in Windows as well. |
Michał Cichoń
Member #11,736
March 2010
|
How about such results? 2 adapters found... Main adapter is 0 Active adapter is 1 Adapter 0: (0, 0) - (1920, 1200) Available fullscreen display modes: Mode 0: 640 x 480, 60 Hz Mode 1: 720 x 480, 60 Hz ... Mode 25: 1920 x 1200, 60 Hz Adapter 1: (1920, 0) - (3360, 900) Available fullscreen display modes: Mode 0: 1440 x 900, 60 Hz Mode 1: 1440 x 900, 75 Hz ... Mode 53: 1280 x 1024, 75 Hz New functions: int al_get_main_adapter(void); int al_get_active_adapter(void); First one return index of main adapter (one with task bar). Second one return active one. For example if you launch your application on second monitor then it will be considered as active. If active adapter couldn't be determined there is a fall back to main adapter. During Allegro initialization active adapter is set as default adapter. Edit: "God starts from scratch too" |
Evert
Member #794
November 2000
![]() |
Michał Cichoń said: First one return index of main adapter (one with task bar). This would only ever be different from 0 only on Windows, as I understand it? Quote: If active adapter couldn't be determined there is a fall back to main adapter. During Allegro initialization active adapter is set as default adapter. Yes, although I still think we should allow a "magic value" of -1 when setting the current active adapter for those cases where you can't determine the "active" one and still want the OS to select whatever it thinks the default should be (which may be the case on X11). EDIT: I can try if the OS X patch compiles later, but I don't have a second monitor to test it with. |
Thomas Fjellstrom
Member #476
June 2000
![]() |
Evert said: This would only ever be different from 0 only on Windows, as I understand it? No, the monitor at 0x0 can be listed at any point in the Xrandr output. I assume if you put a secondary to the left on OSX it might appear first in its output too. -- |
Michał Cichoń
Member #11,736
March 2010
|
Evert said: This would only ever be different from 0 only on Windows, as I understand it?
I don't know how other platforms will behave. I have linux on VM and still, there is only one monitor in there. Evert said: Yes, although I still think we should allow a "magic value" of -1 when setting the current active adapter for those cases where you can't determine the "active" one and still want the OS to select whatever it thinks the default should be (which may be the case on X11).
This will alter display initialization code. I can do that for Windows and this is relatively simple thing to do. Other platforms are... hm... sill mysterious to me. This feature doesn't collide with patch, so may be considered separately. "God starts from scratch too" |
Matthew Leverton
Supreme Loser
January 1999
![]() |
Evert said: It seems to me that this is mainly a Windows problem, where the first display is the one that is "on the left" rather than the one containing the taskbar I cannot speak for how Allegro works with the Windows API, but Windows treats the primary display as the one marked as "Use this device as the primary monitor." It doesn't matter which is to the left or right or up or down or has the task bar, etc. |
Evert
Member #794
November 2000
![]() |
Thomas Fjellstrom said: I assume if you put a secondary to the left on OSX it might appear first in its output too. No. That's the point I was making: Quote: screens Returns an array of NSScreen objects representing all of the screens available on the system. An array of the NSScreen objects available on the current system or nil if the screen information could not be obtained from the window system. The screen at index 0 in the returned array corresponds to the primary screen of the user’s system. This is the screen that contains the menu bar and whose origin is at the point (0, 0). In the case of mirroring, the first screen is the largest drawable display; if all screens are the same size, it is the screen with the highest pixel depth. This primary screen may not be the same as the one returned by the mainScreen method, which returns the screen with the active window. The array should not be cached. Screens can be added, removed, or dynamically reconfigured at any time. When the display configuration is changed, the default notification center sends a NSApplicationDidChangeScreenParametersNotification notification.
|
Michał Cichoń
Member #11,736
March 2010
|
I implemented OSX function according to this documentation. The question is, what about NSApplicationDidChangeScreenParametersNotification? Maybe Allegro should notify user about changing display layout? There is also similar message generated by Windows. "God starts from scratch too" |
Evert
Member #794
November 2000
![]() |
Michał Cichoń said: Maybe Allegro should notify user about changing display layout?
Maybe. We have an event for when the orientation of the display changes (only on the iOS port, I think). I think that's a separate issue though, and also one that we don't necessarily need to fix for 5.0 (since we can easily add event types afterwards). EDIT: |
Michał Cichoń
Member #11,736
March 2010
|
OK. I added that magic "-1" value to my TODO list. I will try to fix OSX version tomorrow. "God starts from scratch too" |
|
1
2
|