Fixed a resource leak. Also fixed the detection of the screen saver
closing on windows 2000 and XP.
This commit is contained in:
parent
58de7a21fe
commit
2a3015f06a
|
@ -376,6 +376,7 @@ CMSWindowsScreenSaver::watchDesktopThread(void*)
|
|||
// wait a bit
|
||||
ARCH->sleep(0.2);
|
||||
|
||||
if (m_isNT) {
|
||||
// get current desktop
|
||||
HDESK desk = OpenInputDesktop(0, FALSE, GENERIC_READ);
|
||||
if (desk == NULL) {
|
||||
|
@ -395,15 +396,22 @@ CMSWindowsScreenSaver::watchDesktopThread(void*)
|
|||
|
||||
// get current desktop name
|
||||
GetUserObjectInformation(desk, UOI_NAME, name, size, &size);
|
||||
CloseDesktop(desk);
|
||||
|
||||
// compare name to screen saver desktop name
|
||||
if (_tcsicmp(name, TEXT("Screen-saver")) == 0) {
|
||||
// XXX -- getting "Default" as desk when screen saver was running
|
||||
// before we started checking on it. can it be "Default" at other
|
||||
// times to? how do we properly detect a running screen saver?
|
||||
// still the screen saver desktop so keep waiting
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// 2000/XP have a sane way to detect a runnin screensaver.
|
||||
BOOL running;
|
||||
SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, 0, &running, 0);
|
||||
if (running) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// send screen saver deactivation message
|
||||
m_active = false;
|
||||
|
|
Loading…
Reference in New Issue