mirror of
https://github.com/debauchee/barrier.git
synced 2024-12-22 10:31:45 +03:00
900b075e3a
on unix, but client screens don't simulate events other than mouse move. also not supporting clipboard at all yet and the main app is just a temporary framework to test with. must clean up protocol and communication.
59 lines
769 B
C++
59 lines
769 B
C++
#include "CSocket.h"
|
|
#include "IJob.h"
|
|
|
|
//
|
|
// CSocket
|
|
//
|
|
|
|
CSocket::CSocket() : m_readJob(NULL), m_writeJob(NULL)
|
|
{
|
|
// do nothing
|
|
}
|
|
|
|
CSocket::~CSocket()
|
|
{
|
|
delete m_readJob;
|
|
delete m_writeJob;
|
|
}
|
|
|
|
void CSocket::setReadJob(IJob* adoptedJob)
|
|
{
|
|
delete m_readJob;
|
|
m_readJob = adoptedJob;
|
|
onJobChanged();
|
|
}
|
|
|
|
void CSocket::setWriteJob(IJob* adoptedJob)
|
|
{
|
|
delete m_writeJob;
|
|
m_writeJob = adoptedJob;
|
|
onJobChanged();
|
|
}
|
|
|
|
void CSocket::onJobChanged()
|
|
{
|
|
// do nothing
|
|
}
|
|
|
|
void CSocket::runReadJob()
|
|
{
|
|
if (m_readJob)
|
|
m_readJob->run();
|
|
}
|
|
|
|
void CSocket::runWriteJob()
|
|
{
|
|
if (m_writeJob)
|
|
m_writeJob->run();
|
|
}
|
|
|
|
bool CSocket::hasReadJob() const
|
|
{
|
|
return (m_readJob != NULL);
|
|
}
|
|
|
|
bool CSocket::hasWriteJob() const
|
|
{
|
|
return (m_writeJob != NULL);
|
|
}
|