Remove the now unnecessary wxDisplayFactoryMSW::RefreshMonitors()

wxDisplay::InvalidateCache() does the same thing this function does, so
just remove it to avoid confusion.

This also allows to get rid of ms_factory duplicating the factory
pointer stored at wxDisplay level.

See https://github.com/wxWidgets/wxWidgets/pull/1281
This commit is contained in:
dasimx 2019-03-30 10:30:15 +01:00 committed by Vadim Zeitlin
parent 58d4b0e209
commit e9ca12aaac

View File

@ -198,10 +198,6 @@ public:
DoRefreshMonitors(); DoRefreshMonitors();
} }
// Called when we receive WM_SETTINGCHANGE to refresh the list of monitor
// handles.
static void RefreshMonitors() { ms_factory->InvalidateCache(); }
// Declare the second argument as int to avoid problems with older SDKs not // Declare the second argument as int to avoid problems with older SDKs not
// declaring MONITOR_DPI_TYPE enum. // declaring MONITOR_DPI_TYPE enum.
typedef HRESULT (WINAPI *GetDpiForMonitor_t)(HMONITOR, int, UINT*, UINT*); typedef HRESULT (WINAPI *GetDpiForMonitor_t)(HMONITOR, int, UINT*, UINT*);
@ -221,15 +217,9 @@ private:
// return wxNOT_FOUND if not found // return wxNOT_FOUND if not found
int FindDisplayFromHMONITOR(HMONITOR hmon) const; int FindDisplayFromHMONITOR(HMONITOR hmon) const;
// Update m_displays array, used by RefreshMonitors(). // Update m_displays array, used initially and by InvalidateCache().
void DoRefreshMonitors(); void DoRefreshMonitors();
// The unique factory being used (as we don't have direct access to the
// global factory pointer in the common code so we just duplicate this
// variable (also making it of correct type for us) here).
static wxDisplayFactoryMSW* ms_factory;
// The pointer to GetDpiForMonitorPtr(), retrieved on demand, and the // The pointer to GetDpiForMonitorPtr(), retrieved on demand, and the
// related data, including the DLL containing the function that we must // related data, including the DLL containing the function that we must
// keep loaded. // keep loaded.
@ -285,7 +275,6 @@ private:
wxDECLARE_NO_COPY_CLASS(wxDisplayFactoryMSW); wxDECLARE_NO_COPY_CLASS(wxDisplayFactoryMSW);
}; };
wxDisplayFactoryMSW* wxDisplayFactoryMSW::ms_factory = NULL;
wxDisplayFactoryMSW::GetDpiForMonitorData wxDisplayFactoryMSW::GetDpiForMonitorData
wxDisplayFactoryMSW::ms_getDpiForMonitorData; wxDisplayFactoryMSW::ms_getDpiForMonitorData;
@ -547,12 +536,6 @@ wxDisplayWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
wxDisplayFactoryMSW::wxDisplayFactoryMSW() wxDisplayFactoryMSW::wxDisplayFactoryMSW()
{ {
// This is not supposed to happen with the current code, the factory is
// implicitly a singleton.
wxASSERT_MSG( !ms_factory, wxS("Using more than one factory?") );
ms_factory = this;
m_hiddenHwnd = NULL; m_hiddenHwnd = NULL;
m_hiddenClass = NULL; m_hiddenClass = NULL;
@ -592,8 +575,6 @@ wxDisplayFactoryMSW::~wxDisplayFactoryMSW()
ms_getDpiForMonitorData.UnloadIfNecessary(); ms_getDpiForMonitorData.UnloadIfNecessary();
ms_getDpiForMonitorData.m_initialized = false; ms_getDpiForMonitorData.m_initialized = false;
} }
ms_factory = NULL;
} }
/* static */ /* static */