Fixed bug in detecting screen saver activation. Was using || instead

of && in conditional.
This commit is contained in:
crs 2002-11-05 19:23:05 +00:00
parent ca984acb91
commit 52d8edb747
3 changed files with 7 additions and 4 deletions

View File

@ -239,7 +239,7 @@ CXWindowsScreen::open()
updateScreenShape();
// initialize the screen saver
m_atomScreensaver = XInternAtom(m_display, "SCREENSAVER", False);
m_atomScreensaver = XInternAtom(m_display, "SYNERGY_SCREENSAVER", False);
m_screensaver = new CXWindowsScreenSaver(this, m_display);
}
@ -634,7 +634,7 @@ CXWindowsScreen::onPreDispatch(CEvent* event)
break;
case ClientMessage:
if (xevent->xclient.message_type == m_atomScreensaver ||
if (xevent->xclient.message_type == m_atomScreensaver &&
xevent->xclient.format == 32) {
// screen saver activation/deactivation event
m_eventHandler->onScreensaver(xevent->xclient.data.l[0] != 0);

View File

@ -50,6 +50,8 @@ CXWindowsScreenSaver::CXWindowsScreenSaver(
"ACTIVATE", False);
m_atomScreenSaverDeactivate = XInternAtom(m_display,
"DEACTIVATE", False);
m_atomSynergyScreenSaver = XInternAtom(m_display,
"SYNERGY_SCREENSAVER", False);
// create dummy window to receive xscreensaver responses. this
// shouldn't be necessary (we should be able to send responses
@ -263,7 +265,7 @@ CXWindowsScreenSaver::sendNotify(bool activated)
event.xclient.type = ClientMessage;
event.xclient.display = m_display;
event.xclient.window = m_notify;
event.xclient.message_type = m_atomScreenSaver;
event.xclient.message_type = m_atomSynergyScreenSaver;
event.xclient.format = 32;
event.xclient.data.l[0] = activated ? 1 : 0;
event.xclient.data.l[1] = 0;
@ -342,7 +344,7 @@ void
CXWindowsScreenSaver::setXScreenSaverActive(bool activated)
{
if (m_xscreensaverActive != activated) {
LOG((CLOG_DEBUG "xscreensaver %s", activated ? "activated" : "deactivated"));
LOG((CLOG_DEBUG "xscreensaver %s on window 0x%08x", activated ? "activated" : "deactivated", m_xscreensaver));
m_xscreensaverActive = activated;
sendNotify(activated);
}

View File

@ -132,6 +132,7 @@ private:
Atom m_atomScreenSaverVersion;
Atom m_atomScreenSaverActivate;
Atom m_atomScreenSaverDeactivate;
Atom m_atomSynergyScreenSaver;
// built-in screen saver settings
int m_timeout;