Allow XScreensaver syncing from client to server
Allows to deactivate the screensaver and postpone screensaver activation if local input is detected on a client. This fixes the screensavers getting out of sync if a client has a local input device such as a touchscreen
This commit is contained in:
parent
b891b1e630
commit
b3fd2335b3
|
@ -178,12 +178,10 @@ Screen::grabClipboard(ClipboardID id)
|
||||||
void
|
void
|
||||||
Screen::screensaver(bool activate)
|
Screen::screensaver(bool activate)
|
||||||
{
|
{
|
||||||
if (!m_isPrimary) {
|
|
||||||
// activate/deactivation screen saver iff synchronization enabled
|
// activate/deactivation screen saver iff synchronization enabled
|
||||||
if (m_screenSaverSync) {
|
if (m_screenSaverSync) {
|
||||||
m_screen->screensaver(activate);
|
m_screen->screensaver(activate);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
// 1.5: adds file transfer and removes home brew crypto
|
// 1.5: adds file transfer and removes home brew crypto
|
||||||
// 1.6: adds clipboard streaming
|
// 1.6: adds clipboard streaming
|
||||||
// 1.7: adds focus/screen switch on local input
|
// 1.7: adds focus/screen switch on local input
|
||||||
|
// adds screensaver sync on client local input
|
||||||
// NOTE: with new version, barrier minor version should increment
|
// NOTE: with new version, barrier minor version should increment
|
||||||
static const SInt16 kProtocolMajorVersion = 1;
|
static const SInt16 kProtocolMajorVersion = 1;
|
||||||
static const SInt16 kProtocolMinorVersion = 7;
|
static const SInt16 kProtocolMinorVersion = 7;
|
||||||
|
@ -130,9 +131,16 @@ extern const char* kMsgCClose;
|
||||||
// must return this number with some messages. $4 = modifier key
|
// must return this number with some messages. $4 = modifier key
|
||||||
// mask. this will have bits set for each toggle modifier key
|
// mask. this will have bits set for each toggle modifier key
|
||||||
// that is activated on entry to the screen. the secondary screen
|
// that is activated on entry to the screen. the secondary screen
|
||||||
// should adjust its toggle modifiers to reflect that state.
|
// should adjust its toggle modifiers to reflect that state. $5 =
|
||||||
|
// forScreensaver flag which denotes whether the screen is only
|
||||||
|
// entered for screensaver management purposes or not and thus
|
||||||
|
// whether the client can change its screensaver state or should
|
||||||
|
// not change the screensaver state
|
||||||
extern const char* kMsgCEnter;
|
extern const char* kMsgCEnter;
|
||||||
|
|
||||||
|
// enter screen 1.0: same as above but without respecting the screensaver state
|
||||||
|
extern const char* kMsgCEnter1_0;
|
||||||
|
|
||||||
// leave screen: primary -> secondary
|
// leave screen: primary -> secondary
|
||||||
// leaving screen. the secondary screen should send clipboard
|
// leaving screen. the secondary screen should send clipboard
|
||||||
// data in response to this message for those clipboards that
|
// data in response to this message for those clipboards that
|
||||||
|
@ -149,8 +157,10 @@ extern const char* kMsgCLeave;
|
||||||
// most recent kMsgCEnter. the primary always sends 0.
|
// most recent kMsgCEnter. the primary always sends 0.
|
||||||
extern const char* kMsgCClipboard;
|
extern const char* kMsgCClipboard;
|
||||||
|
|
||||||
// screensaver change: primary -> secondary
|
// screensaver change: primary <-> secondary
|
||||||
// screensaver on primary has started ($1 == 1) or closed ($1 == 0)
|
// screensaver has started ($1 == 1) or closed ($1 == 0).
|
||||||
|
// sync screensavers by dispatching information to all clients via
|
||||||
|
// the server
|
||||||
extern const char* kMsgCScreenSaver;
|
extern const char* kMsgCScreenSaver;
|
||||||
|
|
||||||
// reset options: primary -> secondary
|
// reset options: primary -> secondary
|
||||||
|
|
|
@ -237,10 +237,13 @@ Client::getCursorPos(SInt32& x, SInt32& y) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Client::enter(SInt32 xAbs, SInt32 yAbs, UInt32, KeyModifierMask mask, bool)
|
Client::enter(SInt32 xAbs, SInt32 yAbs, UInt32, KeyModifierMask mask, bool forScreensaver)
|
||||||
{
|
{
|
||||||
m_active = true;
|
m_active = true;
|
||||||
m_screen->mouseMove(xAbs, yAbs);
|
m_screen->mouseMove(xAbs, yAbs);
|
||||||
|
if (!forScreensaver) {
|
||||||
|
m_screen->screensaver(false);
|
||||||
|
}
|
||||||
m_screen->enter(mask);
|
m_screen->enter(mask);
|
||||||
|
|
||||||
if (m_sendFileThread != NULL) {
|
if (m_sendFileThread != NULL) {
|
||||||
|
@ -512,6 +515,14 @@ Client::setupScreen()
|
||||||
getEventTarget(),
|
getEventTarget(),
|
||||||
new TMethodEventJob<Client>(this,
|
new TMethodEventJob<Client>(this,
|
||||||
&Client::handleLocalInputEvent));
|
&Client::handleLocalInputEvent));
|
||||||
|
m_events->adoptHandler(m_events->forIPrimaryScreen().screensaverActivated(),
|
||||||
|
getEventTarget(),
|
||||||
|
new TMethodEventJob<Client>(this,
|
||||||
|
&Client::handleScreensaverActivatedEvent));
|
||||||
|
m_events->adoptHandler(m_events->forIPrimaryScreen().screensaverDeactivated(),
|
||||||
|
getEventTarget(),
|
||||||
|
new TMethodEventJob<Client>(this,
|
||||||
|
&Client::handleScreensaverDeactivatedEvent));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -570,6 +581,11 @@ Client::cleanupScreen()
|
||||||
getEventTarget());
|
getEventTarget());
|
||||||
m_events->removeHandler(m_events->forIScreen().localInput(),
|
m_events->removeHandler(m_events->forIScreen().localInput(),
|
||||||
getEventTarget());
|
getEventTarget());
|
||||||
|
m_events->removeHandler(m_events->forIPrimaryScreen().screensaverActivated(),
|
||||||
|
getEventTarget());
|
||||||
|
m_events->removeHandler(m_events->forIPrimaryScreen().screensaverDeactivated(),
|
||||||
|
getEventTarget());
|
||||||
|
|
||||||
delete m_server;
|
delete m_server;
|
||||||
m_server = NULL;
|
m_server = NULL;
|
||||||
}
|
}
|
||||||
|
@ -745,6 +761,18 @@ Client::handleResume(const Event&, void*)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Client::handleScreensaverActivatedEvent(const Event&, void*) {
|
||||||
|
LOG((CLOG_DEBUG "Client received screensaver activate"));
|
||||||
|
m_server->sendScreensaver(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Client::handleScreensaverDeactivatedEvent(const Event&, void*) {
|
||||||
|
LOG((CLOG_DEBUG "Client received screensaver deactivate"));
|
||||||
|
m_server->sendScreensaver(false);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Client::handleFileChunkSending(const Event& event, void*)
|
Client::handleFileChunkSending(const Event& event, void*)
|
||||||
{
|
{
|
||||||
|
|
|
@ -188,6 +188,8 @@ private:
|
||||||
void handleHello(const Event&, void*);
|
void handleHello(const Event&, void*);
|
||||||
void handleSuspend(const Event& event, void*);
|
void handleSuspend(const Event& event, void*);
|
||||||
void handleResume(const Event& event, void*);
|
void handleResume(const Event& event, void*);
|
||||||
|
void handleScreensaverActivatedEvent(const Event&, void*);
|
||||||
|
void handleScreensaverDeactivatedEvent(const Event&, void*);
|
||||||
void handleFileChunkSending(const Event&, void*);
|
void handleFileChunkSending(const Event&, void*);
|
||||||
void handleFileRecieveCompleted(const Event&, void*);
|
void handleFileRecieveCompleted(const Event&, void*);
|
||||||
void handleStopRetry(const Event&, void*);
|
void handleStopRetry(const Event&, void*);
|
||||||
|
|
|
@ -275,7 +275,7 @@ ServerProxy::parseMessage(const UInt8* code)
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (memcmp(code, kMsgCScreenSaver, 4) == 0) {
|
else if (memcmp(code, kMsgCScreenSaver, 4) == 0) {
|
||||||
screensaver();
|
rcvScreensaver();
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (memcmp(code, kMsgQInfo, 4) == 0) {
|
else if (memcmp(code, kMsgQInfo, 4) == 0) {
|
||||||
|
@ -524,11 +524,12 @@ void
|
||||||
ServerProxy::enter()
|
ServerProxy::enter()
|
||||||
{
|
{
|
||||||
// parse
|
// parse
|
||||||
|
SInt8 forScreensaver;
|
||||||
SInt16 x, y;
|
SInt16 x, y;
|
||||||
UInt16 mask;
|
UInt16 mask;
|
||||||
UInt32 seqNum;
|
UInt32 seqNum;
|
||||||
ProtocolUtil::readf(m_stream, kMsgCEnter + 4, &x, &y, &seqNum, &mask);
|
ProtocolUtil::readf(m_stream, kMsgCEnter + 4, &x, &y, &seqNum, &mask, &forScreensaver);
|
||||||
LOG((CLOG_DEBUG1 "recv enter, %d,%d %d %04x", x, y, seqNum, mask));
|
LOG((CLOG_DEBUG1 "recv enter, %d,%d %d %04x, forScreensaver=%d", x, y, seqNum, mask, forScreensaver));
|
||||||
|
|
||||||
// discard old compressed mouse motion, if any
|
// discard old compressed mouse motion, if any
|
||||||
m_compressMouse = false;
|
m_compressMouse = false;
|
||||||
|
@ -538,7 +539,7 @@ ServerProxy::enter()
|
||||||
m_seqNum = seqNum;
|
m_seqNum = seqNum;
|
||||||
|
|
||||||
// forward
|
// forward
|
||||||
m_client->enter(x, y, seqNum, static_cast<KeyModifierMask>(mask), false);
|
m_client->enter(x, y, seqNum, static_cast<KeyModifierMask>(mask), forScreensaver != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -777,7 +778,7 @@ ServerProxy::mouseWheel()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ServerProxy::screensaver()
|
ServerProxy::rcvScreensaver()
|
||||||
{
|
{
|
||||||
// parse
|
// parse
|
||||||
SInt8 on;
|
SInt8 on;
|
||||||
|
@ -788,6 +789,12 @@ ServerProxy::screensaver()
|
||||||
m_client->screensaver(on != 0);
|
m_client->screensaver(on != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ServerProxy::sendScreensaver(bool activate) {
|
||||||
|
// Notify server about screensaver state of client
|
||||||
|
ProtocolUtil::writef(m_stream, kMsgCScreenSaver, activate ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ServerProxy::resetOptions()
|
ServerProxy::resetOptions()
|
||||||
{
|
{
|
||||||
|
|
|
@ -60,6 +60,9 @@ public:
|
||||||
// sending dragging information to server
|
// sending dragging information to server
|
||||||
void sendDragInfo(UInt32 fileCount, const char* info, size_t size);
|
void sendDragInfo(UInt32 fileCount, const char* info, size_t size);
|
||||||
|
|
||||||
|
// Send screensaver information to server
|
||||||
|
void sendScreensaver(bool activate);
|
||||||
|
|
||||||
#ifdef BARRIER_TEST_ENV
|
#ifdef BARRIER_TEST_ENV
|
||||||
void handleDataForTest() { handleData(Event(), NULL); }
|
void handleDataForTest() { handleData(Event(), NULL); }
|
||||||
#endif
|
#endif
|
||||||
|
@ -99,7 +102,7 @@ private:
|
||||||
void mouseMove();
|
void mouseMove();
|
||||||
void mouseRelativeMove();
|
void mouseRelativeMove();
|
||||||
void mouseWheel();
|
void mouseWheel();
|
||||||
void screensaver();
|
void rcvScreensaver();
|
||||||
void resetOptions();
|
void resetOptions();
|
||||||
void setOptions();
|
void setOptions();
|
||||||
void queryInfo();
|
void queryInfo();
|
||||||
|
|
|
@ -244,8 +244,6 @@ XWindowsScreen::disable()
|
||||||
void
|
void
|
||||||
XWindowsScreen::enter()
|
XWindowsScreen::enter()
|
||||||
{
|
{
|
||||||
screensaver(false);
|
|
||||||
|
|
||||||
// release input context focus
|
// release input context focus
|
||||||
if (m_ic != NULL) {
|
if (m_ic != NULL) {
|
||||||
m_impl->XUnsetICFocus(m_ic);
|
m_impl->XUnsetICFocus(m_ic);
|
||||||
|
@ -411,9 +409,11 @@ void
|
||||||
XWindowsScreen::screensaver(bool activate)
|
XWindowsScreen::screensaver(bool activate)
|
||||||
{
|
{
|
||||||
if (activate) {
|
if (activate) {
|
||||||
|
m_screensaverNotificationTimer.reset();
|
||||||
m_screensaver->activate();
|
m_screensaver->activate();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
m_screensaverNotificationTimer.reset();
|
||||||
m_screensaver->deactivate();
|
m_screensaver->deactivate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2117,8 +2117,11 @@ XWindowsScreen::selectXIRawEventsSecondary()
|
||||||
mask.mask = (unsigned char*) calloc(mask.mask_len, sizeof(char));
|
mask.mask = (unsigned char*) calloc(mask.mask_len, sizeof(char));
|
||||||
LOGC((mask.mask == nullptr), (CLOG_ERR "Cannot listen on XI2 events due to memory error"));
|
LOGC((mask.mask == nullptr), (CLOG_ERR "Cannot listen on XI2 events due to memory error"));
|
||||||
|
|
||||||
// Detect mouse button press events on secondary screens (= clients)
|
// Detect mouse events (movement, button press) on secondary screens (= clients)
|
||||||
|
XISetMask(mask.mask, XI_RawMotion);
|
||||||
XISetMask(mask.mask, XI_RawButtonPress);
|
XISetMask(mask.mask, XI_RawButtonPress);
|
||||||
|
// Detect key press events on secondary screens (= clients)
|
||||||
|
XISetMask(mask.mask, XI_RawKeyPress);
|
||||||
// Detect touchscreen events on secondary screens (= clients)
|
// Detect touchscreen events on secondary screens (= clients)
|
||||||
XISetMask(mask.mask, XI_RawTouchBegin);
|
XISetMask(mask.mask, XI_RawTouchBegin);
|
||||||
XISetMask(mask.mask, XI_RawTouchUpdate);
|
XISetMask(mask.mask, XI_RawTouchUpdate);
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#include "barrier/PlatformScreen.h"
|
#include "barrier/PlatformScreen.h"
|
||||||
#include "barrier/KeyMap.h"
|
#include "barrier/KeyMap.h"
|
||||||
|
#include "base/Stopwatch.h"
|
||||||
#include "common/stdset.h"
|
#include "common/stdset.h"
|
||||||
#include "common/stdvector.h"
|
#include "common/stdvector.h"
|
||||||
#include "XWindowsImpl.h"
|
#include "XWindowsImpl.h"
|
||||||
|
@ -231,6 +232,9 @@ private:
|
||||||
// screen saver stuff
|
// screen saver stuff
|
||||||
XWindowsScreenSaver* m_screensaver;
|
XWindowsScreenSaver* m_screensaver;
|
||||||
bool m_screensaverNotify;
|
bool m_screensaverNotify;
|
||||||
|
// Timer for server notification to suppress screensaver if necessary
|
||||||
|
Stopwatch m_screensaverNotificationTimer;
|
||||||
|
const double NOTIFICATION_TIMEOUT = 10.0;
|
||||||
|
|
||||||
// logical to physical button mapping. m_buttons[i] gives the
|
// logical to physical button mapping. m_buttons[i] gives the
|
||||||
// physical button for logical button i+1.
|
// physical button for logical button i+1.
|
||||||
|
|
|
@ -39,6 +39,15 @@ ClientProxy1_7::~ClientProxy1_7()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ClientProxy1_7::enter(SInt32 xAbs, SInt32 yAbs,
|
||||||
|
UInt32 seqNum, KeyModifierMask mask, bool forScreensaver)
|
||||||
|
{
|
||||||
|
LOG((CLOG_DEBUG1 "send enter to \"%s\", %d,%d %d %04x, forScreensaver=%d", getName().c_str(), xAbs, yAbs, seqNum, mask, forScreensaver ? 1 : 0));
|
||||||
|
ProtocolUtil::writef(getStream(), kMsgCEnter,
|
||||||
|
xAbs, yAbs, seqNum, mask, forScreensaver ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ClientProxy1_7::parseMessage(const UInt8* code)
|
ClientProxy1_7::parseMessage(const UInt8* code)
|
||||||
{
|
{
|
||||||
|
@ -51,9 +60,24 @@ ClientProxy1_7::parseMessage(const UInt8* code)
|
||||||
|
|
||||||
m_events->addEvent(Event(m_events->forIScreen().localInput(), getEventTarget(), info));
|
m_events->addEvent(Event(m_events->forIScreen().localInput(), getEventTarget(), info));
|
||||||
}
|
}
|
||||||
|
else if (memcmp(code, kMsgCScreenSaver, 4) == 0) {
|
||||||
|
rcvScreensaver();
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
return ClientProxy1_6::parseMessage(code);
|
return ClientProxy1_6::parseMessage(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ClientProxy1_7::rcvScreensaver()
|
||||||
|
{
|
||||||
|
SInt8 activate;
|
||||||
|
ProtocolUtil::readf(getStream(), kMsgCScreenSaver + 4, &activate);
|
||||||
|
if (activate != 0) {
|
||||||
|
m_events->addEvent(Event(m_events->forIPrimaryScreen().screensaverActivated(), getEventTarget()));
|
||||||
|
} else {
|
||||||
|
m_events->addEvent(Event(m_events->forIPrimaryScreen().screensaverDeactivated(), getEventTarget()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -28,10 +28,14 @@ public:
|
||||||
ClientProxy1_7(const String& name, barrier::IStream* adoptedStream, Server* server, IEventQueue* events);
|
ClientProxy1_7(const String& name, barrier::IStream* adoptedStream, Server* server, IEventQueue* events);
|
||||||
~ClientProxy1_7();
|
~ClientProxy1_7();
|
||||||
|
|
||||||
|
virtual void enter(SInt32 xAbs, SInt32 yAbs,
|
||||||
|
UInt32 seqNum, KeyModifierMask mask,
|
||||||
|
bool forScreensaver);
|
||||||
|
|
||||||
|
protected:
|
||||||
virtual bool parseMessage(const UInt8* code);
|
virtual bool parseMessage(const UInt8* code);
|
||||||
|
|
||||||
private:
|
virtual void rcvScreensaver();
|
||||||
void handleClipboardSendingEvent(const Event&, void*);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
IEventQueue* m_events;
|
IEventQueue* m_events;
|
||||||
|
|
|
@ -139,10 +139,10 @@ PrimaryClient::disable()
|
||||||
|
|
||||||
void
|
void
|
||||||
PrimaryClient::enter(SInt32 xAbs, SInt32 yAbs,
|
PrimaryClient::enter(SInt32 xAbs, SInt32 yAbs,
|
||||||
UInt32 seqNum, KeyModifierMask mask, bool screensaver)
|
UInt32 seqNum, KeyModifierMask mask, bool forScreensaver)
|
||||||
{
|
{
|
||||||
m_screen->setSequenceNumber(seqNum);
|
m_screen->setSequenceNumber(seqNum);
|
||||||
if (!screensaver) {
|
if (!forScreensaver) {
|
||||||
m_screen->warpCursor(xAbs, yAbs);
|
m_screen->warpCursor(xAbs, yAbs);
|
||||||
}
|
}
|
||||||
m_screen->enter(mask);
|
m_screen->enter(mask);
|
||||||
|
@ -244,9 +244,9 @@ PrimaryClient::mouseWheel(SInt32, SInt32)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PrimaryClient::screensaver(bool)
|
PrimaryClient::screensaver(bool activate)
|
||||||
{
|
{
|
||||||
// ignore
|
m_screen->screensaver(activate);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -1601,6 +1601,12 @@ Server::onScreensaver(bool activated)
|
||||||
{
|
{
|
||||||
LOG((CLOG_DEBUG "onScreenSaver %s", activated ? "activated" : "deactivated"));
|
LOG((CLOG_DEBUG "onScreenSaver %s", activated ? "activated" : "deactivated"));
|
||||||
|
|
||||||
|
if (m_screensaverDelayTimer.getTime() > SCREENSAVER_DELAY_THRESHOLD) {
|
||||||
|
// The timer prevents flickering and erronous screensavers caused by a bad combination
|
||||||
|
// of internal events and XEvents => drop events in the range of a certain delay to
|
||||||
|
// prevent duplicate screensaver invocations
|
||||||
|
m_screensaverDelayTimer.reset();
|
||||||
|
|
||||||
if (activated) {
|
if (activated) {
|
||||||
// save current screen and position
|
// save current screen and position
|
||||||
m_activeSaver = m_active;
|
m_activeSaver = m_active;
|
||||||
|
@ -1616,28 +1622,28 @@ Server::onScreensaver(bool activated)
|
||||||
// jump back to previous screen and position. we must check
|
// jump back to previous screen and position. we must check
|
||||||
// that the position is still valid since the screen may have
|
// that the position is still valid since the screen may have
|
||||||
// changed resolutions while the screen saver was running.
|
// changed resolutions while the screen saver was running.
|
||||||
if (m_activeSaver != NULL && m_activeSaver != m_primaryClient) {
|
// if (m_activeSaver != NULL && m_activeSaver != m_primaryClient) {
|
||||||
// check position
|
// // check position
|
||||||
BaseClientProxy* screen = m_activeSaver;
|
// BaseClientProxy* screen = m_activeSaver;
|
||||||
SInt32 x, y, w, h;
|
// SInt32 x, y, w, h;
|
||||||
screen->getShape(x, y, w, h);
|
// screen->getShape(x, y, w, h);
|
||||||
SInt32 zoneSize = getJumpZoneSize(screen);
|
// SInt32 zoneSize = getJumpZoneSize(screen);
|
||||||
if (m_xSaver < x + zoneSize) {
|
// if (m_xSaver < x + zoneSize) {
|
||||||
m_xSaver = x + zoneSize;
|
// m_xSaver = x + zoneSize;
|
||||||
}
|
// }
|
||||||
else if (m_xSaver >= x + w - zoneSize) {
|
// else if (m_xSaver >= x + w - zoneSize) {
|
||||||
m_xSaver = x + w - zoneSize - 1;
|
// m_xSaver = x + w - zoneSize - 1;
|
||||||
}
|
// }
|
||||||
if (m_ySaver < y + zoneSize) {
|
// if (m_ySaver < y + zoneSize) {
|
||||||
m_ySaver = y + zoneSize;
|
// m_ySaver = y + zoneSize;
|
||||||
}
|
// }
|
||||||
else if (m_ySaver >= y + h - zoneSize) {
|
// else if (m_ySaver >= y + h - zoneSize) {
|
||||||
m_ySaver = y + h - zoneSize - 1;
|
// m_ySaver = y + h - zoneSize - 1;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// jump
|
// // jump
|
||||||
switchScreen(screen, m_xSaver, m_ySaver, false);
|
// switchScreen(screen, m_xSaver, m_ySaver, false);
|
||||||
}
|
// }
|
||||||
|
|
||||||
// reset state
|
// reset state
|
||||||
m_activeSaver = NULL;
|
m_activeSaver = NULL;
|
||||||
|
@ -1648,6 +1654,13 @@ Server::onScreensaver(bool activated)
|
||||||
index != m_clients.end(); ++index) {
|
index != m_clients.end(); ++index) {
|
||||||
BaseClientProxy* client = index->second;
|
BaseClientProxy* client = index->second;
|
||||||
client->screensaver(activated);
|
client->screensaver(activated);
|
||||||
|
if (!activated && client != m_active) {
|
||||||
|
// Leave all screens that are not the active screen. This ensures that the
|
||||||
|
// cursor does not appear on multiple screens again after deactivating the
|
||||||
|
// screensaver
|
||||||
|
client->leave();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2153,6 +2166,10 @@ Server::addClient(BaseClientProxy* client)
|
||||||
client->getEventTarget(),
|
client->getEventTarget(),
|
||||||
new TMethodEventJob<Server>(this,
|
new TMethodEventJob<Server>(this,
|
||||||
&Server::handleLocalInputEvent, client));
|
&Server::handleLocalInputEvent, client));
|
||||||
|
m_events->adoptHandler(m_events->forIPrimaryScreen().screensaverDeactivated(),
|
||||||
|
client->getEventTarget(),
|
||||||
|
new TMethodEventJob<Server>(this,
|
||||||
|
&Server::handleScreensaverDeactivatedEvent));
|
||||||
|
|
||||||
// add to list
|
// add to list
|
||||||
m_clientSet.insert(client);
|
m_clientSet.insert(client);
|
||||||
|
@ -2187,6 +2204,8 @@ Server::removeClient(BaseClientProxy* client)
|
||||||
client->getEventTarget());
|
client->getEventTarget());
|
||||||
m_events->removeHandler(m_events->forIScreen().localInput(),
|
m_events->removeHandler(m_events->forIScreen().localInput(),
|
||||||
client->getEventTarget());
|
client->getEventTarget());
|
||||||
|
m_events->removeHandler(m_events->forIPrimaryScreen().screensaverDeactivated(),
|
||||||
|
client->getEventTarget());
|
||||||
|
|
||||||
// remove from list
|
// remove from list
|
||||||
m_clients.erase(getName(client));
|
m_clients.erase(getName(client));
|
||||||
|
|
|
@ -427,6 +427,8 @@ private:
|
||||||
// state saved when screen saver activates
|
// state saved when screen saver activates
|
||||||
BaseClientProxy* m_activeSaver;
|
BaseClientProxy* m_activeSaver;
|
||||||
SInt32 m_xSaver, m_ySaver;
|
SInt32 m_xSaver, m_ySaver;
|
||||||
|
Stopwatch m_screensaverDelayTimer; // Used for preventing duplicate messages to clients
|
||||||
|
const double SCREENSAVER_DELAY_THRESHOLD = 0.5;
|
||||||
|
|
||||||
// common state for screen switch tests. all tests are always
|
// common state for screen switch tests. all tests are always
|
||||||
// trying to reach the same screen in the same direction.
|
// trying to reach the same screen in the same direction.
|
||||||
|
|
Loading…
Reference in New Issue