mirror of
https://github.com/debauchee/barrier.git
synced 2026-11-27 14:23:02 +08:00
checkpoint. adding screen saver support. only on X so far
and untested. also some known problems: not detecting an xscreensaver started after us and not detecting built-in screen saver activation (not sure if we can without using ugly extensions).
This commit is contained in:
@@ -551,7 +551,7 @@ CClient::onScreenSaver()
|
||||
CProtocolUtil::readf(m_input, kMsgCScreenSaver + 4, &on);
|
||||
}
|
||||
log((CLOG_DEBUG1 "recv screen saver on=%d", on));
|
||||
// FIXME
|
||||
m_screen->screenSaver(on != 0);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "CXWindowsSecondaryScreen.h"
|
||||
#include "CClient.h"
|
||||
#include "CXWindowsClipboard.h"
|
||||
#include "CXWindowsScreenSaver.h"
|
||||
#include "CXWindowsUtil.h"
|
||||
#include "CThread.h"
|
||||
#include "CLog.h"
|
||||
@@ -119,6 +120,9 @@ CXWindowsSecondaryScreen::open(CClient* client)
|
||||
for (ClipboardID id = 0; id < kClipboardEnd; ++id) {
|
||||
grabClipboard(id);
|
||||
}
|
||||
|
||||
// disable the screen saver
|
||||
getScreenSaver()->disable();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -126,6 +130,9 @@ CXWindowsSecondaryScreen::close()
|
||||
{
|
||||
assert(m_client != NULL);
|
||||
|
||||
// restore the screen saver settings
|
||||
getScreenSaver()->enable();
|
||||
|
||||
// close the display
|
||||
closeDisplay();
|
||||
|
||||
@@ -287,6 +294,18 @@ CXWindowsSecondaryScreen::grabClipboard(ClipboardID id)
|
||||
setDisplayClipboard(id, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsSecondaryScreen::screenSaver(bool activate)
|
||||
{
|
||||
CDisplayLock display(this);
|
||||
if (activate) {
|
||||
getScreenSaver()->activate();
|
||||
}
|
||||
else {
|
||||
getScreenSaver()->deactivate();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsSecondaryScreen::getMousePos(SInt32& x, SInt32& y) const
|
||||
{
|
||||
|
||||
@@ -29,6 +29,7 @@ public:
|
||||
virtual void mouseWheel(SInt32 delta);
|
||||
virtual void setClipboard(ClipboardID, const IClipboard*);
|
||||
virtual void grabClipboard(ClipboardID);
|
||||
virtual void screenSaver(bool activate);
|
||||
virtual void getMousePos(SInt32& x, SInt32& y) const;
|
||||
virtual void getShape(SInt32&, SInt32&, SInt32&, SInt32&) const;
|
||||
virtual SInt32 getJumpZoneSize() const;
|
||||
|
||||
Reference in New Issue
Block a user