From e9ca12aaacb8792a8d737e0e2c03e6aa862973dd Mon Sep 17 00:00:00 2001 From: dasimx Date: Sat, 30 Mar 2019 10:30:15 +0100 Subject: [PATCH] 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 --- src/msw/display.cpp | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/src/msw/display.cpp b/src/msw/display.cpp index 993b3cdaa9..7c23d54f15 100644 --- a/src/msw/display.cpp +++ b/src/msw/display.cpp @@ -198,10 +198,6 @@ public: 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 // declaring MONITOR_DPI_TYPE enum. typedef HRESULT (WINAPI *GetDpiForMonitor_t)(HMONITOR, int, UINT*, UINT*); @@ -221,15 +217,9 @@ private: // return wxNOT_FOUND if not found int FindDisplayFromHMONITOR(HMONITOR hmon) const; - // Update m_displays array, used by RefreshMonitors(). + // Update m_displays array, used initially and by InvalidateCache(). 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 // related data, including the DLL containing the function that we must // keep loaded. @@ -285,7 +275,6 @@ private: wxDECLARE_NO_COPY_CLASS(wxDisplayFactoryMSW); }; -wxDisplayFactoryMSW* wxDisplayFactoryMSW::ms_factory = NULL; wxDisplayFactoryMSW::GetDpiForMonitorData wxDisplayFactoryMSW::ms_getDpiForMonitorData; @@ -547,12 +536,6 @@ wxDisplayWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) 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_hiddenClass = NULL; @@ -592,8 +575,6 @@ wxDisplayFactoryMSW::~wxDisplayFactoryMSW() ms_getDpiForMonitorData.UnloadIfNecessary(); ms_getDpiForMonitorData.m_initialized = false; } - - ms_factory = NULL; } /* static */