Remove unnecessary wxUSE_DISPLAY preprocessor checks

Most of the methods of wxDisplay are always available, they just only
support primary display when wxUSE_DISPLAY==0, so there is no need to
check for wxUSE_DISPLAY before using them as they already contain the
only possible fallback anyhow and such checks are useless.

This incidentally closes #18115, due to removing "#if wxUSE_DISPLAY"
around wx/display.h inclusion.
This commit is contained in:
Vadim Zeitlin
2018-05-22 23:23:49 +02:00
parent bac28b95cd
commit 587a510028
3 changed files with 7 additions and 26 deletions

View File

@@ -44,9 +44,7 @@
#include "wx/textwrapper.h"
#include "wx/modalhook.h"
#if wxUSE_DISPLAY
#include "wx/display.h"
#endif
extern WXDLLEXPORT_DATA(const char) wxDialogNameStr[] = "dialog";
@@ -873,11 +871,7 @@ int wxStandardDialogLayoutAdapter::DoMustScroll(wxDialog* dialog, wxSize& window
wxSize minWindowSize = dialog->GetSizer()->GetMinSize();
windowSize = dialog->GetSize();
windowSize = wxSize(wxMax(windowSize.x, minWindowSize.x), wxMax(windowSize.y, minWindowSize.y));
#if wxUSE_DISPLAY
displaySize = wxDisplay(wxDisplay::GetFromWindow(dialog)).GetClientArea().GetSize();
#else
displaySize = wxGetClientDisplayRect().GetSize();
#endif
int flags = 0;

View File

@@ -905,20 +905,13 @@ bool wxTopLevelWindowMSW::ShowFullScreen(bool show, long style)
// change our window style to be compatible with full-screen mode
updateStyle.Apply();
wxRect rect;
#if wxUSE_DISPLAY
// resize to the size of the display containing us
// resize to the size of the display containing us, falling back to the
// primary one
int dpy = wxDisplay::GetFromWindow(this);
if ( dpy != wxNOT_FOUND )
{
rect = wxDisplay(dpy).GetGeometry();
}
else // fall back to the main desktop
#endif // wxUSE_DISPLAY
{
// resize to the size of the desktop
wxCopyRECTToRect(wxGetWindowRect(::GetDesktopWindow()), rect);
}
if ( dpy == wxNOT_FOUND )
dpy = 0;
const wxRect rect = wxDisplay(dpy).GetGeometry();
SetSize(rect);

View File

@@ -1953,17 +1953,11 @@ void Window::SetTitle(const char *s) {
// Returns rectangle of monitor pt is on
PRectangle Window::GetMonitorRect(Point pt) {
wxRect rect;
if (! wid) return PRectangle();
#if wxUSE_DISPLAY
// Get the display the point is found on
int n = wxDisplay::GetFromPoint(wxPoint(wxRound(pt.x), wxRound(pt.y)));
wxDisplay dpy(n == wxNOT_FOUND ? 0 : n);
rect = dpy.GetGeometry();
#else
wxUnusedVar(pt);
#endif
return PRectangleFromwxRect(rect);
return PRectangleFromwxRect(dpy.GetGeometry());
}
//----------------------------------------------------------------------