diff options
author | George Hazan <george.hazan@gmail.com> | 2013-09-25 12:07:46 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-09-25 12:07:46 +0000 |
commit | e64818967374ebdadf6f22d18296e7bc6088277b (patch) | |
tree | 14736c4f5d51012dfccb63bc745f08a63ec4f8fd /src | |
parent | dd1460d664f7266920b07527f25f87ec8233daaf (diff) |
IsFullScreen(), IsWorkstationLocked(), IsScreenSaverRunning() moved to the core
git-svn-id: http://svn.miranda-ng.org/main/trunk@6226 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r-- | src/core/stdidle/idle.cpp | 59 | ||||
-rw-r--r-- | src/mir_core/mir_core.def | 5 | ||||
-rw-r--r-- | src/mir_core/winver.cpp | 55 |
3 files changed, 60 insertions, 59 deletions
diff --git a/src/core/stdidle/idle.cpp b/src/core/stdidle/idle.cpp index 5dff57cefc..15981a872d 100644 --- a/src/core/stdidle/idle.cpp +++ b/src/core/stdidle/idle.cpp @@ -208,65 +208,6 @@ static int IdleObject_IsUserIdle(IdleObject * obj) return FALSE;
}
-static bool IsWorkstationLocked (void)
-{
- bool rc = false;
-
- HDESK hDesk = OpenInputDesktop(0, FALSE, DESKTOP_SWITCHDESKTOP);
- if (hDesk == NULL)
- rc = true;
- else
- CloseDesktop(hDesk);
- return rc;
-}
-
-static bool IsScreenSaverRunning(void)
-{
- BOOL rc = FALSE;
- SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, 0, &rc, FALSE);
- return rc != 0;
-}
-
-bool IsFullScreen(void)
-{
- RECT rcScreen = {0};
-
- rcScreen.right = GetSystemMetrics(SM_CXSCREEN);
- rcScreen.bottom = GetSystemMetrics(SM_CYSCREEN);
-
- HMONITOR hMon = MonitorFromWindow(pcli->hwndContactList, MONITOR_DEFAULTTONEAREST);
- MONITORINFO mi;
- mi.cbSize = sizeof(mi);
- if (GetMonitorInfo(hMon, &mi))
- rcScreen = mi.rcMonitor;
-
- HWND hWndDesktop = GetDesktopWindow();
- HWND hWndShell = GetShellWindow();
-
- // check foregroundwindow
- HWND hWnd = GetForegroundWindow();
- if (hWnd && hWnd != hWndDesktop && hWnd != hWndShell)
- {
- TCHAR tszClassName[128] = _T("");
- GetClassName(hWnd, tszClassName, SIZEOF(tszClassName));
- if (_tcscmp(tszClassName, _T("WorkerW")))
- {
- RECT rect, rectw, recti;
- GetWindowRect(hWnd, &rectw);
-
- GetClientRect(hWnd, &rect);
- ClientToScreen(hWnd, (LPPOINT)&rect);
- ClientToScreen(hWnd, (LPPOINT)&rect.right);
-
- if (EqualRect(&rect, &rectw) && IntersectRect(&recti, &rect, &rcScreen) &&
- EqualRect(&recti, &rcScreen))
- return true;
- }
- }
-
- return false;
-}
-
static void IdleObject_Tick(IdleObject * obj)
{
bool idle = false;
diff --git a/src/mir_core/mir_core.def b/src/mir_core/mir_core.def index bfd34cb47d..add3c18cf3 100644 --- a/src/mir_core/mir_core.def +++ b/src/mir_core/mir_core.def @@ -238,3 +238,8 @@ mirstr_getNil @235 mirstr_lock @236
mirstr_release @237
mirstr_unlock @238
+IsWinVerVistaPlus @239
+IsWinVer7Plus @240
+IsFullScreen @241
+IsWorkstationLocked @242
+IsScreenSaverRunning @243
diff --git a/src/mir_core/winver.cpp b/src/mir_core/winver.cpp index b980d5138e..03a6e62a28 100644 --- a/src/mir_core/winver.cpp +++ b/src/mir_core/winver.cpp @@ -34,3 +34,58 @@ MIR_CORE_DLL(BOOL) IsWinVer7Plus() {
return dwWinVer >= _WIN32_WINNT_WIN7;
}
+
+MIR_CORE_DLL(BOOL) IsFullScreen()
+{
+ RECT rcScreen = {0};
+
+ rcScreen.right = GetSystemMetrics(SM_CXSCREEN);
+ rcScreen.bottom = GetSystemMetrics(SM_CYSCREEN);
+
+ HMONITOR hMon = MonitorFromWindow(GetForegroundWindow(), MONITOR_DEFAULTTONEAREST);
+ MONITORINFO mi;
+ mi.cbSize = sizeof(mi);
+ if (GetMonitorInfo(hMon, &mi))
+ rcScreen = mi.rcMonitor;
+
+ HWND hWndDesktop = GetDesktopWindow();
+ HWND hWndShell = GetShellWindow();
+
+ // check foregroundwindow
+ HWND hWnd = GetForegroundWindow();
+ if (hWnd && hWnd != hWndDesktop && hWnd != hWndShell) {
+ TCHAR tszClassName[128] = _T("");
+ GetClassName(hWnd, tszClassName, SIZEOF(tszClassName));
+ if ( _tcscmp(tszClassName, _T("WorkerW"))) {
+ RECT rect, rectw, recti;
+ GetWindowRect(hWnd, &rectw);
+
+ GetClientRect(hWnd, &rect);
+ ClientToScreen(hWnd, (LPPOINT)&rect);
+ ClientToScreen(hWnd, (LPPOINT)&rect.right);
+
+ if (EqualRect(&rect, &rectw) && IntersectRect(&recti, &rect, &rcScreen) &&
+ EqualRect(&recti, &rcScreen))
+ return true;
+ }
+ }
+
+ return false;
+}
+
+MIR_CORE_DLL(BOOL) IsWorkstationLocked(void)
+{
+ HDESK hDesk = OpenInputDesktop(0, FALSE, DESKTOP_SWITCHDESKTOP);
+ if (hDesk == NULL)
+ return true;
+
+ CloseDesktop(hDesk);
+ return false;
+}
+
+MIR_CORE_DLL(BOOL) IsScreenSaverRunning(void)
+{
+ BOOL rc = FALSE;
+ SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, 0, &rc, FALSE);
+ return rc != 0;
+}
|