mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Cosmetics
This commit is contained in:
parent
922dd098c9
commit
579e2df81e
@ -260,8 +260,8 @@ void CConfigParser::SetMultiMonitorVariables(bool reset)
|
|||||||
|
|
||||||
if (CSystem::GetMonitorCount() > 0)
|
if (CSystem::GetMonitorCount() > 0)
|
||||||
{
|
{
|
||||||
const MULTIMONITOR_INFO& multimonInfo = CSystem::GetMultiMonitorInfo();
|
const MultiMonitorInfo& multimonInfo = CSystem::GetMultiMonitorInfo();
|
||||||
const std::vector<MONITOR_INFO>& monitors = multimonInfo.monitors;
|
const std::vector<MonitorInfo>& monitors = multimonInfo.monitors;
|
||||||
|
|
||||||
for (size_t i = 0, isize = monitors.size(); i < isize; ++i)
|
for (size_t i = 0, isize = monitors.size(); i < isize; ++i)
|
||||||
{
|
{
|
||||||
@ -318,8 +318,8 @@ void CConfigParser::SetAutoSelectedMonitorVariables(CMeterWindow* meterWindow)
|
|||||||
int w1, w2, s1, s2;
|
int w1, w2, s1, s2;
|
||||||
int screenIndex;
|
int screenIndex;
|
||||||
|
|
||||||
const MULTIMONITOR_INFO& multimonInfo = CSystem::GetMultiMonitorInfo();
|
const MultiMonitorInfo& multimonInfo = CSystem::GetMultiMonitorInfo();
|
||||||
const std::vector<MONITOR_INFO>& monitors = multimonInfo.monitors;
|
const std::vector<MonitorInfo>& monitors = multimonInfo.monitors;
|
||||||
|
|
||||||
// Set X / WIDTH
|
// Set X / WIDTH
|
||||||
screenIndex = multimonInfo.primary;
|
screenIndex = multimonInfo.primary;
|
||||||
|
@ -232,13 +232,13 @@ void LogInternal(int nLevel, ULONGLONG elapsed, LPCTSTR pszMessage)
|
|||||||
|
|
||||||
void Log(int nLevel, const WCHAR* message)
|
void Log(int nLevel, const WCHAR* message)
|
||||||
{
|
{
|
||||||
struct DELAYED_LogInfo
|
struct DelayedLogInfo
|
||||||
{
|
{
|
||||||
int level;
|
int level;
|
||||||
ULONGLONG elapsed;
|
ULONGLONG elapsed;
|
||||||
std::wstring message;
|
std::wstring message;
|
||||||
};
|
};
|
||||||
static std::list<DELAYED_LogInfo> c_LogDelay;
|
static std::list<DelayedLogInfo> c_LogDelay;
|
||||||
|
|
||||||
static ULONGLONG startTime = CSystem::GetTickCount64();
|
static ULONGLONG startTime = CSystem::GetTickCount64();
|
||||||
ULONGLONG elapsed = CSystem::GetTickCount64() - startTime;
|
ULONGLONG elapsed = CSystem::GetTickCount64() - startTime;
|
||||||
@ -250,7 +250,7 @@ void Log(int nLevel, const WCHAR* message)
|
|||||||
|
|
||||||
while (!c_LogDelay.empty())
|
while (!c_LogDelay.empty())
|
||||||
{
|
{
|
||||||
DELAYED_LogInfo& logInfo = c_LogDelay.front();
|
DelayedLogInfo& logInfo = c_LogDelay.front();
|
||||||
LogInternal(logInfo.level, logInfo.elapsed, logInfo.message.c_str());
|
LogInternal(logInfo.level, logInfo.elapsed, logInfo.message.c_str());
|
||||||
|
|
||||||
c_LogDelay.erase(c_LogDelay.begin());
|
c_LogDelay.erase(c_LogDelay.begin());
|
||||||
@ -268,7 +268,7 @@ void Log(int nLevel, const WCHAR* message)
|
|||||||
// Queue the message
|
// Queue the message
|
||||||
EnterCriticalSection(&g_CsLogDelay);
|
EnterCriticalSection(&g_CsLogDelay);
|
||||||
|
|
||||||
DELAYED_LogInfo logInfo = {nLevel, elapsed, message};
|
DelayedLogInfo logInfo = {nLevel, elapsed, message};
|
||||||
c_LogDelay.push_back(logInfo);
|
c_LogDelay.push_back(logInfo);
|
||||||
|
|
||||||
LeaveCriticalSection(&g_CsLogDelay);
|
LeaveCriticalSection(&g_CsLogDelay);
|
||||||
|
@ -36,7 +36,7 @@ protected:
|
|||||||
virtual void UpdateValue();
|
virtual void UpdateValue();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void TimeToString(WCHAR* buf, size_t bufLen, const WCHAR* format, const struct tm* time);
|
void TimeToString(WCHAR* buf, size_t bufLen, const WCHAR* format, const tm* time);
|
||||||
|
|
||||||
std::wstring m_Format;
|
std::wstring m_Format;
|
||||||
LARGE_INTEGER m_DeltaTime;
|
LARGE_INTEGER m_DeltaTime;
|
||||||
|
@ -1450,8 +1450,8 @@ void CMeterWindow::WindowToScreen()
|
|||||||
float num;
|
float num;
|
||||||
int screenx, screeny, screenh, screenw;
|
int screenx, screeny, screenh, screenw;
|
||||||
|
|
||||||
const MULTIMONITOR_INFO& multimonInfo = CSystem::GetMultiMonitorInfo();
|
const MultiMonitorInfo& multimonInfo = CSystem::GetMultiMonitorInfo();
|
||||||
const std::vector<MONITOR_INFO>& monitors = multimonInfo.monitors;
|
const std::vector<MonitorInfo>& monitors = multimonInfo.monitors;
|
||||||
|
|
||||||
// Clear position flags
|
// Clear position flags
|
||||||
m_WindowXScreen = m_WindowYScreen = multimonInfo.primary; // Default to primary screen
|
m_WindowXScreen = m_WindowYScreen = multimonInfo.primary; // Default to primary screen
|
||||||
@ -1648,8 +1648,8 @@ void CMeterWindow::ScreenToWindow()
|
|||||||
float num;
|
float num;
|
||||||
int screenx, screeny, screenh, screenw;
|
int screenx, screeny, screenh, screenw;
|
||||||
|
|
||||||
const MULTIMONITOR_INFO& multimonInfo = CSystem::GetMultiMonitorInfo();
|
const MultiMonitorInfo& multimonInfo = CSystem::GetMultiMonitorInfo();
|
||||||
const std::vector<MONITOR_INFO>& monitors = multimonInfo.monitors;
|
const std::vector<MonitorInfo>& monitors = multimonInfo.monitors;
|
||||||
|
|
||||||
if (monitors.empty())
|
if (monitors.empty())
|
||||||
{
|
{
|
||||||
@ -3419,8 +3419,8 @@ LRESULT CMeterWindow::OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
}
|
}
|
||||||
else if (wParam == IDM_SKIN_MONITOR_PRIMARY || wParam >= ID_MONITOR_FIRST && wParam <= ID_MONITOR_LAST)
|
else if (wParam == IDM_SKIN_MONITOR_PRIMARY || wParam >= ID_MONITOR_FIRST && wParam <= ID_MONITOR_LAST)
|
||||||
{
|
{
|
||||||
const MULTIMONITOR_INFO& multimonInfo = CSystem::GetMultiMonitorInfo();
|
const MultiMonitorInfo& multimonInfo = CSystem::GetMultiMonitorInfo();
|
||||||
const std::vector<MONITOR_INFO>& monitors = multimonInfo.monitors;
|
const std::vector<MonitorInfo>& monitors = multimonInfo.monitors;
|
||||||
|
|
||||||
int screenIndex;
|
int screenIndex;
|
||||||
bool screenDefined;
|
bool screenDefined;
|
||||||
|
@ -2515,8 +2515,8 @@ void CRainmeter::UpdateDesktopWorkArea(bool reset)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const MULTIMONITOR_INFO& multimonInfo = CSystem::GetMultiMonitorInfo();
|
const MultiMonitorInfo& multimonInfo = CSystem::GetMultiMonitorInfo();
|
||||||
const std::vector<MONITOR_INFO>& monitors = multimonInfo.monitors;
|
const std::vector<MonitorInfo>& monitors = multimonInfo.monitors;
|
||||||
|
|
||||||
if (m_OldDesktopWorkAreas.empty())
|
if (m_OldDesktopWorkAreas.empty())
|
||||||
{
|
{
|
||||||
@ -2589,7 +2589,7 @@ void CRainmeter::UpdateDesktopWorkArea(bool reset)
|
|||||||
|
|
||||||
if (changed && CSystem::GetWindow())
|
if (changed && CSystem::GetWindow())
|
||||||
{
|
{
|
||||||
// Update CSystem::MULTIMONITOR_INFO for for work area variables
|
// Update CSystem::MultiMonitorInfo for for work area variables
|
||||||
SendMessageTimeout(CSystem::GetWindow(), WM_SETTINGCHANGE, SPI_SETWORKAREA, 0, SMTO_ABORTIFHUNG, 1000, NULL);
|
SendMessageTimeout(CSystem::GetWindow(), WM_SETTINGCHANGE, SPI_SETWORKAREA, 0, SMTO_ABORTIFHUNG, 1000, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2654,7 +2654,7 @@ void CRainmeter::WriteStats(bool bForce)
|
|||||||
void CRainmeter::ResetStats()
|
void CRainmeter::ResetStats()
|
||||||
{
|
{
|
||||||
// Set the stats-date string
|
// Set the stats-date string
|
||||||
struct tm* newtime;
|
tm* newtime;
|
||||||
time_t long_time;
|
time_t long_time;
|
||||||
time(&long_time);
|
time(&long_time);
|
||||||
newtime = localtime(&long_time);
|
newtime = localtime(&long_time);
|
||||||
@ -3051,8 +3051,8 @@ void CRainmeter::CreateMonitorMenu(HMENU monitorMenu, CMeterWindow* meterWindow)
|
|||||||
// for the "Specified monitor" (@n)
|
// for the "Specified monitor" (@n)
|
||||||
if (CSystem::GetMonitorCount() > 0)
|
if (CSystem::GetMonitorCount() > 0)
|
||||||
{
|
{
|
||||||
const MULTIMONITOR_INFO& multimonInfo = CSystem::GetMultiMonitorInfo();
|
const MultiMonitorInfo& multimonInfo = CSystem::GetMultiMonitorInfo();
|
||||||
const std::vector<MONITOR_INFO>& monitors = multimonInfo.monitors;
|
const std::vector<MonitorInfo>& monitors = multimonInfo.monitors;
|
||||||
|
|
||||||
for (int i = 0, isize = (int)monitors.size(); i < isize; ++i)
|
for (int i = 0, isize = (int)monitors.size(); i < isize; ++i)
|
||||||
{
|
{
|
||||||
|
@ -42,7 +42,7 @@ enum INTERVAL
|
|||||||
INTERVAL_RESUME = 1000
|
INTERVAL_RESUME = 1000
|
||||||
};
|
};
|
||||||
|
|
||||||
MULTIMONITOR_INFO CSystem::c_Monitors = { 0 };
|
MultiMonitorInfo CSystem::c_Monitors = { 0 };
|
||||||
|
|
||||||
HWND CSystem::c_Window = NULL;
|
HWND CSystem::c_Window = NULL;
|
||||||
HWND CSystem::c_HelperWindow = NULL;
|
HWND CSystem::c_HelperWindow = NULL;
|
||||||
@ -158,7 +158,7 @@ void CSystem::Finalize()
|
|||||||
*/
|
*/
|
||||||
BOOL CALLBACK MyInfoEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData)
|
BOOL CALLBACK MyInfoEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData)
|
||||||
{
|
{
|
||||||
MULTIMONITOR_INFO* m = (MULTIMONITOR_INFO*)dwData;
|
MultiMonitorInfo* m = (MultiMonitorInfo*)dwData;
|
||||||
|
|
||||||
MONITORINFOEX info;
|
MONITORINFOEX info;
|
||||||
info.cbSize = sizeof(MONITORINFOEX);
|
info.cbSize = sizeof(MONITORINFOEX);
|
||||||
@ -193,7 +193,7 @@ BOOL CALLBACK MyInfoEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonit
|
|||||||
}
|
}
|
||||||
else // use only EnumDisplayMonitors
|
else // use only EnumDisplayMonitors
|
||||||
{
|
{
|
||||||
MONITOR_INFO monitor;
|
MonitorInfo monitor;
|
||||||
monitor.active = true;
|
monitor.active = true;
|
||||||
|
|
||||||
monitor.handle = hMonitor;
|
monitor.handle = hMonitor;
|
||||||
@ -245,7 +245,7 @@ size_t CSystem::GetMonitorCount()
|
|||||||
*/
|
*/
|
||||||
void CSystem::SetMultiMonitorInfo()
|
void CSystem::SetMultiMonitorInfo()
|
||||||
{
|
{
|
||||||
std::vector<MONITOR_INFO>& monitors = c_Monitors.monitors;
|
std::vector<MonitorInfo>& monitors = c_Monitors.monitors;
|
||||||
bool logging = Rainmeter->GetDebug();
|
bool logging = Rainmeter->GetDebug();
|
||||||
|
|
||||||
c_Monitors.vsT = GetSystemMetrics(SM_YVIRTUALSCREEN);
|
c_Monitors.vsT = GetSystemMetrics(SM_YVIRTUALSCREEN);
|
||||||
@ -323,7 +323,7 @@ void CSystem::SetMultiMonitorInfo()
|
|||||||
|
|
||||||
if ((dd.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER) == 0)
|
if ((dd.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER) == 0)
|
||||||
{
|
{
|
||||||
MONITOR_INFO monitor = {0};
|
MonitorInfo monitor = {0};
|
||||||
|
|
||||||
monitor.handle = NULL;
|
monitor.handle = NULL;
|
||||||
monitor.deviceName = deviceName; // E.g. "\\.\DISPLAY1"
|
monitor.deviceName = deviceName; // E.g. "\\.\DISPLAY1"
|
||||||
@ -440,7 +440,7 @@ void CSystem::SetMultiMonitorInfo()
|
|||||||
Log(LOG_WARNING, L"Failed to enumerate monitors. Using dummy monitor info.");
|
Log(LOG_WARNING, L"Failed to enumerate monitors. Using dummy monitor info.");
|
||||||
c_Monitors.useEnumDisplayMonitors = false;
|
c_Monitors.useEnumDisplayMonitors = false;
|
||||||
|
|
||||||
MONITOR_INFO monitor;
|
MonitorInfo monitor;
|
||||||
monitor.active = true;
|
monitor.active = true;
|
||||||
|
|
||||||
POINT pos = {0, 0};
|
POINT pos = {0, 0};
|
||||||
@ -515,7 +515,7 @@ void CSystem::SetMultiMonitorInfo()
|
|||||||
*/
|
*/
|
||||||
void CSystem::UpdateWorkareaInfo()
|
void CSystem::UpdateWorkareaInfo()
|
||||||
{
|
{
|
||||||
std::vector<MONITOR_INFO>& monitors = c_Monitors.monitors;
|
std::vector<MonitorInfo>& monitors = c_Monitors.monitors;
|
||||||
|
|
||||||
if (monitors.empty())
|
if (monitors.empty())
|
||||||
{
|
{
|
||||||
|
@ -30,7 +30,7 @@ enum OSPLATFORM
|
|||||||
OSPLATFORM_7
|
OSPLATFORM_7
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MONITOR_INFO
|
struct MonitorInfo
|
||||||
{
|
{
|
||||||
bool active;
|
bool active;
|
||||||
HMONITOR handle;
|
HMONITOR handle;
|
||||||
@ -40,14 +40,14 @@ struct MONITOR_INFO
|
|||||||
std::wstring monitorName; // Monitor name (E.g. "Generic Non-PnP Monitor")
|
std::wstring monitorName; // Monitor name (E.g. "Generic Non-PnP Monitor")
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MULTIMONITOR_INFO
|
struct MultiMonitorInfo
|
||||||
{
|
{
|
||||||
bool useEnumDisplayDevices; // If true, use EnumDisplayDevices function to obtain the multi-monitor information
|
bool useEnumDisplayDevices; // If true, use EnumDisplayDevices function to obtain the multi-monitor information
|
||||||
bool useEnumDisplayMonitors; // If true, use EnumDisplayMonitors function to obtain the multi-monitor information
|
bool useEnumDisplayMonitors; // If true, use EnumDisplayMonitors function to obtain the multi-monitor information
|
||||||
|
|
||||||
int vsT, vsL, vsH, vsW; // Coordinates of the top-left corner (vsT,vsL) and size (vsH,vsW) of the virtual screen
|
int vsT, vsL, vsH, vsW; // Coordinates of the top-left corner (vsT,vsL) and size (vsH,vsW) of the virtual screen
|
||||||
int primary; // Index of the primary monitor
|
int primary; // Index of the primary monitor
|
||||||
std::vector<MONITOR_INFO> monitors;
|
std::vector<MonitorInfo> monitors;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CSystem
|
class CSystem
|
||||||
@ -56,7 +56,7 @@ public:
|
|||||||
static void Initialize(HINSTANCE instance);
|
static void Initialize(HINSTANCE instance);
|
||||||
static void Finalize();
|
static void Finalize();
|
||||||
|
|
||||||
static const MULTIMONITOR_INFO& GetMultiMonitorInfo() { return c_Monitors; }
|
static const MultiMonitorInfo& GetMultiMonitorInfo() { return c_Monitors; }
|
||||||
static size_t GetMonitorCount();
|
static size_t GetMonitorCount();
|
||||||
|
|
||||||
static bool GetShowDesktop() { return c_ShowDesktop; }
|
static bool GetShowDesktop() { return c_ShowDesktop; }
|
||||||
@ -111,7 +111,7 @@ private:
|
|||||||
|
|
||||||
static HWINEVENTHOOK c_WinEventHook;
|
static HWINEVENTHOOK c_WinEventHook;
|
||||||
|
|
||||||
static MULTIMONITOR_INFO c_Monitors;
|
static MultiMonitorInfo c_Monitors;
|
||||||
|
|
||||||
static bool c_ShowDesktop;
|
static bool c_ShowDesktop;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user