Create primary monitor when using wxDisplay default ctor

Previously, the first monitor was created instead and while it was often
also the primary one, this wasn't always the case.

In particular, this makes wxGetDisplayPPI() always return something
reasonable instead of returning (0, 0) when the first monitor is not the
primary one, as expected by plenty of code, including our own printing
sample, which divides by the values returned from wxGetDisplayPPI()
without checking if they're zero.
This commit is contained in:
Vadim Zeitlin
2019-11-08 00:26:20 +01:00
parent 46cb23b030
commit d8cd02b480
4 changed files with 40 additions and 5 deletions

View File

@@ -16,6 +16,12 @@
class wxDisplay
{
public:
/**
Default constructor creating wxDisplay object representing the primary
display.
*/
wxDisplay();
/**
Constructor, setting up a wxDisplay instance with the specified
display.
@@ -24,7 +30,7 @@ public:
The index of the display to use. This must be non-negative and
lower than the value returned by GetCount().
*/
wxDisplay(unsigned int index = 0);
explicit wxDisplay(unsigned int index);
/**
Constructor creating the display object associated with the given