| 1 |
To test whether QScreen properties are updated properly when the screen |
| 2 |
actually changes, you will need to run some kind of control panel to make |
| 3 |
changes, and this test program at the same time. E.g. on Linux, you can use |
| 4 |
xrandr with various parameters on the command line, but there is also a nice |
| 5 |
GUI called arandr which will probably work on any distro. Real-world users |
| 6 |
would probably use the Gnome or KDE control panels, so that's also a good way |
| 7 |
to test. On OSX you can make changes in System Preferences | Displays, and you |
| 8 |
can also configure it to put a "monitors" icon on the menubar with a drop-down |
| 9 |
menu for convenience. On Windows you can right-click on the desktop to get |
| 10 |
display settings. |
| 11 |
|
| 12 |
Note that on Linux, if you have one graphics card with two outputs, typically |
| 13 |
the two monitors connected to the outputs are combined into a single virtual |
| 14 |
"screen", but each screen has multiple outputs. In that case there will be a |
| 15 |
unique QScreen for each output, and they will be virtual siblings. The virtual |
| 16 |
geometry depends on how you arrange the monitors (second one is to the right, |
| 17 |
or above the first one, for example). It should be about the same if you are |
| 18 |
using two graphics cards but using Xinerama to combine them. This test app will |
| 19 |
create two windows, and will center one each screen, by setting the geometry. |
| 20 |
|
| 21 |
Alternatively you can configure xorg.conf to create separate screens for each |
| 22 |
graphics card; then the mouse cursor can move between the screens, but |
| 23 |
application windows cannot: each app needs to be started on the screen that |
| 24 |
you want to run it on (by specifying e.g. DISPLAY=:0.1 for the second screen), |
| 25 |
or the application has to set the desired screen via QWindow::setScreen() before |
| 26 |
showing the window. |
| 27 |
|
| 28 |
The physical size of the screen is considered to be a constant. This can create |
| 29 |
discrepancies in DPI when orientation is changed, or when the screen is |
| 30 |
actually a VNC server and you change the resolution. So maybe |
| 31 |
QScreen::physicalSize should also have a notifier, but that doesn't physically |
| 32 |
make sense except when the screen is virtual. |
| 33 |
|
| 34 |
Another case is running two separate X servers on two graphics cards. In that |
| 35 |
case they really do not know about each other, even at the xlib/xcb level, so |
| 36 |
this test is irrelevant. You can run the test independently on each X server, |
| 37 |
but you will just get one QScreen instance on each. |