diff --git a/Library/MeterWindow.cpp b/Library/MeterWindow.cpp index 68a20805..584bae41 100644 --- a/Library/MeterWindow.cpp +++ b/Library/MeterWindow.cpp @@ -2486,7 +2486,12 @@ void CMeterWindow::Update(bool nodraw) m_ResetRegion = true; } - Redraw(); + // If our option is to disable when in an RDP session, then check if in an RDP session. + // Only redraw if we are not in a remote session + if (!Rainmeter->GetDisableRDP() || !GetSystemMetrics(SM_REMOTESESSION)) + { + Redraw(); + } } // Start/stop the transition timer if necessary @@ -3492,7 +3497,7 @@ LRESULT CMeterWindow::OnExitSizeMove(UINT uMsg, WPARAM wParam, LPARAM lParam) */ LRESULT CMeterWindow::OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam) { - if (m_WindowDraggable) + if (m_WindowDraggable && !Rainmeter->GetDisableDrag()) { POINT pos; pos.x = (SHORT)LOWORD(lParam); diff --git a/Library/Rainmeter.cpp b/Library/Rainmeter.cpp index a9695c0e..981c74a1 100644 --- a/Library/Rainmeter.cpp +++ b/Library/Rainmeter.cpp @@ -1186,13 +1186,17 @@ CRainmeter::CRainmeter() { m_MenuActive = false; + m_DisableRDP = false; + + m_DisableDrag = false; + m_Logging = false; m_DesktopWorkAreaChanged = false; m_DesktopWorkAreaType = false; - m_DisableVersionCheck = FALSE; - m_NewVersion = FALSE; + m_DisableVersionCheck = false; + m_NewVersion = false; m_Instance = NULL; m_CurrentParser = NULL; @@ -2730,6 +2734,8 @@ void CRainmeter::ReadGeneralSettings(const std::wstring& iniFile) // Read Logging settings m_Logging = 0!=parser.ReadInt(L"Rainmeter", L"Logging", 0); + m_DisableDrag = 0!=parser.ReadInt(L"Rainmeter", L"DisableDrag", 0); + m_DisableRDP = 0!=parser.ReadInt(L"Rainmeter", L"DisableRDP", 0); c_Debug = 0!=parser.ReadInt(L"Rainmeter", L"Debug", 0); if (m_Logging) @@ -3239,8 +3245,14 @@ void CRainmeter::ShowContextMenu(POINT pos, CMeterWindow* meterWindow) { AppendMenu(configMenu, MF_SEPARATOR, 0, NULL); AppendMenu(configMenu, 0, ID_CONTEXT_OPENSKINSFOLDER, L"Open Skins\' Folder"); + AppendMenu(configMenu, 0, ID_CONTEXT_DISABLEDRAG, L"Disable Drag"); AppendMenu(configMenu, 0, ID_CONTEXT_MANAGESKINS, L"Manage Skins..."); + if (m_DisableDrag) + { + CheckMenuItem(configMenu, ID_CONTEXT_DISABLEDRAG, MF_BYCOMMAND | MF_CHECKED); + } + InsertMenu(subMenu, 3, MF_BYPOSITION | MF_POPUP, (UINT_PTR)configMenu, L"Configs"); } @@ -3500,7 +3512,11 @@ HMENU CRainmeter::CreateSkinMenu(CMeterWindow* meterWindow, int index, HMENU con CheckMenuItem(settingsMenu, ID_CONTEXT_SKINMENU_REMEMBERPOSITION, MF_BYCOMMAND | MF_CHECKED); } - if (meterWindow->GetWindowDraggable()) + if (m_DisableDrag) + { + EnableMenuItem(settingsMenu, ID_CONTEXT_SKINMENU_DRAGGABLE, MF_BYCOMMAND | MF_GRAYED); + } + else if (meterWindow->GetWindowDraggable()) { CheckMenuItem(settingsMenu, ID_CONTEXT_SKINMENU_DRAGGABLE, MF_BYCOMMAND | MF_CHECKED); } @@ -3747,6 +3763,12 @@ void CRainmeter::SetDebug(bool debug) WritePrivateProfileString(L"Rainmeter", L"Debug", debug ? L"1" : L"0", m_IniFile.c_str()); } +void CRainmeter::SetDisableDrag(bool drag) +{ + m_DisableDrag = drag; + WritePrivateProfileString(L"Rainmeter", L"DisableDrag", dragging ? L"1" : L"0", m_IniFile.c_str()); +} + void CRainmeter::TestSettingsFile(bool bDefaultIniLocation) { WritePrivateProfileString(L"Rainmeter", L"WriteTest", L"TRUE", m_IniFile.c_str()); diff --git a/Library/Rainmeter.h b/Library/Rainmeter.h index 6e7324a6..1ff2b5b3 100644 --- a/Library/Rainmeter.h +++ b/Library/Rainmeter.h @@ -135,7 +135,6 @@ public: std::wstring message; }; - CRainmeter(); ~CRainmeter(); @@ -196,6 +195,11 @@ public: void StopLogging(); void DeleteLogFile(); + bool GetDisableRDP() { return m_DisableRDP; } + + bool GetDisableDrag() { return m_DisableDrag; } + void SetDisableDrag(bool drag); + void AddAboutLogInfo(const LOG_INFO& logInfo); const std::list& GetAboutLogData() { return m_LogData; } @@ -279,6 +283,10 @@ private: bool m_MenuActive; + bool m_DisableRDP; + + bool m_DisableDrag; + bool m_Logging; std::list m_LogData; diff --git a/Library/TrayWindow.cpp b/Library/TrayWindow.cpp index d1f74ddf..4b33e52d 100644 --- a/Library/TrayWindow.cpp +++ b/Library/TrayWindow.cpp @@ -449,6 +449,10 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA { Rainmeter->SetDebug(!CRainmeter::GetDebug()); } + else if(wParam == ID_CONTEXT_DISABLEDRAG) + { + Rainmeter->SetDisableDrag(!Rainmeter->GetDisableDrag()); + } else if(wParam == ID_CONTEXT_EDITCONFIG) { std::wstring command = Rainmeter->GetConfigEditor(); diff --git a/Library/resource.h b/Library/resource.h index d28e2b74..02d436b4 100644 --- a/Library/resource.h +++ b/Library/resource.h @@ -18,6 +18,7 @@ #define IDC_DISABLE_VERSION_CHECK 1008 #define ID_CONTEXT_REFRESH 4001 #define ID_CONTEXT_QUIT 4002 +#define ID_CONTEXT_DISABLEDRAG 4003 #define ID_CONTEXT_ABOUT 4004 #define ID_CONTEXT_DOWNLOADS 4005 #define ID_CONTEXT_CONFIGS_DEFAULT 4006