From 52d8edb747541adc46b42601dc6796f836850b7b Mon Sep 17 00:00:00 2001 From: crs Date: Tue, 5 Nov 2002 19:23:05 +0000 Subject: [PATCH] Fixed bug in detecting screen saver activation. Was using || instead of && in conditional. --- lib/platform/CXWindowsScreen.cpp | 4 ++-- lib/platform/CXWindowsScreenSaver.cpp | 6 ++++-- lib/platform/CXWindowsScreenSaver.h | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/platform/CXWindowsScreen.cpp b/lib/platform/CXWindowsScreen.cpp index 2ebbbaf9..40e8591d 100644 --- a/lib/platform/CXWindowsScreen.cpp +++ b/lib/platform/CXWindowsScreen.cpp @@ -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); diff --git a/lib/platform/CXWindowsScreenSaver.cpp b/lib/platform/CXWindowsScreenSaver.cpp index e32f13c3..c712f826 100644 --- a/lib/platform/CXWindowsScreenSaver.cpp +++ b/lib/platform/CXWindowsScreenSaver.cpp @@ -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); } diff --git a/lib/platform/CXWindowsScreenSaver.h b/lib/platform/CXWindowsScreenSaver.h index 7e6d4304..dd1050cb 100644 --- a/lib/platform/CXWindowsScreenSaver.h +++ b/lib/platform/CXWindowsScreenSaver.h @@ -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;