mirror of
https://github.com/debauchee/barrier.git
synced 2026-05-09 16:02:46 +08:00
moved onError() method to IScreenReceiver from IPrimaryScreenReceiver.
also implemented onError in CClient which previously did not have any way to handle display disconnection.
This commit is contained in:
@@ -2,11 +2,10 @@
|
||||
#include "IScreen.h"
|
||||
#include "IScreenReceiver.h"
|
||||
#include "ProtocolTypes.h"
|
||||
#include "CLock.h"
|
||||
#include "CThread.h"
|
||||
#include "CLog.h"
|
||||
|
||||
// FIXME -- should be locking
|
||||
|
||||
//
|
||||
// CPrimaryScreen
|
||||
//
|
||||
@@ -84,7 +83,10 @@ CPrimaryScreen::open()
|
||||
}
|
||||
|
||||
// enter the screen
|
||||
enterNoWarp();
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
enterNoWarp();
|
||||
}
|
||||
|
||||
// send screen info
|
||||
m_receiver->onInfoChanged(info);
|
||||
@@ -104,6 +106,7 @@ void
|
||||
CPrimaryScreen::enter(SInt32 x, SInt32 y, bool forScreensaver)
|
||||
{
|
||||
log((CLOG_INFO "entering primary at %d,%d%s", x, y, forScreensaver ? " for screen saver" : ""));
|
||||
CLock lock(&m_mutex);
|
||||
assert(m_active == true);
|
||||
|
||||
enterNoWarp();
|
||||
@@ -118,6 +121,8 @@ CPrimaryScreen::enter(SInt32 x, SInt32 y, bool forScreensaver)
|
||||
void
|
||||
CPrimaryScreen::enterNoWarp()
|
||||
{
|
||||
// note -- must be locked on entry
|
||||
|
||||
// not active anymore
|
||||
m_active = false;
|
||||
|
||||
@@ -135,6 +140,7 @@ bool
|
||||
CPrimaryScreen::leave()
|
||||
{
|
||||
log((CLOG_INFO "leaving primary"));
|
||||
CLock lock(&m_mutex);
|
||||
assert(m_active == false);
|
||||
|
||||
// subclass hook
|
||||
@@ -187,6 +193,7 @@ CPrimaryScreen::grabClipboard(ClipboardID id)
|
||||
bool
|
||||
CPrimaryScreen::isActive() const
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
return m_active;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user