mirror of
https://github.com/debauchee/barrier.git
synced 2024-11-23 00:56:21 +03:00
formatting changes.
This commit is contained in:
parent
57fb87ad10
commit
fe16546a1d
@ -54,9 +54,7 @@ CLog::Lock CLog::s_lock = &CLog::dummyLock;
|
||||
int CLog::s_maxPriority = -1;
|
||||
|
||||
void
|
||||
CLog::print(
|
||||
const char* fmt,
|
||||
...)
|
||||
CLog::print(const char* fmt, ...)
|
||||
{
|
||||
// check if fmt begins with a priority argument
|
||||
int priority = 4;
|
||||
@ -90,11 +88,7 @@ CLog::print(
|
||||
}
|
||||
|
||||
void
|
||||
CLog::printt(
|
||||
const char* file,
|
||||
int line,
|
||||
const char* fmt,
|
||||
...)
|
||||
CLog::printt(const char* file, int line, const char* fmt, ...)
|
||||
{
|
||||
// check if fmt begins with a priority argument
|
||||
int priority = 4;
|
||||
@ -141,8 +135,7 @@ CLog::printt(
|
||||
}
|
||||
|
||||
void
|
||||
CLog::setOutputter(
|
||||
Outputter outputter)
|
||||
CLog::setOutputter(Outputter outputter)
|
||||
{
|
||||
CHoldLock lock(s_lock);
|
||||
s_outputter = outputter;
|
||||
@ -156,8 +149,7 @@ CLog::getOutputter()
|
||||
}
|
||||
|
||||
void
|
||||
CLog::setLock(
|
||||
Lock newLock)
|
||||
CLog::setLock(Lock newLock)
|
||||
{
|
||||
CHoldLock lock(s_lock);
|
||||
s_lock = (newLock == NULL) ? dummyLock : newLock;
|
||||
@ -171,8 +163,7 @@ CLog::getLock()
|
||||
}
|
||||
|
||||
bool
|
||||
CLog::setFilter(
|
||||
const char* maxPriority)
|
||||
CLog::setFilter(const char* maxPriority)
|
||||
{
|
||||
if (maxPriority != NULL) {
|
||||
for (int i = 0; i < g_numPriority; ++i) {
|
||||
@ -187,8 +178,7 @@ CLog::setFilter(
|
||||
}
|
||||
|
||||
void
|
||||
CLog::setFilter(
|
||||
int maxPriority)
|
||||
CLog::setFilter(int maxPriority)
|
||||
{
|
||||
CHoldLock lock(s_lock);
|
||||
s_maxPriority = maxPriority;
|
||||
@ -202,8 +192,7 @@ CLog::getFilter()
|
||||
}
|
||||
|
||||
void
|
||||
CLog::dummyLock(
|
||||
bool)
|
||||
CLog::dummyLock(bool)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
@ -222,9 +211,7 @@ CLog::getMaxPriority()
|
||||
}
|
||||
|
||||
void
|
||||
CLog::output(
|
||||
int priority,
|
||||
char* msg)
|
||||
CLog::output(int priority, char* msg)
|
||||
{
|
||||
assert(priority >= -1 && priority < g_numPriority);
|
||||
assert(msg != NULL);
|
||||
@ -257,12 +244,7 @@ CLog::output(
|
||||
}
|
||||
|
||||
char*
|
||||
CLog::vsprint(
|
||||
int pad,
|
||||
char* buffer,
|
||||
int len,
|
||||
const char* fmt,
|
||||
va_list args)
|
||||
CLog::vsprint(int pad, char* buffer, int len, const char* fmt, va_list args)
|
||||
{
|
||||
assert(len > 0);
|
||||
|
||||
|
@ -8,8 +8,8 @@
|
||||
|
||||
bool
|
||||
CStringUtil::CaselessCmp::cmpEqual(
|
||||
const CString::value_type& a,
|
||||
const CString::value_type& b)
|
||||
const CString::value_type& a,
|
||||
const CString::value_type& b)
|
||||
{
|
||||
// FIXME -- use std::tolower but not in all versions of libstdc++
|
||||
return tolower(a) == tolower(b);
|
||||
@ -17,17 +17,15 @@ CStringUtil::CaselessCmp::cmpEqual(
|
||||
|
||||
bool
|
||||
CStringUtil::CaselessCmp::cmpLess(
|
||||
const CString::value_type& a,
|
||||
const CString::value_type& b)
|
||||
const CString::value_type& a,
|
||||
const CString::value_type& b)
|
||||
{
|
||||
// FIXME -- use std::tolower but not in all versions of libstdc++
|
||||
return tolower(a) < tolower(b);
|
||||
}
|
||||
|
||||
bool
|
||||
CStringUtil::CaselessCmp::less(
|
||||
const CString& a,
|
||||
const CString& b)
|
||||
CStringUtil::CaselessCmp::less(const CString& a, const CString& b)
|
||||
{
|
||||
return std::lexicographical_compare(
|
||||
a.begin(), a.end(),
|
||||
@ -36,17 +34,13 @@ CStringUtil::CaselessCmp::less(
|
||||
}
|
||||
|
||||
bool
|
||||
CStringUtil::CaselessCmp::equal(
|
||||
const CString& a,
|
||||
const CString& b)
|
||||
CStringUtil::CaselessCmp::equal(const CString& a, const CString& b)
|
||||
{
|
||||
return !(less(a, b) || less(b, a));
|
||||
}
|
||||
|
||||
bool
|
||||
CStringUtil::CaselessCmp::operator()(
|
||||
const CString& a,
|
||||
const CString& b) const
|
||||
CStringUtil::CaselessCmp::operator()(const CString& a, const CString& b) const
|
||||
{
|
||||
return less(a, b);
|
||||
}
|
||||
|
@ -44,9 +44,7 @@ XBase::what() const
|
||||
}
|
||||
|
||||
CString
|
||||
XBase::format(
|
||||
const char* /*id*/,
|
||||
const char* fmt, ...) const throw()
|
||||
XBase::format(const char* /*id*/, const char* fmt, ...) const throw()
|
||||
{
|
||||
// FIXME -- use id to lookup formating string
|
||||
// FIXME -- format string with arguments
|
||||
|
@ -28,8 +28,7 @@
|
||||
// CClient
|
||||
//
|
||||
|
||||
CClient::CClient(
|
||||
const CString& clientName) :
|
||||
CClient::CClient(const CString& clientName) :
|
||||
m_name(clientName),
|
||||
m_input(NULL),
|
||||
m_output(NULL),
|
||||
@ -48,15 +47,13 @@ CClient::~CClient()
|
||||
}
|
||||
|
||||
void
|
||||
CClient::camp(
|
||||
bool on)
|
||||
CClient::camp(bool on)
|
||||
{
|
||||
m_camp = on;
|
||||
}
|
||||
|
||||
bool
|
||||
CClient::run(
|
||||
const CNetworkAddress& serverAddress)
|
||||
CClient::run(const CNetworkAddress& serverAddress)
|
||||
{
|
||||
CThread* thread = NULL;
|
||||
try {
|
||||
@ -140,8 +137,7 @@ CClient::quit()
|
||||
}
|
||||
|
||||
void
|
||||
CClient::onClipboardChanged(
|
||||
ClipboardID id)
|
||||
CClient::onClipboardChanged(ClipboardID id)
|
||||
{
|
||||
log((CLOG_DEBUG "sending clipboard %d changed", id));
|
||||
CLock lock(&m_mutex);
|
||||
|
@ -69,8 +69,7 @@ CMSWindowsSecondaryScreen::stop()
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsSecondaryScreen::open(
|
||||
CClient* client)
|
||||
CMSWindowsSecondaryScreen::open(CClient* client)
|
||||
{
|
||||
assert(m_client == NULL);
|
||||
assert(client != NULL);
|
||||
@ -108,10 +107,7 @@ CMSWindowsSecondaryScreen::close()
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsSecondaryScreen::enter(
|
||||
SInt32 x,
|
||||
SInt32 y,
|
||||
KeyModifierMask mask)
|
||||
CMSWindowsSecondaryScreen::enter(SInt32 x, SInt32 y, KeyModifierMask mask)
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
assert(m_window != NULL);
|
||||
@ -182,9 +178,7 @@ CMSWindowsSecondaryScreen::leave()
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsSecondaryScreen::keyDown(
|
||||
KeyID key,
|
||||
KeyModifierMask mask)
|
||||
CMSWindowsSecondaryScreen::keyDown(KeyID key, KeyModifierMask mask)
|
||||
{
|
||||
Keystrokes keys;
|
||||
UINT virtualKey;
|
||||
@ -224,10 +218,8 @@ CMSWindowsSecondaryScreen::keyDown(
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsSecondaryScreen::keyRepeat(
|
||||
KeyID key,
|
||||
KeyModifierMask mask,
|
||||
SInt32 count)
|
||||
CMSWindowsSecondaryScreen::keyRepeat(KeyID key,
|
||||
KeyModifierMask mask, SInt32 count)
|
||||
{
|
||||
Keystrokes keys;
|
||||
UINT virtualKey;
|
||||
@ -248,9 +240,7 @@ CMSWindowsSecondaryScreen::keyRepeat(
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsSecondaryScreen::keyUp(
|
||||
KeyID key,
|
||||
KeyModifierMask mask)
|
||||
CMSWindowsSecondaryScreen::keyUp(KeyID key, KeyModifierMask mask)
|
||||
{
|
||||
Keystrokes keys;
|
||||
UINT virtualKey;
|
||||
@ -311,8 +301,7 @@ CMSWindowsSecondaryScreen::keyUp(
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsSecondaryScreen::mouseDown(
|
||||
ButtonID button)
|
||||
CMSWindowsSecondaryScreen::mouseDown(ButtonID button)
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
assert(m_window != NULL);
|
||||
@ -328,8 +317,7 @@ CMSWindowsSecondaryScreen::mouseDown(
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsSecondaryScreen::mouseUp(
|
||||
ButtonID button)
|
||||
CMSWindowsSecondaryScreen::mouseUp(ButtonID button)
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
assert(m_window != NULL);
|
||||
@ -345,9 +333,7 @@ CMSWindowsSecondaryScreen::mouseUp(
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsSecondaryScreen::mouseMove(
|
||||
SInt32 x,
|
||||
SInt32 y)
|
||||
CMSWindowsSecondaryScreen::mouseMove(SInt32 x, SInt32 y)
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
assert(m_window != NULL);
|
||||
@ -362,8 +348,7 @@ CMSWindowsSecondaryScreen::mouseMove(
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsSecondaryScreen::mouseWheel(
|
||||
SInt32 delta)
|
||||
CMSWindowsSecondaryScreen::mouseWheel(SInt32 delta)
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
assert(m_window != NULL);
|
||||
@ -373,9 +358,8 @@ CMSWindowsSecondaryScreen::mouseWheel(
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsSecondaryScreen::setClipboard(
|
||||
ClipboardID /*id*/,
|
||||
const IClipboard* src)
|
||||
CMSWindowsSecondaryScreen::setClipboard(ClipboardID /*id*/,
|
||||
const IClipboard* src)
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
assert(m_window != NULL);
|
||||
@ -385,8 +369,7 @@ CMSWindowsSecondaryScreen::setClipboard(
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsSecondaryScreen::grabClipboard(
|
||||
ClipboardID /*id*/)
|
||||
CMSWindowsSecondaryScreen::grabClipboard(ClipboardID /*id*/)
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
assert(m_window != NULL);
|
||||
@ -398,9 +381,7 @@ CMSWindowsSecondaryScreen::grabClipboard(
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsSecondaryScreen::getMousePos(
|
||||
SInt32* x,
|
||||
SInt32* y) const
|
||||
CMSWindowsSecondaryScreen::getMousePos(SInt32* x, SInt32* y) const
|
||||
{
|
||||
assert(x != NULL);
|
||||
assert(y != NULL);
|
||||
@ -421,9 +402,7 @@ CMSWindowsSecondaryScreen::getMousePos(
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsSecondaryScreen::getSize(
|
||||
SInt32* width,
|
||||
SInt32* height) const
|
||||
CMSWindowsSecondaryScreen::getSize(SInt32* width, SInt32* height) const
|
||||
{
|
||||
getScreenSize(width, height);
|
||||
}
|
||||
@ -435,9 +414,8 @@ CMSWindowsSecondaryScreen::getJumpZoneSize() const
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsSecondaryScreen::getClipboard(
|
||||
ClipboardID /*id*/,
|
||||
IClipboard* dst) const
|
||||
CMSWindowsSecondaryScreen::getClipboard(ClipboardID /*id*/,
|
||||
IClipboard* dst) const
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
assert(m_window != NULL);
|
||||
@ -486,8 +464,7 @@ CMSWindowsSecondaryScreen::onCloseDisplay()
|
||||
}
|
||||
|
||||
bool
|
||||
CMSWindowsSecondaryScreen::onPreTranslate(
|
||||
MSG* msg)
|
||||
CMSWindowsSecondaryScreen::onPreTranslate(MSG* msg)
|
||||
{
|
||||
// handle event
|
||||
switch (msg->message) {
|
||||
@ -511,11 +488,8 @@ CMSWindowsSecondaryScreen::onPreTranslate(
|
||||
}
|
||||
|
||||
LRESULT
|
||||
CMSWindowsSecondaryScreen::onEvent(
|
||||
HWND hwnd,
|
||||
UINT msg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
CMSWindowsSecondaryScreen::onEvent(HWND hwnd, UINT msg,
|
||||
WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (msg) {
|
||||
case WM_QUERYENDSESSION:
|
||||
@ -582,9 +556,7 @@ CMSWindowsSecondaryScreen::onEvent(
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsSecondaryScreen::onEnter(
|
||||
SInt32 x,
|
||||
SInt32 y)
|
||||
CMSWindowsSecondaryScreen::onEnter(SInt32 x, SInt32 y)
|
||||
{
|
||||
// warp to requested location
|
||||
SInt32 w, h;
|
||||
@ -655,8 +627,7 @@ CMSWindowsSecondaryScreen::closeDesktop()
|
||||
}
|
||||
|
||||
bool
|
||||
CMSWindowsSecondaryScreen::switchDesktop(
|
||||
HDESK desk)
|
||||
CMSWindowsSecondaryScreen::switchDesktop(HDESK desk)
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
|
||||
@ -1255,9 +1226,7 @@ static const UINT* g_mapTable[] =
|
||||
};
|
||||
|
||||
DWORD
|
||||
CMSWindowsSecondaryScreen::mapButton(
|
||||
ButtonID button,
|
||||
bool press) const
|
||||
CMSWindowsSecondaryScreen::mapButton(ButtonID button, bool press) const
|
||||
{
|
||||
// map button id to button flag
|
||||
switch (button) {
|
||||
@ -1276,12 +1245,8 @@ CMSWindowsSecondaryScreen::mapButton(
|
||||
}
|
||||
|
||||
KeyModifierMask
|
||||
CMSWindowsSecondaryScreen::mapKey(
|
||||
Keystrokes& keys,
|
||||
UINT& virtualKey,
|
||||
KeyID id,
|
||||
KeyModifierMask mask,
|
||||
EKeyAction action) const
|
||||
CMSWindowsSecondaryScreen::mapKey(Keystrokes& keys, UINT& virtualKey,
|
||||
KeyID id, KeyModifierMask mask, EKeyAction action) const
|
||||
{
|
||||
// lookup the key table
|
||||
const UInt32 mapID = ((id >> 8) & 0xff);
|
||||
@ -1597,9 +1562,7 @@ CMSWindowsSecondaryScreen::mapKey(
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsSecondaryScreen::doKeystrokes(
|
||||
const Keystrokes& keys,
|
||||
SInt32 count)
|
||||
CMSWindowsSecondaryScreen::doKeystrokes(const Keystrokes& keys, SInt32 count)
|
||||
{
|
||||
// do nothing if no keys or no repeats
|
||||
if (count < 1 || keys.empty()) {
|
||||
@ -1687,9 +1650,7 @@ CMSWindowsSecondaryScreen::updateModifiers()
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsSecondaryScreen::toggleKey(
|
||||
UINT virtualKey,
|
||||
KeyModifierMask mask)
|
||||
CMSWindowsSecondaryScreen::toggleKey(UINT virtualKey, KeyModifierMask mask)
|
||||
{
|
||||
// send key events to simulate a press and release
|
||||
sendKeyEvent(virtualKey, true);
|
||||
@ -1701,8 +1662,7 @@ CMSWindowsSecondaryScreen::toggleKey(
|
||||
}
|
||||
|
||||
UINT
|
||||
CMSWindowsSecondaryScreen::virtualKeyToScanCode(
|
||||
UINT& virtualKey)
|
||||
CMSWindowsSecondaryScreen::virtualKeyToScanCode(UINT& virtualKey)
|
||||
{
|
||||
// try mapping given virtual key
|
||||
UINT code = MapVirtualKey(virtualKey & 0xff, 0);
|
||||
@ -1754,8 +1714,7 @@ CMSWindowsSecondaryScreen::virtualKeyToScanCode(
|
||||
}
|
||||
|
||||
bool
|
||||
CMSWindowsSecondaryScreen::isExtendedKey(
|
||||
UINT virtualKey)
|
||||
CMSWindowsSecondaryScreen::isExtendedKey(UINT virtualKey)
|
||||
{
|
||||
// see if we've already encoded the extended flag
|
||||
if ((virtualKey & 0x100) != 0) {
|
||||
@ -1778,9 +1737,7 @@ CMSWindowsSecondaryScreen::isExtendedKey(
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsSecondaryScreen::sendKeyEvent(
|
||||
UINT virtualKey,
|
||||
bool press)
|
||||
CMSWindowsSecondaryScreen::sendKeyEvent(UINT virtualKey, bool press)
|
||||
{
|
||||
DWORD flags = 0;
|
||||
if (isExtendedKey(virtualKey)) {
|
||||
|
@ -72,8 +72,7 @@ CXWindowsSecondaryScreen::stop()
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsSecondaryScreen::open(
|
||||
CClient* client)
|
||||
CXWindowsSecondaryScreen::open(CClient* client)
|
||||
{
|
||||
assert(m_client == NULL);
|
||||
assert(client != NULL);
|
||||
@ -126,10 +125,7 @@ CXWindowsSecondaryScreen::close()
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsSecondaryScreen::enter(
|
||||
SInt32 x,
|
||||
SInt32 y,
|
||||
KeyModifierMask mask)
|
||||
CXWindowsSecondaryScreen::enter(SInt32 x, SInt32 y, KeyModifierMask mask)
|
||||
{
|
||||
assert(m_window != None);
|
||||
|
||||
@ -168,9 +164,7 @@ CXWindowsSecondaryScreen::leave()
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsSecondaryScreen::keyDown(
|
||||
KeyID key,
|
||||
KeyModifierMask mask)
|
||||
CXWindowsSecondaryScreen::keyDown(KeyID key, KeyModifierMask mask)
|
||||
{
|
||||
Keystrokes keys;
|
||||
KeyCode keycode;
|
||||
@ -190,10 +184,8 @@ CXWindowsSecondaryScreen::keyDown(
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsSecondaryScreen::keyRepeat(
|
||||
KeyID key,
|
||||
KeyModifierMask mask,
|
||||
SInt32 count)
|
||||
CXWindowsSecondaryScreen::keyRepeat(KeyID key,
|
||||
KeyModifierMask mask, SInt32 count)
|
||||
{
|
||||
Keystrokes keys;
|
||||
KeyCode keycode;
|
||||
@ -210,9 +202,7 @@ CXWindowsSecondaryScreen::keyRepeat(
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsSecondaryScreen::keyUp(
|
||||
KeyID key,
|
||||
KeyModifierMask mask)
|
||||
CXWindowsSecondaryScreen::keyUp(KeyID key, KeyModifierMask mask)
|
||||
{
|
||||
Keystrokes keys;
|
||||
KeyCode keycode;
|
||||
@ -232,8 +222,7 @@ CXWindowsSecondaryScreen::keyUp(
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsSecondaryScreen::mouseDown(
|
||||
ButtonID button)
|
||||
CXWindowsSecondaryScreen::mouseDown(ButtonID button)
|
||||
{
|
||||
CDisplayLock display(this);
|
||||
XTestFakeButtonEvent(display, mapButton(button), True, CurrentTime);
|
||||
@ -241,8 +230,7 @@ CXWindowsSecondaryScreen::mouseDown(
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsSecondaryScreen::mouseUp(
|
||||
ButtonID button)
|
||||
CXWindowsSecondaryScreen::mouseUp(ButtonID button)
|
||||
{
|
||||
CDisplayLock display(this);
|
||||
XTestFakeButtonEvent(display, mapButton(button), False, CurrentTime);
|
||||
@ -250,9 +238,7 @@ CXWindowsSecondaryScreen::mouseUp(
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsSecondaryScreen::mouseMove(
|
||||
SInt32 x,
|
||||
SInt32 y)
|
||||
CXWindowsSecondaryScreen::mouseMove(SInt32 x, SInt32 y)
|
||||
{
|
||||
CDisplayLock display(this);
|
||||
XTestFakeMotionEvent(display, getScreen(), x, y, CurrentTime);
|
||||
@ -260,8 +246,7 @@ CXWindowsSecondaryScreen::mouseMove(
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsSecondaryScreen::mouseWheel(
|
||||
SInt32 delta)
|
||||
CXWindowsSecondaryScreen::mouseWheel(SInt32 delta)
|
||||
{
|
||||
// choose button depending on rotation direction
|
||||
const unsigned int button = (delta >= 0) ? 4 : 5;
|
||||
@ -281,24 +266,20 @@ CXWindowsSecondaryScreen::mouseWheel(
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsSecondaryScreen::setClipboard(
|
||||
ClipboardID id,
|
||||
const IClipboard* clipboard)
|
||||
CXWindowsSecondaryScreen::setClipboard(ClipboardID id,
|
||||
const IClipboard* clipboard)
|
||||
{
|
||||
setDisplayClipboard(id, clipboard);
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsSecondaryScreen::grabClipboard(
|
||||
ClipboardID id)
|
||||
CXWindowsSecondaryScreen::grabClipboard(ClipboardID id)
|
||||
{
|
||||
setDisplayClipboard(id, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsSecondaryScreen::getMousePos(
|
||||
SInt32* x,
|
||||
SInt32* y) const
|
||||
CXWindowsSecondaryScreen::getMousePos(SInt32* x, SInt32* y) const
|
||||
{
|
||||
CDisplayLock display(this);
|
||||
int xTmp, yTmp, dummy;
|
||||
@ -311,9 +292,7 @@ CXWindowsSecondaryScreen::getMousePos(
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsSecondaryScreen::getSize(
|
||||
SInt32* width,
|
||||
SInt32* height) const
|
||||
CXWindowsSecondaryScreen::getSize(SInt32* width, SInt32* height) const
|
||||
{
|
||||
getScreenSize(width, height);
|
||||
}
|
||||
@ -325,16 +304,14 @@ CXWindowsSecondaryScreen::getJumpZoneSize() const
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsSecondaryScreen::getClipboard(
|
||||
ClipboardID id,
|
||||
IClipboard* clipboard) const
|
||||
CXWindowsSecondaryScreen::getClipboard(ClipboardID id,
|
||||
IClipboard* clipboard) const
|
||||
{
|
||||
getDisplayClipboard(id, clipboard);
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsSecondaryScreen::onOpenDisplay(
|
||||
Display* display)
|
||||
CXWindowsSecondaryScreen::onOpenDisplay(Display* display)
|
||||
{
|
||||
assert(m_window == None);
|
||||
|
||||
@ -362,16 +339,14 @@ CXWindowsSecondaryScreen::onOpenDisplay(
|
||||
}
|
||||
|
||||
CXWindowsClipboard*
|
||||
CXWindowsSecondaryScreen::createClipboard(
|
||||
ClipboardID id)
|
||||
CXWindowsSecondaryScreen::createClipboard(ClipboardID id)
|
||||
{
|
||||
CDisplayLock display(this);
|
||||
return new CXWindowsClipboard(display, m_window, id);
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsSecondaryScreen::onCloseDisplay(
|
||||
Display* display)
|
||||
CXWindowsSecondaryScreen::onCloseDisplay(Display* display)
|
||||
{
|
||||
assert(m_window != None);
|
||||
|
||||
@ -386,16 +361,14 @@ CXWindowsSecondaryScreen::onCloseDisplay(
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsSecondaryScreen::onLostClipboard(
|
||||
ClipboardID id)
|
||||
CXWindowsSecondaryScreen::onLostClipboard(ClipboardID id)
|
||||
{
|
||||
// tell client that the clipboard was grabbed locally
|
||||
m_client->onClipboardChanged(id);
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsSecondaryScreen::leaveNoLock(
|
||||
Display* display)
|
||||
CXWindowsSecondaryScreen::leaveNoLock(Display* display)
|
||||
{
|
||||
assert(display != NULL);
|
||||
assert(m_window != None);
|
||||
@ -417,20 +390,15 @@ CXWindowsSecondaryScreen::leaveNoLock(
|
||||
}
|
||||
|
||||
unsigned int
|
||||
CXWindowsSecondaryScreen::mapButton(
|
||||
ButtonID id) const
|
||||
CXWindowsSecondaryScreen::mapButton(ButtonID id) const
|
||||
{
|
||||
// FIXME -- should use button mapping?
|
||||
return static_cast<unsigned int>(id);
|
||||
}
|
||||
|
||||
KeyModifierMask
|
||||
CXWindowsSecondaryScreen::mapKey(
|
||||
Keystrokes& keys,
|
||||
KeyCode& keycode,
|
||||
KeyID id,
|
||||
KeyModifierMask mask,
|
||||
EKeyAction action) const
|
||||
CXWindowsSecondaryScreen::mapKey(Keystrokes& keys, KeyCode& keycode,
|
||||
KeyID id, KeyModifierMask mask, EKeyAction action) const
|
||||
{
|
||||
// note -- must have display locked on entry
|
||||
|
||||
@ -654,11 +622,8 @@ CXWindowsSecondaryScreen::mapKey(
|
||||
}
|
||||
|
||||
bool
|
||||
CXWindowsSecondaryScreen::findKeyCode(
|
||||
KeyCode& keycode,
|
||||
unsigned int& maskOut,
|
||||
KeyID id,
|
||||
unsigned int maskIn) const
|
||||
CXWindowsSecondaryScreen::findKeyCode(KeyCode& keycode,
|
||||
unsigned int& maskOut, KeyID id, unsigned int maskIn) const
|
||||
{
|
||||
// if XK_Tab is requested with shift active then try XK_ISO_Left_Tab
|
||||
// instead. if that doesn't work, we'll fall back to XK_Tab with
|
||||
@ -787,9 +752,7 @@ CXWindowsSecondaryScreen::findKeyCode(
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsSecondaryScreen::doKeystrokes(
|
||||
const Keystrokes& keys,
|
||||
SInt32 count)
|
||||
CXWindowsSecondaryScreen::doKeystrokes(const Keystrokes& keys, SInt32 count)
|
||||
{
|
||||
// do nothing if no keys or no repeats
|
||||
if (count < 1 || keys.empty()) {
|
||||
@ -830,8 +793,7 @@ CXWindowsSecondaryScreen::doKeystrokes(
|
||||
}
|
||||
|
||||
unsigned int
|
||||
CXWindowsSecondaryScreen::maskToX(
|
||||
KeyModifierMask inMask) const
|
||||
CXWindowsSecondaryScreen::maskToX(KeyModifierMask inMask) const
|
||||
{
|
||||
// FIXME -- should be configurable. also not using Mod3Mask.
|
||||
unsigned int outMask = 0;
|
||||
@ -860,8 +822,7 @@ CXWindowsSecondaryScreen::maskToX(
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsSecondaryScreen::updateKeys(
|
||||
Display* display)
|
||||
CXWindowsSecondaryScreen::updateKeys(Display* display)
|
||||
{
|
||||
// ask server which keys are pressed
|
||||
char keys[32];
|
||||
@ -881,8 +842,7 @@ CXWindowsSecondaryScreen::updateKeys(
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsSecondaryScreen::updateModifiers(
|
||||
Display* display)
|
||||
CXWindowsSecondaryScreen::updateModifiers(Display* display)
|
||||
{
|
||||
// query the pointer to get the keyboard state
|
||||
Window root, window;
|
||||
@ -911,8 +871,7 @@ CXWindowsSecondaryScreen::updateModifiers(
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsSecondaryScreen::updateKeycodeMap(
|
||||
Display* display)
|
||||
CXWindowsSecondaryScreen::updateKeycodeMap(Display* display)
|
||||
{
|
||||
// get the number of keycodes
|
||||
int minKeycode, maxKeycode;
|
||||
@ -966,8 +925,7 @@ CXWindowsSecondaryScreen::updateKeycodeMap(
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsSecondaryScreen::updateModifierMap(
|
||||
Display* display)
|
||||
CXWindowsSecondaryScreen::updateModifierMap(Display* display)
|
||||
{
|
||||
// get modifier map from server
|
||||
XModifierKeymap* keymap = XGetModifierMapping(display);
|
||||
@ -1022,10 +980,8 @@ CXWindowsSecondaryScreen::updateModifierMap(
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsSecondaryScreen::toggleKey(
|
||||
Display* display,
|
||||
KeySym keysym,
|
||||
unsigned int mask)
|
||||
CXWindowsSecondaryScreen::toggleKey(Display* display,
|
||||
KeySym keysym, unsigned int mask)
|
||||
{
|
||||
// lookup the keycode
|
||||
KeyCodeMap::const_iterator index = m_keycodeMap.find(keysym);
|
||||
@ -1051,8 +1007,7 @@ CXWindowsSecondaryScreen::toggleKey(
|
||||
}
|
||||
|
||||
bool
|
||||
CXWindowsSecondaryScreen::isToggleKeysym(
|
||||
KeySym key)
|
||||
CXWindowsSecondaryScreen::isToggleKeysym(KeySym key)
|
||||
{
|
||||
switch (key) {
|
||||
case XK_Caps_Lock:
|
||||
|
@ -44,8 +44,7 @@ static CMutex* s_logMutex = NULL;
|
||||
|
||||
static
|
||||
void
|
||||
logLock(
|
||||
bool lock)
|
||||
logLock(bool lock)
|
||||
{
|
||||
assert(s_logMutex != NULL);
|
||||
|
||||
@ -66,8 +65,7 @@ static CClient* s_client = NULL;
|
||||
|
||||
static
|
||||
int
|
||||
realMain(
|
||||
CMutex* mutex)
|
||||
realMain(CMutex* mutex)
|
||||
{
|
||||
try {
|
||||
// initialize threading library
|
||||
@ -242,12 +240,9 @@ PLATFORM_DESC
|
||||
|
||||
static
|
||||
bool
|
||||
isArg(int argi,
|
||||
int argc,
|
||||
const char** argv,
|
||||
const char* name1,
|
||||
const char* name2,
|
||||
int minRequiredParameters = 0)
|
||||
isArg(int argi, int argc, const char** argv,
|
||||
const char* name1, const char* name2,
|
||||
int minRequiredParameters = 0)
|
||||
{
|
||||
if ((name1 != NULL && strcmp(argv[argi], name1) == 0) ||
|
||||
(name2 != NULL && strcmp(argv[argi], name2) == 0)) {
|
||||
@ -266,9 +261,7 @@ isArg(int argi,
|
||||
|
||||
static
|
||||
void
|
||||
parse(
|
||||
int argc,
|
||||
const char** argv)
|
||||
parse(int argc, const char** argv)
|
||||
{
|
||||
assert(pname != NULL);
|
||||
assert(argv != NULL);
|
||||
@ -443,9 +436,7 @@ parse(
|
||||
|
||||
static
|
||||
bool
|
||||
logMessageBox(
|
||||
int priority,
|
||||
const char* msg)
|
||||
logMessageBox(int priority, const char* msg)
|
||||
{
|
||||
if (priority <= CLog::kFATAL) {
|
||||
MessageBox(NULL, msg, pname, MB_OK | MB_ICONWARNING);
|
||||
@ -472,10 +463,7 @@ daemonStop(void)
|
||||
|
||||
static
|
||||
int
|
||||
daemonStartup(
|
||||
IPlatform* iplatform,
|
||||
int argc,
|
||||
const char** argv)
|
||||
daemonStartup(IPlatform* iplatform, int argc, const char** argv)
|
||||
{
|
||||
// get platform pointer
|
||||
CWin32Platform* platform = static_cast<CWin32Platform*>(iplatform);
|
||||
@ -498,9 +486,7 @@ daemonStartup(
|
||||
|
||||
static
|
||||
bool
|
||||
logDiscard(
|
||||
int,
|
||||
const char*)
|
||||
logDiscard(int, const char*)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -520,11 +506,7 @@ checkParse(int e)
|
||||
}
|
||||
|
||||
int WINAPI
|
||||
WinMain(
|
||||
HINSTANCE instance,
|
||||
HINSTANCE,
|
||||
LPSTR,
|
||||
int)
|
||||
WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int)
|
||||
{
|
||||
CPlatform platform;
|
||||
|
||||
@ -656,18 +638,13 @@ WinMain(
|
||||
|
||||
static
|
||||
int
|
||||
daemonStartup(
|
||||
IPlatform*,
|
||||
int,
|
||||
const char**)
|
||||
daemonStartup(IPlatform*, int, const char**)
|
||||
{
|
||||
return restartableMain();
|
||||
}
|
||||
|
||||
int
|
||||
main(
|
||||
int argc,
|
||||
char** argv)
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
CPlatform platform;
|
||||
|
||||
|
@ -23,9 +23,7 @@ CHTTPRequest::~CHTTPRequest()
|
||||
}
|
||||
|
||||
void
|
||||
CHTTPRequest::insertHeader(
|
||||
const CString& name,
|
||||
const CString& value)
|
||||
CHTTPRequest::insertHeader(const CString& name, const CString& value)
|
||||
{
|
||||
CHeaderMap::iterator index = m_headerByName.find(name);
|
||||
if (index != m_headerByName.end()) {
|
||||
@ -39,9 +37,7 @@ CHTTPRequest::insertHeader(
|
||||
}
|
||||
|
||||
void
|
||||
CHTTPRequest::appendHeader(
|
||||
const CString& name,
|
||||
const CString& value)
|
||||
CHTTPRequest::appendHeader(const CString& name, const CString& value)
|
||||
{
|
||||
CHeaderMap::iterator index = m_headerByName.find(name);
|
||||
if (index != m_headerByName.end()) {
|
||||
@ -56,8 +52,7 @@ CHTTPRequest::appendHeader(
|
||||
}
|
||||
|
||||
void
|
||||
CHTTPRequest::eraseHeader(
|
||||
const CString& name)
|
||||
CHTTPRequest::eraseHeader(const CString& name)
|
||||
{
|
||||
CHeaderMap::iterator index = m_headerByName.find(name);
|
||||
if (index != m_headerByName.end()) {
|
||||
@ -66,15 +61,13 @@ CHTTPRequest::eraseHeader(
|
||||
}
|
||||
|
||||
bool
|
||||
CHTTPRequest::isHeader(
|
||||
const CString& name) const
|
||||
CHTTPRequest::isHeader(const CString& name) const
|
||||
{
|
||||
return (m_headerByName.find(name) != m_headerByName.end());
|
||||
}
|
||||
|
||||
CString
|
||||
CHTTPRequest::getHeader(
|
||||
const CString& name) const
|
||||
CHTTPRequest::getHeader(const CString& name) const
|
||||
{
|
||||
CHeaderMap::const_iterator index = m_headerByName.find(name);
|
||||
if (index != m_headerByName.end()) {
|
||||
@ -91,9 +84,7 @@ CHTTPRequest::getHeader(
|
||||
//
|
||||
|
||||
CHTTPRequest*
|
||||
CHTTPProtocol::readRequest(
|
||||
IInputStream* stream,
|
||||
UInt32 maxSize)
|
||||
CHTTPProtocol::readRequest(IInputStream* stream, UInt32 maxSize)
|
||||
{
|
||||
CString scratch;
|
||||
|
||||
@ -241,9 +232,7 @@ CHTTPProtocol::readRequest(
|
||||
}
|
||||
|
||||
void
|
||||
CHTTPProtocol::reply(
|
||||
IOutputStream* stream,
|
||||
CHTTPReply& reply)
|
||||
CHTTPProtocol::reply(IOutputStream* stream, CHTTPReply& reply)
|
||||
{
|
||||
// suppress body for certain replies
|
||||
bool hasBody = true;
|
||||
@ -321,9 +310,7 @@ CHTTPProtocol::reply(
|
||||
}
|
||||
|
||||
bool
|
||||
CHTTPProtocol::parseFormData(
|
||||
const CHTTPRequest& request,
|
||||
CFormParts& parts)
|
||||
CHTTPProtocol::parseFormData(const CHTTPRequest& request, CFormParts& parts)
|
||||
{
|
||||
static const char formData[] = "multipart/form-data";
|
||||
static const char boundary[] = "boundary=";
|
||||
@ -458,9 +445,7 @@ CHTTPProtocol::parseFormData(
|
||||
}
|
||||
|
||||
CString
|
||||
CHTTPProtocol::readLine(
|
||||
IInputStream* stream,
|
||||
CString& tmpBuffer)
|
||||
CHTTPProtocol::readLine(IInputStream* stream, CString& tmpBuffer)
|
||||
{
|
||||
// read up to and including a CRLF from stream, using whatever
|
||||
// is in tmpBuffer as if it were at the head of the stream.
|
||||
@ -493,10 +478,8 @@ CHTTPProtocol::readLine(
|
||||
}
|
||||
|
||||
CString
|
||||
CHTTPProtocol::readBlock(
|
||||
IInputStream* stream,
|
||||
UInt32 numBytes,
|
||||
CString& tmpBuffer)
|
||||
CHTTPProtocol::readBlock(IInputStream* stream,
|
||||
UInt32 numBytes, CString& tmpBuffer)
|
||||
{
|
||||
CString data;
|
||||
|
||||
@ -543,10 +526,8 @@ CHTTPProtocol::readBlock(
|
||||
}
|
||||
|
||||
CString
|
||||
CHTTPProtocol::readChunk(
|
||||
IInputStream* stream,
|
||||
CString& tmpBuffer,
|
||||
UInt32* maxSize)
|
||||
CHTTPProtocol::readChunk(IInputStream* stream,
|
||||
CString& tmpBuffer, UInt32* maxSize)
|
||||
{
|
||||
CString line;
|
||||
|
||||
@ -594,12 +575,9 @@ CHTTPProtocol::readChunk(
|
||||
}
|
||||
|
||||
void
|
||||
CHTTPProtocol::readHeaders(
|
||||
IInputStream* stream,
|
||||
CHTTPRequest* request,
|
||||
bool isFooter,
|
||||
CString& tmpBuffer,
|
||||
UInt32* maxSize)
|
||||
CHTTPProtocol::readHeaders(IInputStream* stream,
|
||||
CHTTPRequest* request, bool isFooter,
|
||||
CString& tmpBuffer, UInt32* maxSize)
|
||||
{
|
||||
// parse headers. done with headers when we get a blank line.
|
||||
CString name;
|
||||
@ -652,8 +630,7 @@ CHTTPProtocol::readHeaders(
|
||||
}
|
||||
|
||||
bool
|
||||
CHTTPProtocol::isValidToken(
|
||||
const CString& token)
|
||||
CHTTPProtocol::isValidToken(const CString& token)
|
||||
{
|
||||
return (token.find("()<>@,;:\\\"/[]?={} "
|
||||
"\0\1\2\3\4\5\6\7"
|
||||
|
@ -6,8 +6,7 @@
|
||||
// XHTTP
|
||||
//
|
||||
|
||||
XHTTP::XHTTP(
|
||||
SInt32 statusCode) :
|
||||
XHTTP::XHTTP(SInt32 statusCode) :
|
||||
XBase(),
|
||||
m_status(statusCode),
|
||||
m_reason(getReason(statusCode))
|
||||
@ -15,9 +14,7 @@ XHTTP::XHTTP(
|
||||
// do nothing
|
||||
}
|
||||
|
||||
XHTTP::XHTTP(
|
||||
SInt32 statusCode,
|
||||
const CString& reasonPhrase) :
|
||||
XHTTP::XHTTP(SInt32 statusCode, const CString& reasonPhrase) :
|
||||
XBase(),
|
||||
m_status(statusCode),
|
||||
m_reason(reasonPhrase)
|
||||
@ -43,8 +40,7 @@ XHTTP::getReason() const
|
||||
}
|
||||
|
||||
void
|
||||
XHTTP::addHeaders(
|
||||
CHTTPReply&) const
|
||||
XHTTP::addHeaders(CHTTPReply&) const
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
@ -69,8 +65,7 @@ XHTTP::getWhat() const throw()
|
||||
}
|
||||
|
||||
const char*
|
||||
XHTTP::getReason(
|
||||
SInt32 status)
|
||||
XHTTP::getReason(SInt32 status)
|
||||
{
|
||||
switch (status) {
|
||||
case 300: return "Multiple Choices";
|
||||
@ -110,8 +105,7 @@ XHTTP::getReason(
|
||||
// XHTTPAllow
|
||||
//
|
||||
|
||||
XHTTPAllow::XHTTPAllow(
|
||||
const CString& allowed) :
|
||||
XHTTPAllow::XHTTPAllow(const CString& allowed) :
|
||||
XHTTP(405),
|
||||
m_allowed(allowed)
|
||||
{
|
||||
@ -124,8 +118,7 @@ XHTTPAllow::~XHTTPAllow()
|
||||
}
|
||||
|
||||
void
|
||||
XHTTPAllow::addHeaders(
|
||||
CHTTPReply& reply) const
|
||||
XHTTPAllow::addHeaders(CHTTPReply& reply) const
|
||||
{
|
||||
reply.m_headers.push_back(std::make_pair(CString("Allow"), m_allowed));
|
||||
}
|
||||
|
@ -10,9 +10,7 @@
|
||||
// CBufferedInputStream
|
||||
//
|
||||
|
||||
CBufferedInputStream::CBufferedInputStream(
|
||||
CMutex* mutex,
|
||||
IJob* closeCB) :
|
||||
CBufferedInputStream::CBufferedInputStream(CMutex* mutex, IJob* closeCB) :
|
||||
m_mutex(mutex),
|
||||
m_empty(mutex, true),
|
||||
m_closeCB(closeCB),
|
||||
@ -28,9 +26,7 @@ CBufferedInputStream::~CBufferedInputStream()
|
||||
}
|
||||
|
||||
void
|
||||
CBufferedInputStream::write(
|
||||
const void* data,
|
||||
UInt32 n)
|
||||
CBufferedInputStream::write(const void* data, UInt32 n)
|
||||
{
|
||||
if (!m_hungup && n > 0) {
|
||||
m_buffer.write(data, n);
|
||||
@ -47,9 +43,7 @@ CBufferedInputStream::hangup()
|
||||
}
|
||||
|
||||
UInt32
|
||||
CBufferedInputStream::readNoLock(
|
||||
void* dst,
|
||||
UInt32 n)
|
||||
CBufferedInputStream::readNoLock(void* dst, UInt32 n)
|
||||
{
|
||||
if (m_closed) {
|
||||
throw XIOClosed();
|
||||
@ -104,9 +98,7 @@ CBufferedInputStream::close()
|
||||
}
|
||||
|
||||
UInt32
|
||||
CBufferedInputStream::read(
|
||||
void* dst,
|
||||
UInt32 n)
|
||||
CBufferedInputStream::read(void* dst, UInt32 n)
|
||||
{
|
||||
CLock lock(m_mutex);
|
||||
return readNoLock(dst, n);
|
||||
|
@ -9,9 +9,7 @@
|
||||
// CBufferedOutputStream
|
||||
//
|
||||
|
||||
CBufferedOutputStream::CBufferedOutputStream(
|
||||
CMutex* mutex,
|
||||
IJob* closeCB) :
|
||||
CBufferedOutputStream::CBufferedOutputStream(CMutex* mutex, IJob* closeCB) :
|
||||
m_mutex(mutex),
|
||||
m_closeCB(closeCB),
|
||||
m_empty(mutex, true),
|
||||
@ -26,15 +24,13 @@ CBufferedOutputStream::~CBufferedOutputStream()
|
||||
}
|
||||
|
||||
const void*
|
||||
CBufferedOutputStream::peek(
|
||||
UInt32 n)
|
||||
CBufferedOutputStream::peek(UInt32 n)
|
||||
{
|
||||
return m_buffer.peek(n);
|
||||
}
|
||||
|
||||
void
|
||||
CBufferedOutputStream::pop(
|
||||
UInt32 n)
|
||||
CBufferedOutputStream::pop(UInt32 n)
|
||||
{
|
||||
m_buffer.pop(n);
|
||||
if (m_buffer.getSize() == 0) {
|
||||
@ -64,9 +60,7 @@ CBufferedOutputStream::close()
|
||||
}
|
||||
|
||||
UInt32
|
||||
CBufferedOutputStream::write(
|
||||
const void* data,
|
||||
UInt32 n)
|
||||
CBufferedOutputStream::write(const void* data, UInt32 n)
|
||||
{
|
||||
CLock lock(m_mutex);
|
||||
if (m_closed) {
|
||||
|
@ -4,9 +4,7 @@
|
||||
// CInputStreamFilter
|
||||
//
|
||||
|
||||
CInputStreamFilter::CInputStreamFilter(
|
||||
IInputStream* stream,
|
||||
bool adopted) :
|
||||
CInputStreamFilter::CInputStreamFilter(IInputStream* stream, bool adopted) :
|
||||
m_stream(stream),
|
||||
m_adopted(adopted)
|
||||
{
|
||||
|
@ -4,9 +4,7 @@
|
||||
// COutputStreamFilter
|
||||
//
|
||||
|
||||
COutputStreamFilter::COutputStreamFilter(
|
||||
IOutputStream* stream,
|
||||
bool adopted) :
|
||||
COutputStreamFilter::COutputStreamFilter(IOutputStream* stream, bool adopted) :
|
||||
m_stream(stream),
|
||||
m_adopted(adopted)
|
||||
{
|
||||
|
@ -19,8 +19,7 @@ CStreamBuffer::~CStreamBuffer()
|
||||
}
|
||||
|
||||
const void*
|
||||
CStreamBuffer::peek(
|
||||
UInt32 n)
|
||||
CStreamBuffer::peek(UInt32 n)
|
||||
{
|
||||
assert(n <= m_size);
|
||||
|
||||
@ -40,8 +39,7 @@ CStreamBuffer::peek(
|
||||
}
|
||||
|
||||
void
|
||||
CStreamBuffer::pop(
|
||||
UInt32 n)
|
||||
CStreamBuffer::pop(UInt32 n)
|
||||
{
|
||||
// discard all chunks if n is greater than or equal to m_size
|
||||
if (n >= m_size) {
|
||||
@ -71,9 +69,7 @@ CStreamBuffer::pop(
|
||||
}
|
||||
|
||||
void
|
||||
CStreamBuffer::write(
|
||||
const void* vdata,
|
||||
UInt32 n)
|
||||
CStreamBuffer::write(const void* vdata, UInt32 n)
|
||||
{
|
||||
assert(vdata != NULL);
|
||||
|
||||
|
@ -87,9 +87,7 @@ CCondVarBase::broadcast()
|
||||
}
|
||||
|
||||
bool
|
||||
CCondVarBase::wait(
|
||||
CStopwatch& timer,
|
||||
double timeout) const
|
||||
CCondVarBase::wait(CStopwatch& timer, double timeout) const
|
||||
{
|
||||
// check timeout against timer
|
||||
if (timeout >= 0.0) {
|
||||
@ -245,9 +243,7 @@ CCondVarBase::broadcast()
|
||||
}
|
||||
|
||||
bool
|
||||
CCondVarBase::wait(
|
||||
CStopwatch& timer,
|
||||
double timeout) const
|
||||
CCondVarBase::wait(CStopwatch& timer, double timeout) const
|
||||
{
|
||||
// check timeout against timer
|
||||
if (timeout >= 0.0) {
|
||||
|
@ -21,8 +21,7 @@ CMutex::~CMutex()
|
||||
}
|
||||
|
||||
CMutex&
|
||||
CMutex::operator=(
|
||||
const CMutex&)
|
||||
CMutex::operator=(const CMutex&)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
@ -32,8 +32,7 @@ CThread::~CThread()
|
||||
}
|
||||
|
||||
CThread&
|
||||
CThread::operator=(
|
||||
const CThread& thread)
|
||||
CThread::operator=(const CThread& thread)
|
||||
{
|
||||
if (thread.m_rep != m_rep) {
|
||||
m_rep->unref();
|
||||
@ -50,8 +49,7 @@ CThread::init()
|
||||
}
|
||||
|
||||
void
|
||||
CThread::sleep(
|
||||
double timeout)
|
||||
CThread::sleep(double timeout)
|
||||
{
|
||||
CThreadPtr currentRep(CThreadRep::getCurrentThreadRep());
|
||||
if (timeout >= 0.0) {
|
||||
@ -62,8 +60,7 @@ CThread::sleep(
|
||||
}
|
||||
|
||||
void
|
||||
CThread::exit(
|
||||
void* result)
|
||||
CThread::exit(void* result)
|
||||
{
|
||||
CThreadPtr currentRep(CThreadRep::getCurrentThreadRep());
|
||||
log((CLOG_DEBUG1 "throw exit on thread %p", currentRep.operator->()));
|
||||
@ -71,8 +68,7 @@ CThread::exit(
|
||||
}
|
||||
|
||||
bool
|
||||
CThread::enableCancel(
|
||||
bool enable)
|
||||
CThread::enableCancel(bool enable)
|
||||
{
|
||||
CThreadPtr currentRep(CThreadRep::getCurrentThreadRep());
|
||||
return currentRep->enableCancel(enable);
|
||||
@ -85,8 +81,7 @@ CThread::cancel()
|
||||
}
|
||||
|
||||
void
|
||||
CThread::setPriority(
|
||||
int n)
|
||||
CThread::setPriority(int n)
|
||||
{
|
||||
m_rep->setPriority(n);
|
||||
}
|
||||
@ -98,8 +93,7 @@ CThread::getCurrentThread()
|
||||
}
|
||||
|
||||
bool
|
||||
CThread::wait(
|
||||
double timeout) const
|
||||
CThread::wait(double timeout) const
|
||||
{
|
||||
CThreadPtr currentRep(CThreadRep::getCurrentThreadRep());
|
||||
return currentRep->wait(m_rep, timeout);
|
||||
@ -107,8 +101,7 @@ CThread::wait(
|
||||
|
||||
#if defined(CONFIG_PLATFORM_WIN32)
|
||||
bool
|
||||
CThread::waitForEvent(
|
||||
double timeout)
|
||||
CThread::waitForEvent(double timeout)
|
||||
{
|
||||
CThreadPtr currentRep(CThreadRep::getCurrentThreadRep());
|
||||
return currentRep->waitForEvent(timeout);
|
||||
@ -139,15 +132,13 @@ CThread::getUserData()
|
||||
}
|
||||
|
||||
bool
|
||||
CThread::operator==(
|
||||
const CThread& thread) const
|
||||
CThread::operator==(const CThread& thread) const
|
||||
{
|
||||
return (m_rep == thread.m_rep);
|
||||
}
|
||||
|
||||
bool
|
||||
CThread::operator!=(
|
||||
const CThread& thread) const
|
||||
CThread::operator!=(const CThread& thread) const
|
||||
{
|
||||
return (m_rep != thread.m_rep);
|
||||
}
|
||||
|
@ -402,9 +402,7 @@ CThreadRep::testCancel()
|
||||
}
|
||||
|
||||
bool
|
||||
CThreadRep::wait(
|
||||
CThreadRep* target,
|
||||
double timeout)
|
||||
CThreadRep::wait(CThreadRep* target, double timeout)
|
||||
{
|
||||
if (target == this) {
|
||||
return false;
|
||||
@ -430,8 +428,7 @@ CThreadRep::wait(
|
||||
}
|
||||
|
||||
void
|
||||
CThreadRep::setPriority(
|
||||
int)
|
||||
CThreadRep::setPriority(int)
|
||||
{
|
||||
// FIXME
|
||||
}
|
||||
@ -468,15 +465,13 @@ CThreadRep::threadFunc(void* arg)
|
||||
}
|
||||
|
||||
void
|
||||
CThreadRep::threadCancel(
|
||||
int)
|
||||
CThreadRep::threadCancel(int)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
void*
|
||||
CThreadRep::threadSignalHandler(
|
||||
void* vrep)
|
||||
CThreadRep::threadSignalHandler(void* vrep)
|
||||
{
|
||||
CThreadRep* mainThreadRep = reinterpret_cast<CThreadRep*>(vrep);
|
||||
|
||||
@ -567,9 +562,7 @@ CThreadRep::testCancel()
|
||||
}
|
||||
|
||||
bool
|
||||
CThreadRep::wait(
|
||||
CThreadRep* target,
|
||||
double timeout)
|
||||
CThreadRep::wait(CThreadRep* target, double timeout)
|
||||
{
|
||||
// get the current thread. if it's the same as the target thread
|
||||
// then the thread is waiting on itself.
|
||||
@ -620,8 +613,7 @@ CThreadRep::wait(
|
||||
}
|
||||
|
||||
bool
|
||||
CThreadRep::waitForEvent(
|
||||
double timeout)
|
||||
CThreadRep::waitForEvent(double timeout)
|
||||
{
|
||||
// is cancellation enabled?
|
||||
const DWORD n = (isCancellable() ? 1 : 0);
|
||||
@ -658,8 +650,7 @@ CThreadRep::waitForEvent(
|
||||
}
|
||||
|
||||
void
|
||||
CThreadRep::setPriority(
|
||||
int n)
|
||||
CThreadRep::setPriority(int n)
|
||||
{
|
||||
DWORD pClass = NORMAL_PRIORITY_CLASS;
|
||||
if (n < 0) {
|
||||
@ -705,8 +696,7 @@ CThreadRep::getCancelEvent() const
|
||||
}
|
||||
|
||||
unsigned int __stdcall
|
||||
CThreadRep::threadFunc(
|
||||
void* arg)
|
||||
CThreadRep::threadFunc(void* arg)
|
||||
{
|
||||
CThreadRep* rep = (CThreadRep*)arg;
|
||||
|
||||
|
@ -33,8 +33,7 @@ CTimerThread::~CTimerThread()
|
||||
}
|
||||
|
||||
void
|
||||
CTimerThread::timer(
|
||||
void*)
|
||||
CTimerThread::timer(void*)
|
||||
{
|
||||
log((CLOG_DEBUG1 "timeout in %f seconds", m_timeout));
|
||||
CThread::sleep(m_timeout);
|
||||
|
@ -52,9 +52,7 @@ static HMODULE s_networkModule = NULL;
|
||||
|
||||
static
|
||||
FARPROC
|
||||
netGetProcAddress(
|
||||
HMODULE module,
|
||||
LPCSTR name)
|
||||
netGetProcAddress(HMODULE module, LPCSTR name)
|
||||
{
|
||||
FARPROC func = ::GetProcAddress(module, name);
|
||||
if (!func) {
|
||||
@ -116,8 +114,7 @@ CNetwork::cleanup()
|
||||
}
|
||||
|
||||
UInt32
|
||||
CNetwork::swaphtonl(
|
||||
UInt32 v)
|
||||
CNetwork::swaphtonl(UInt32 v)
|
||||
{
|
||||
static const union { UInt16 s; UInt8 b[2]; } s_endian = { 0x1234 };
|
||||
if (s_endian.b[0] == 0x34) {
|
||||
@ -132,8 +129,7 @@ CNetwork::swaphtonl(
|
||||
}
|
||||
|
||||
UInt16
|
||||
CNetwork::swaphtons(
|
||||
UInt16 v)
|
||||
CNetwork::swaphtons(UInt16 v)
|
||||
{
|
||||
static const union { UInt16 s; UInt8 b[2]; } s_endian = { 0x1234 };
|
||||
if (s_endian.b[0] == 0x34) {
|
||||
@ -146,15 +142,13 @@ CNetwork::swaphtons(
|
||||
}
|
||||
|
||||
UInt32
|
||||
CNetwork::swapntohl(
|
||||
UInt32 v)
|
||||
CNetwork::swapntohl(UInt32 v)
|
||||
{
|
||||
return swaphtonl(v);
|
||||
}
|
||||
|
||||
UInt16
|
||||
CNetwork::swapntohs(
|
||||
UInt16 v)
|
||||
CNetwork::swapntohs(UInt16 v)
|
||||
{
|
||||
return swaphtons(v);
|
||||
}
|
||||
@ -221,10 +215,7 @@ CNetwork::init2(
|
||||
}
|
||||
|
||||
int PASCAL FAR
|
||||
CNetwork::poll2(
|
||||
PollEntry fd[],
|
||||
int nfds,
|
||||
int timeout)
|
||||
CNetwork::poll2(PollEntry fd[], int nfds, int timeout)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -293,19 +284,13 @@ CNetwork::poll2(
|
||||
}
|
||||
|
||||
ssize_t PASCAL FAR
|
||||
CNetwork::read2(
|
||||
Socket s,
|
||||
void FAR* buf,
|
||||
size_t len)
|
||||
CNetwork::read2(Socket s, void FAR* buf, size_t len)
|
||||
{
|
||||
return recv(s, buf, len, 0);
|
||||
}
|
||||
|
||||
ssize_t PASCAL FAR
|
||||
CNetwork::write2(
|
||||
Socket s,
|
||||
const void FAR* buf,
|
||||
size_t len)
|
||||
CNetwork::write2(Socket s, const void FAR* buf, size_t len)
|
||||
{
|
||||
return send(s, buf, len, 0);
|
||||
}
|
||||
@ -323,29 +308,25 @@ CNetwork::write2(
|
||||
#define setfunc(var, name, type) var = (type)::name
|
||||
|
||||
UInt32
|
||||
CNetwork::swaphtonl(
|
||||
UInt32 v)
|
||||
CNetwork::swaphtonl(UInt32 v)
|
||||
{
|
||||
return htonl(v);
|
||||
}
|
||||
|
||||
UInt16
|
||||
CNetwork::swaphtons(
|
||||
UInt16 v)
|
||||
CNetwork::swaphtons(UInt16 v)
|
||||
{
|
||||
return htons(v);
|
||||
}
|
||||
|
||||
UInt32
|
||||
CNetwork::swapntohl(
|
||||
UInt32 v)
|
||||
CNetwork::swapntohl(UInt32 v)
|
||||
{
|
||||
return ntohl(v);
|
||||
}
|
||||
|
||||
UInt16
|
||||
CNetwork::swapntohs(
|
||||
UInt16 v)
|
||||
CNetwork::swapntohs(UInt16 v)
|
||||
{
|
||||
return ntohs(v);
|
||||
}
|
||||
@ -366,9 +347,7 @@ myherrno()
|
||||
|
||||
static
|
||||
int
|
||||
mygethostname(
|
||||
char* name,
|
||||
int namelen)
|
||||
mygethostname(char* name, int namelen)
|
||||
{
|
||||
return gethostname(name, namelen);
|
||||
}
|
||||
|
@ -21,8 +21,7 @@ CNetworkAddress::CNetworkAddress() :
|
||||
memset(inetAddress->sin_zero, 0, sizeof(inetAddress->sin_zero));
|
||||
}
|
||||
|
||||
CNetworkAddress::CNetworkAddress(
|
||||
UInt16 port) :
|
||||
CNetworkAddress::CNetworkAddress(UInt16 port) :
|
||||
m_port(port)
|
||||
{
|
||||
if (port == 0) {
|
||||
@ -37,9 +36,7 @@ CNetworkAddress::CNetworkAddress(
|
||||
memset(inetAddress->sin_zero, 0, sizeof(inetAddress->sin_zero));
|
||||
}
|
||||
|
||||
CNetworkAddress::CNetworkAddress(
|
||||
const CString& hostname_,
|
||||
UInt16 port) :
|
||||
CNetworkAddress::CNetworkAddress(const CString& hostname_, UInt16 port) :
|
||||
m_hostname(hostname_),
|
||||
m_port(port)
|
||||
{
|
||||
|
@ -28,8 +28,7 @@ CTCPListenSocket::~CTCPListenSocket()
|
||||
}
|
||||
|
||||
void
|
||||
CTCPListenSocket::bind(
|
||||
const CNetworkAddress& addr)
|
||||
CTCPListenSocket::bind(const CNetworkAddress& addr)
|
||||
{
|
||||
if (CNetwork::bind(m_fd, addr.getAddress(),
|
||||
addr.getAddressLength()) == CNetwork::Error) {
|
||||
|
@ -55,8 +55,7 @@ CTCPSocket::~CTCPSocket()
|
||||
}
|
||||
|
||||
void
|
||||
CTCPSocket::bind(
|
||||
const CNetworkAddress& addr)
|
||||
CTCPSocket::bind(const CNetworkAddress& addr)
|
||||
{
|
||||
if (CNetwork::bind(m_fd, addr.getAddress(),
|
||||
addr.getAddressLength()) == CNetwork::Error) {
|
||||
@ -108,8 +107,7 @@ CTCPSocket::close()
|
||||
}
|
||||
|
||||
void
|
||||
CTCPSocket::connect(
|
||||
const CNetworkAddress& addr)
|
||||
CTCPSocket::connect(const CNetworkAddress& addr)
|
||||
{
|
||||
CThread::testCancel();
|
||||
if (CNetwork::connect(m_fd, addr.getAddress(),
|
||||
|
@ -26,9 +26,7 @@ XNetworkFailed::getWhat() const throw()
|
||||
// XNetworkVersion
|
||||
//
|
||||
|
||||
XNetworkVersion::XNetworkVersion(
|
||||
int major,
|
||||
int minor) throw() :
|
||||
XNetworkVersion::XNetworkVersion(int major, int minor) throw() :
|
||||
m_major(major),
|
||||
m_minor(minor)
|
||||
{
|
||||
@ -61,7 +59,7 @@ XNetworkVersion::getWhat() const throw()
|
||||
//
|
||||
|
||||
XNetworkFunctionUnavailable::XNetworkFunctionUnavailable(
|
||||
const char* name) throw()
|
||||
const char* name) throw()
|
||||
{
|
||||
try {
|
||||
m_name = name;
|
||||
|
@ -4,10 +4,8 @@
|
||||
// XSocketAddress
|
||||
//
|
||||
|
||||
XSocketAddress::XSocketAddress(
|
||||
Error error,
|
||||
const CString& hostname,
|
||||
UInt16 port) throw() :
|
||||
XSocketAddress::XSocketAddress(Error error,
|
||||
const CString& hostname, UInt16 port) throw() :
|
||||
m_error(error),
|
||||
m_hostname(hostname),
|
||||
m_port(port)
|
||||
@ -55,8 +53,7 @@ XSocketErrno::XSocketErrno() :
|
||||
// do nothing
|
||||
}
|
||||
|
||||
XSocketErrno::XSocketErrno(
|
||||
int err) :
|
||||
XSocketErrno::XSocketErrno(int err) :
|
||||
MXErrno(err)
|
||||
{
|
||||
// do nothing
|
||||
|
@ -5,8 +5,7 @@
|
||||
// CMSWindowsClipboard
|
||||
//
|
||||
|
||||
CMSWindowsClipboard::CMSWindowsClipboard(
|
||||
HWND window) :
|
||||
CMSWindowsClipboard::CMSWindowsClipboard(HWND window) :
|
||||
m_window(window),
|
||||
m_time(0)
|
||||
{
|
||||
@ -32,9 +31,7 @@ CMSWindowsClipboard::empty()
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsClipboard::add(
|
||||
EFormat format,
|
||||
const CString& data)
|
||||
CMSWindowsClipboard::add(EFormat format, const CString& data)
|
||||
{
|
||||
log((CLOG_DEBUG "add %d bytes to clipboard format: %d", data.size(), format));
|
||||
|
||||
@ -58,8 +55,7 @@ CMSWindowsClipboard::add(
|
||||
}
|
||||
|
||||
bool
|
||||
CMSWindowsClipboard::open(
|
||||
Time time) const
|
||||
CMSWindowsClipboard::open(Time time) const
|
||||
{
|
||||
log((CLOG_DEBUG "open clipboard"));
|
||||
|
||||
@ -87,16 +83,14 @@ CMSWindowsClipboard::getTime() const
|
||||
}
|
||||
|
||||
bool
|
||||
CMSWindowsClipboard::has(
|
||||
EFormat format) const
|
||||
CMSWindowsClipboard::has(EFormat format) const
|
||||
{
|
||||
const UINT win32Format = convertFormatToWin32(format);
|
||||
return (win32Format != 0 && IsClipboardFormatAvailable(win32Format) != 0);
|
||||
}
|
||||
|
||||
CString
|
||||
CMSWindowsClipboard::get(
|
||||
EFormat format) const
|
||||
CMSWindowsClipboard::get(EFormat format) const
|
||||
{
|
||||
// get the win32 format. return empty data if unknown format.
|
||||
const UINT win32Format = convertFormatToWin32(format);
|
||||
@ -119,8 +113,7 @@ CMSWindowsClipboard::get(
|
||||
}
|
||||
|
||||
UINT
|
||||
CMSWindowsClipboard::convertFormatToWin32(
|
||||
EFormat format) const
|
||||
CMSWindowsClipboard::convertFormatToWin32(EFormat format) const
|
||||
{
|
||||
switch (format) {
|
||||
case kText:
|
||||
@ -132,8 +125,7 @@ CMSWindowsClipboard::convertFormatToWin32(
|
||||
}
|
||||
|
||||
HANDLE
|
||||
CMSWindowsClipboard::convertTextToWin32(
|
||||
const CString& data) const
|
||||
CMSWindowsClipboard::convertTextToWin32(const CString& data) const
|
||||
{
|
||||
// compute size of converted text
|
||||
UInt32 dstSize = 1;
|
||||
@ -172,8 +164,7 @@ CMSWindowsClipboard::convertTextToWin32(
|
||||
}
|
||||
|
||||
CString
|
||||
CMSWindowsClipboard::convertTextFromWin32(
|
||||
HANDLE handle) const
|
||||
CMSWindowsClipboard::convertTextFromWin32(HANDLE handle) const
|
||||
{
|
||||
// get source data and it's size
|
||||
const char* src = (const char*)GlobalLock(handle);
|
||||
|
@ -30,8 +30,7 @@ CMSWindowsScreen::~CMSWindowsScreen()
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsScreen::init(
|
||||
HINSTANCE instance)
|
||||
CMSWindowsScreen::init(HINSTANCE instance)
|
||||
{
|
||||
s_instance = instance;
|
||||
}
|
||||
@ -151,9 +150,7 @@ CMSWindowsScreen::updateScreenSize()
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsScreen::getScreenSize(
|
||||
SInt32* w,
|
||||
SInt32* h) const
|
||||
CMSWindowsScreen::getScreenSize(SInt32* w, SInt32* h) const
|
||||
{
|
||||
assert(m_class != 0);
|
||||
assert(w != NULL && h != NULL);
|
||||
@ -172,8 +169,7 @@ CMSWindowsScreen::openInputDesktop() const
|
||||
}
|
||||
|
||||
CString
|
||||
CMSWindowsScreen::getDesktopName(
|
||||
HDESK desk) const
|
||||
CMSWindowsScreen::getDesktopName(HDESK desk) const
|
||||
{
|
||||
if (desk == NULL) {
|
||||
return CString();
|
||||
@ -190,16 +186,14 @@ CMSWindowsScreen::getDesktopName(
|
||||
}
|
||||
|
||||
bool
|
||||
CMSWindowsScreen::isCurrentDesktop(
|
||||
HDESK desk) const
|
||||
CMSWindowsScreen::isCurrentDesktop(HDESK desk) const
|
||||
{
|
||||
return CStringUtil::CaselessCmp::equal(getDesktopName(desk),
|
||||
getCurrentDesktopName());
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsScreen::getEvent(
|
||||
MSG* msg) const
|
||||
CMSWindowsScreen::getEvent(MSG* msg) const
|
||||
{
|
||||
// wait for an event in a cancellable way
|
||||
CThread::waitForEvent();
|
||||
@ -207,11 +201,7 @@ CMSWindowsScreen::getEvent(
|
||||
}
|
||||
|
||||
LRESULT CALLBACK
|
||||
CMSWindowsScreen::wndProc(
|
||||
HWND hwnd,
|
||||
UINT msg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
CMSWindowsScreen::wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
assert(s_screen != NULL);
|
||||
return s_screen->onEvent(hwnd, msg, wParam, lParam);
|
||||
|
@ -25,28 +25,21 @@ CUnixPlatform::~CUnixPlatform()
|
||||
}
|
||||
|
||||
bool
|
||||
CUnixPlatform::installDaemon(
|
||||
const char*,
|
||||
const char*,
|
||||
const char*,
|
||||
const char*)
|
||||
CUnixPlatform::installDaemon(const char*, const char*, const char*, const char*)
|
||||
{
|
||||
// daemons don't require special installation
|
||||
return true;
|
||||
}
|
||||
|
||||
CUnixPlatform::EResult
|
||||
CUnixPlatform::uninstallDaemon(
|
||||
const char*)
|
||||
CUnixPlatform::uninstallDaemon(const char*)
|
||||
{
|
||||
// daemons don't require special installation
|
||||
return kSuccess;
|
||||
}
|
||||
|
||||
int
|
||||
CUnixPlatform::daemonize(
|
||||
const char* name,
|
||||
DaemonFunc func)
|
||||
CUnixPlatform::daemonize(const char* name, DaemonFunc func)
|
||||
{
|
||||
// fork so shell thinks we're done and so we're not a process
|
||||
// group leader
|
||||
@ -92,17 +85,14 @@ CUnixPlatform::daemonize(
|
||||
}
|
||||
|
||||
void
|
||||
CUnixPlatform::installDaemonLogger(
|
||||
const char* name)
|
||||
CUnixPlatform::installDaemonLogger(const char* name)
|
||||
{
|
||||
openlog(name, 0, LOG_DAEMON);
|
||||
CLog::setOutputter(&CUnixPlatform::deamonLogger);
|
||||
}
|
||||
|
||||
int
|
||||
CUnixPlatform::restart(
|
||||
RestartFunc func,
|
||||
int minErrorCode)
|
||||
CUnixPlatform::restart(RestartFunc func, int minErrorCode)
|
||||
{
|
||||
for (;;) {
|
||||
switch (fork()) {
|
||||
@ -153,8 +143,7 @@ CUnixPlatform::restart(
|
||||
}
|
||||
|
||||
const char*
|
||||
CUnixPlatform::getBasename(
|
||||
const char* pathname) const
|
||||
CUnixPlatform::getBasename(const char* pathname) const
|
||||
{
|
||||
if (pathname == NULL) {
|
||||
return NULL;
|
||||
@ -189,9 +178,8 @@ CUnixPlatform::getSystemDirectory() const
|
||||
}
|
||||
|
||||
CString
|
||||
CUnixPlatform::addPathComponent(
|
||||
const CString& prefix,
|
||||
const CString& suffix) const
|
||||
CUnixPlatform::addPathComponent(const CString& prefix,
|
||||
const CString& suffix) const
|
||||
{
|
||||
CString path;
|
||||
path.reserve(prefix.size() + 1 + suffix.size());
|
||||
@ -204,9 +192,7 @@ CUnixPlatform::addPathComponent(
|
||||
}
|
||||
|
||||
bool
|
||||
CUnixPlatform::deamonLogger(
|
||||
int priority,
|
||||
const char* msg)
|
||||
CUnixPlatform::deamonLogger(int priority, const char* msg)
|
||||
{
|
||||
// convert priority
|
||||
switch (priority) {
|
||||
|
@ -37,19 +37,14 @@ CWin32Platform::isWindows95Family()
|
||||
}
|
||||
|
||||
void
|
||||
CWin32Platform::setStatus(
|
||||
SERVICE_STATUS_HANDLE handle,
|
||||
DWORD state)
|
||||
CWin32Platform::setStatus(SERVICE_STATUS_HANDLE handle, DWORD state)
|
||||
{
|
||||
setStatus(handle, state, 0, 0);
|
||||
}
|
||||
|
||||
void
|
||||
CWin32Platform::setStatus(
|
||||
SERVICE_STATUS_HANDLE handle,
|
||||
DWORD state,
|
||||
DWORD step,
|
||||
DWORD waitHint)
|
||||
CWin32Platform::setStatus(SERVICE_STATUS_HANDLE handle,
|
||||
DWORD state, DWORD step, DWORD waitHint)
|
||||
{
|
||||
SERVICE_STATUS status;
|
||||
status.dwServiceType = SERVICE_WIN32_OWN_PROCESS |
|
||||
@ -66,9 +61,7 @@ CWin32Platform::setStatus(
|
||||
}
|
||||
|
||||
void
|
||||
CWin32Platform::setStatusError(
|
||||
SERVICE_STATUS_HANDLE handle,
|
||||
DWORD error)
|
||||
CWin32Platform::setStatusError(SERVICE_STATUS_HANDLE handle, DWORD error)
|
||||
{
|
||||
SERVICE_STATUS status;
|
||||
status.dwServiceType = SERVICE_WIN32_OWN_PROCESS |
|
||||
@ -85,11 +78,8 @@ CWin32Platform::setStatusError(
|
||||
}
|
||||
|
||||
bool
|
||||
CWin32Platform::installDaemon(
|
||||
const char* name,
|
||||
const char* description,
|
||||
const char* pathname,
|
||||
const char* commandLine)
|
||||
CWin32Platform::installDaemon(const char* name, const char* description,
|
||||
const char* pathname, const char* commandLine)
|
||||
{
|
||||
// windows 95 family services
|
||||
if (isWindows95Family()) {
|
||||
@ -181,8 +171,7 @@ CWin32Platform::installDaemon(
|
||||
}
|
||||
|
||||
IPlatform::EResult
|
||||
CWin32Platform::uninstallDaemon(
|
||||
const char* name)
|
||||
CWin32Platform::uninstallDaemon(const char* name)
|
||||
{
|
||||
// windows 95 family services
|
||||
if (isWindows95Family()) {
|
||||
@ -255,9 +244,7 @@ CWin32Platform::uninstallDaemon(
|
||||
}
|
||||
|
||||
int
|
||||
CWin32Platform::daemonize(
|
||||
const char* name,
|
||||
DaemonFunc func)
|
||||
CWin32Platform::daemonize(const char* name, DaemonFunc func)
|
||||
{
|
||||
assert(name != NULL);
|
||||
assert(func != NULL);
|
||||
@ -319,8 +306,7 @@ CWin32Platform::daemonize(
|
||||
}
|
||||
|
||||
void
|
||||
CWin32Platform::installDaemonLogger(
|
||||
const char* name)
|
||||
CWin32Platform::installDaemonLogger(const char* name)
|
||||
{
|
||||
if (!CWin32Platform::isWindows95Family()) {
|
||||
// open event log and direct log messages to it
|
||||
@ -334,9 +320,7 @@ CWin32Platform::installDaemonLogger(
|
||||
}
|
||||
|
||||
int
|
||||
CWin32Platform::restart(
|
||||
RestartFunc func,
|
||||
int /*minErrorCode*/)
|
||||
CWin32Platform::restart(RestartFunc func, int /*minErrorCode*/)
|
||||
{
|
||||
// FIXME -- start in separate process or thread. note that this
|
||||
// isn't too critical as win32 doesn't force us to terminate for
|
||||
@ -345,8 +329,7 @@ CWin32Platform::restart(
|
||||
}
|
||||
|
||||
const char*
|
||||
CWin32Platform::getBasename(
|
||||
const char* pathname) const
|
||||
CWin32Platform::getBasename(const char* pathname) const
|
||||
{
|
||||
if (pathname == NULL) {
|
||||
return NULL;
|
||||
@ -429,9 +412,8 @@ CWin32Platform::getSystemDirectory() const
|
||||
}
|
||||
|
||||
CString
|
||||
CWin32Platform::addPathComponent(
|
||||
const CString& prefix,
|
||||
const CString& suffix) const
|
||||
CWin32Platform::addPathComponent(const CString& prefix,
|
||||
const CString& suffix) const
|
||||
{
|
||||
CString path;
|
||||
path.reserve(prefix.size() + 1 + suffix.size());
|
||||
@ -446,9 +428,7 @@ CWin32Platform::addPathComponent(
|
||||
}
|
||||
|
||||
HKEY
|
||||
CWin32Platform::openKey(
|
||||
HKEY key,
|
||||
const char* keyName)
|
||||
CWin32Platform::openKey(HKEY key, const char* keyName)
|
||||
{
|
||||
// open next key
|
||||
HKEY newKey;
|
||||
@ -471,9 +451,7 @@ CWin32Platform::openKey(
|
||||
}
|
||||
|
||||
HKEY
|
||||
CWin32Platform::openKey(
|
||||
HKEY key,
|
||||
const char** keyNames)
|
||||
CWin32Platform::openKey(HKEY key, const char** keyNames)
|
||||
{
|
||||
for (UInt32 i = 0; key != NULL && keyNames[i] != NULL; ++i) {
|
||||
// open next key
|
||||
@ -483,17 +461,14 @@ CWin32Platform::openKey(
|
||||
}
|
||||
|
||||
void
|
||||
CWin32Platform::closeKey(
|
||||
HKEY key)
|
||||
CWin32Platform::closeKey(HKEY key)
|
||||
{
|
||||
assert(key != NULL);
|
||||
RegCloseKey(key);
|
||||
}
|
||||
|
||||
void
|
||||
CWin32Platform::deleteKey(
|
||||
HKEY key,
|
||||
const char* name)
|
||||
CWin32Platform::deleteKey(HKEY key, const char* name)
|
||||
{
|
||||
assert(key != NULL);
|
||||
assert(name != NULL);
|
||||
@ -501,9 +476,7 @@ CWin32Platform::deleteKey(
|
||||
}
|
||||
|
||||
void
|
||||
CWin32Platform::deleteValue(
|
||||
HKEY key,
|
||||
const char* name)
|
||||
CWin32Platform::deleteValue(HKEY key, const char* name)
|
||||
{
|
||||
assert(key != NULL);
|
||||
assert(name != NULL);
|
||||
@ -511,10 +484,7 @@ CWin32Platform::deleteValue(
|
||||
}
|
||||
|
||||
void
|
||||
CWin32Platform::setValue(
|
||||
HKEY key,
|
||||
const char* name,
|
||||
const CString& value)
|
||||
CWin32Platform::setValue(HKEY key, const char* name, const CString& value)
|
||||
{
|
||||
assert(key != NULL);
|
||||
assert(name != NULL);
|
||||
@ -524,9 +494,7 @@ CWin32Platform::setValue(
|
||||
}
|
||||
|
||||
CString
|
||||
CWin32Platform::readValueString(
|
||||
HKEY key,
|
||||
const char* name)
|
||||
CWin32Platform::readValueString(HKEY key, const char* name)
|
||||
{
|
||||
// get the size of the string
|
||||
DWORD type;
|
||||
@ -582,9 +550,7 @@ CWin32Platform::open95ServicesKey()
|
||||
}
|
||||
|
||||
int
|
||||
CWin32Platform::runDaemon(
|
||||
RunFunc run,
|
||||
StopFunc stop)
|
||||
CWin32Platform::runDaemon(RunFunc run, StopFunc stop)
|
||||
{
|
||||
// should only be called from DaemonFunc
|
||||
assert(m_serviceMutex != NULL);
|
||||
@ -664,9 +630,7 @@ CWin32Platform::runDaemon(
|
||||
}
|
||||
|
||||
void
|
||||
CWin32Platform::serviceMain(
|
||||
DWORD argc,
|
||||
LPTSTR* argvIn)
|
||||
CWin32Platform::serviceMain(DWORD argc, LPTSTR* argvIn)
|
||||
{
|
||||
typedef std::vector<LPCTSTR> ArgList;
|
||||
typedef std::vector<CString> Arguments;
|
||||
@ -784,16 +748,13 @@ CWin32Platform::serviceMain(
|
||||
}
|
||||
|
||||
void WINAPI
|
||||
CWin32Platform::serviceMainEntry(
|
||||
DWORD argc,
|
||||
LPTSTR* argv)
|
||||
CWin32Platform::serviceMainEntry(DWORD argc, LPTSTR* argv)
|
||||
{
|
||||
s_daemonPlatform->serviceMain(argc, argv);
|
||||
}
|
||||
|
||||
void
|
||||
CWin32Platform::serviceHandler(
|
||||
DWORD ctrl)
|
||||
CWin32Platform::serviceHandler(DWORD ctrl)
|
||||
{
|
||||
assert(m_serviceMutex != NULL);
|
||||
assert(m_serviceState != NULL);
|
||||
@ -866,16 +827,13 @@ CWin32Platform::serviceHandler(
|
||||
}
|
||||
|
||||
void WINAPI
|
||||
CWin32Platform::serviceHandlerEntry(
|
||||
DWORD ctrl)
|
||||
CWin32Platform::serviceHandlerEntry(DWORD ctrl)
|
||||
{
|
||||
s_daemonPlatform->serviceHandler(ctrl);
|
||||
}
|
||||
|
||||
bool
|
||||
CWin32Platform::serviceLogger(
|
||||
int priority,
|
||||
const char* msg)
|
||||
CWin32Platform::serviceLogger(int priority, const char* msg)
|
||||
{
|
||||
if (s_eventLog == NULL) {
|
||||
return false;
|
||||
|
@ -10,10 +10,8 @@
|
||||
// CXWindowsClipboard
|
||||
//
|
||||
|
||||
CXWindowsClipboard::CXWindowsClipboard(
|
||||
Display* display,
|
||||
Window window,
|
||||
ClipboardID id) :
|
||||
CXWindowsClipboard::CXWindowsClipboard(Display* display,
|
||||
Window window, ClipboardID id) :
|
||||
m_display(display),
|
||||
m_window(window),
|
||||
m_id(id),
|
||||
@ -63,8 +61,7 @@ CXWindowsClipboard::~CXWindowsClipboard()
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsClipboard::lost(
|
||||
Time time)
|
||||
CXWindowsClipboard::lost(Time time)
|
||||
{
|
||||
log((CLOG_DEBUG "lost clipboard %d ownership at %d", m_id, time));
|
||||
if (m_owner) {
|
||||
@ -75,12 +72,8 @@ CXWindowsClipboard::lost(
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsClipboard::addRequest(
|
||||
Window owner,
|
||||
Window requestor,
|
||||
Atom target,
|
||||
::Time time,
|
||||
Atom property)
|
||||
CXWindowsClipboard::addRequest(Window owner, Window requestor,
|
||||
Atom target, ::Time time, Atom property)
|
||||
{
|
||||
// must be for our window and we must have owned the selection
|
||||
// at the given time.
|
||||
@ -118,11 +111,8 @@ CXWindowsClipboard::addRequest(
|
||||
}
|
||||
|
||||
bool
|
||||
CXWindowsClipboard::addSimpleRequest(
|
||||
Window requestor,
|
||||
Atom target,
|
||||
::Time time,
|
||||
Atom property)
|
||||
CXWindowsClipboard::addSimpleRequest(Window requestor,
|
||||
Atom target, ::Time time, Atom property)
|
||||
{
|
||||
// obsolete requestors may supply a None property. in
|
||||
// that case we use the target as the property to store
|
||||
@ -162,10 +152,8 @@ CXWindowsClipboard::addSimpleRequest(
|
||||
}
|
||||
|
||||
bool
|
||||
CXWindowsClipboard::processRequest(
|
||||
Window requestor,
|
||||
::Time /*time*/,
|
||||
Atom property)
|
||||
CXWindowsClipboard::processRequest(Window requestor,
|
||||
::Time /*time*/, Atom property)
|
||||
{
|
||||
CReplyMap::iterator index = m_replies.find(requestor);
|
||||
if (index == m_replies.end()) {
|
||||
@ -192,8 +180,7 @@ CXWindowsClipboard::processRequest(
|
||||
}
|
||||
|
||||
bool
|
||||
CXWindowsClipboard::destroyRequest(
|
||||
Window requestor)
|
||||
CXWindowsClipboard::destroyRequest(Window requestor)
|
||||
{
|
||||
CReplyMap::iterator index = m_replies.find(requestor);
|
||||
if (index == m_replies.end()) {
|
||||
@ -257,9 +244,7 @@ CXWindowsClipboard::empty()
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsClipboard::add(
|
||||
EFormat format,
|
||||
const CString& data)
|
||||
CXWindowsClipboard::add(EFormat format, const CString& data)
|
||||
{
|
||||
assert(m_open);
|
||||
assert(m_owner);
|
||||
@ -273,8 +258,7 @@ CXWindowsClipboard::add(
|
||||
}
|
||||
|
||||
bool
|
||||
CXWindowsClipboard::open(
|
||||
Time time) const
|
||||
CXWindowsClipboard::open(Time time) const
|
||||
{
|
||||
assert(!m_open);
|
||||
|
||||
@ -347,8 +331,7 @@ CXWindowsClipboard::getTime() const
|
||||
}
|
||||
|
||||
bool
|
||||
CXWindowsClipboard::has(
|
||||
EFormat format) const
|
||||
CXWindowsClipboard::has(EFormat format) const
|
||||
{
|
||||
assert(m_open);
|
||||
|
||||
@ -357,8 +340,7 @@ CXWindowsClipboard::has(
|
||||
}
|
||||
|
||||
CString
|
||||
CXWindowsClipboard::get(
|
||||
EFormat format) const
|
||||
CXWindowsClipboard::get(EFormat format) const
|
||||
{
|
||||
assert(m_open);
|
||||
|
||||
@ -367,8 +349,7 @@ CXWindowsClipboard::get(
|
||||
}
|
||||
|
||||
IClipboard::EFormat
|
||||
CXWindowsClipboard::getFormat(
|
||||
Atom src) const
|
||||
CXWindowsClipboard::getFormat(Atom src) const
|
||||
{
|
||||
// FIXME -- handle more formats (especially mime-type-like formats
|
||||
// and various character encodings like unicode).
|
||||
@ -482,10 +463,8 @@ CXWindowsClipboard::icccmFillCache()
|
||||
}
|
||||
|
||||
bool
|
||||
CXWindowsClipboard::icccmGetSelection(
|
||||
Atom target,
|
||||
Atom* actualTarget,
|
||||
CString* data) const
|
||||
CXWindowsClipboard::icccmGetSelection(Atom target,
|
||||
Atom* actualTarget, CString* data) const
|
||||
{
|
||||
assert(actualTarget != NULL);
|
||||
assert(data != NULL);
|
||||
@ -725,10 +704,8 @@ CXWindowsClipboard::motifGetTime() const
|
||||
}
|
||||
|
||||
bool
|
||||
CXWindowsClipboard::insertMultipleReply(
|
||||
Window requestor,
|
||||
::Time time,
|
||||
Atom property)
|
||||
CXWindowsClipboard::insertMultipleReply(Window requestor,
|
||||
::Time time, Atom property)
|
||||
{
|
||||
// get the requested targets
|
||||
Atom target;
|
||||
@ -780,8 +757,7 @@ CXWindowsClipboard::insertMultipleReply(
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsClipboard::insertReply(
|
||||
CReply* reply)
|
||||
CXWindowsClipboard::insertReply(CReply* reply)
|
||||
{
|
||||
assert(reply != NULL);
|
||||
|
||||
@ -841,10 +817,8 @@ CXWindowsClipboard::pushReplies()
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsClipboard::pushReplies(
|
||||
CReplyMap::iterator mapIndex,
|
||||
CReplyList& replies,
|
||||
CReplyList::iterator index)
|
||||
CXWindowsClipboard::pushReplies(CReplyMap::iterator mapIndex,
|
||||
CReplyList& replies, CReplyList::iterator index)
|
||||
{
|
||||
CReply* reply = *index;
|
||||
while (sendReply(reply)) {
|
||||
@ -870,8 +844,7 @@ CXWindowsClipboard::pushReplies(
|
||||
}
|
||||
|
||||
bool
|
||||
CXWindowsClipboard::sendReply(
|
||||
CReply* reply)
|
||||
CXWindowsClipboard::sendReply(CReply* reply)
|
||||
{
|
||||
assert(reply != NULL);
|
||||
|
||||
@ -1005,8 +978,7 @@ CXWindowsClipboard::clearReplies()
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsClipboard::clearReplies(
|
||||
CReplyList& replies)
|
||||
CXWindowsClipboard::clearReplies(CReplyList& replies)
|
||||
{
|
||||
for (CReplyList::iterator index = replies.begin();
|
||||
index != replies.end(); ++index) {
|
||||
@ -1016,12 +988,8 @@ CXWindowsClipboard::clearReplies(
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsClipboard::sendNotify(
|
||||
Window requestor,
|
||||
Atom selection,
|
||||
Atom target,
|
||||
Atom property,
|
||||
Time time)
|
||||
CXWindowsClipboard::sendNotify(Window requestor,
|
||||
Atom selection, Atom target, Atom property, Time time)
|
||||
{
|
||||
XEvent event;
|
||||
event.xselection.type = SelectionNotify;
|
||||
@ -1036,8 +1004,7 @@ CXWindowsClipboard::sendNotify(
|
||||
}
|
||||
|
||||
bool
|
||||
CXWindowsClipboard::wasOwnedAtTime(
|
||||
::Time time) const
|
||||
CXWindowsClipboard::wasOwnedAtTime(::Time time) const
|
||||
{
|
||||
// not owned if we've never owned the selection
|
||||
if (m_timeOwned == 0) {
|
||||
@ -1070,9 +1037,7 @@ CXWindowsClipboard::wasOwnedAtTime(
|
||||
}
|
||||
|
||||
Atom
|
||||
CXWindowsClipboard::getTargetsData(
|
||||
CString& data,
|
||||
int* format) const
|
||||
CXWindowsClipboard::getTargetsData(CString& data, int* format) const
|
||||
{
|
||||
assert(format != NULL);
|
||||
|
||||
@ -1096,9 +1061,7 @@ CXWindowsClipboard::getTargetsData(
|
||||
}
|
||||
|
||||
Atom
|
||||
CXWindowsClipboard::getTimestampData(
|
||||
CString& data,
|
||||
int* format) const
|
||||
CXWindowsClipboard::getTimestampData(CString& data, int* format) const
|
||||
{
|
||||
assert(format != NULL);
|
||||
|
||||
@ -1109,9 +1072,7 @@ CXWindowsClipboard::getTimestampData(
|
||||
}
|
||||
|
||||
Atom
|
||||
CXWindowsClipboard::getStringData(
|
||||
CString& data,
|
||||
int* format) const
|
||||
CXWindowsClipboard::getStringData(CString& data, int* format) const
|
||||
{
|
||||
assert(format != NULL);
|
||||
|
||||
@ -1131,9 +1092,7 @@ CXWindowsClipboard::getStringData(
|
||||
//
|
||||
|
||||
CXWindowsClipboard::CICCCMGetClipboard::CICCCMGetClipboard(
|
||||
Window requestor,
|
||||
Time time,
|
||||
Atom property) :
|
||||
Window requestor, Time time, Atom property) :
|
||||
m_requestor(requestor),
|
||||
m_time(time),
|
||||
m_property(property),
|
||||
@ -1154,12 +1113,8 @@ CXWindowsClipboard::CICCCMGetClipboard::~CICCCMGetClipboard()
|
||||
}
|
||||
|
||||
bool
|
||||
CXWindowsClipboard::CICCCMGetClipboard::readClipboard(
|
||||
Display* display,
|
||||
Atom selection,
|
||||
Atom target,
|
||||
Atom* actualTarget,
|
||||
CString* data)
|
||||
CXWindowsClipboard::CICCCMGetClipboard::readClipboard(Display* display,
|
||||
Atom selection, Atom target, Atom* actualTarget, CString* data)
|
||||
{
|
||||
assert(actualTarget != NULL);
|
||||
assert(data != NULL);
|
||||
@ -1216,8 +1171,7 @@ CXWindowsClipboard::CICCCMGetClipboard::readClipboard(
|
||||
|
||||
bool
|
||||
CXWindowsClipboard::CICCCMGetClipboard::doEventPredicate(
|
||||
Display* display,
|
||||
XEvent* xevent)
|
||||
Display* display, XEvent* xevent)
|
||||
{
|
||||
// process event
|
||||
switch (xevent->type) {
|
||||
@ -1354,17 +1308,14 @@ log((CLOG_INFO " INCR secondary chunk")); // FIXME
|
||||
|
||||
Bool
|
||||
CXWindowsClipboard::CICCCMGetClipboard::eventPredicate(
|
||||
Display* display,
|
||||
XEvent* xevent,
|
||||
XPointer arg)
|
||||
Display* display, XEvent* xevent, XPointer arg)
|
||||
{
|
||||
CICCCMGetClipboard* self = reinterpret_cast<CICCCMGetClipboard*>(arg);
|
||||
return self->doEventPredicate(display, xevent) ? True : False;
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsClipboard::CICCCMGetClipboard::timeout(
|
||||
void* vdisplay)
|
||||
CXWindowsClipboard::CICCCMGetClipboard::timeout(void* vdisplay)
|
||||
{
|
||||
// wait
|
||||
CThread::sleep(0.2); // FIXME -- is this too short?
|
||||
@ -1386,10 +1337,7 @@ CXWindowsClipboard::CICCCMGetClipboard::timeout(
|
||||
// CXWindowsClipboard::CReply
|
||||
//
|
||||
|
||||
CXWindowsClipboard::CReply::CReply(
|
||||
Window requestor,
|
||||
Atom target,
|
||||
::Time time) :
|
||||
CXWindowsClipboard::CReply::CReply(Window requestor, Atom target, ::Time time) :
|
||||
m_requestor(requestor),
|
||||
m_target(target),
|
||||
m_time(time),
|
||||
@ -1404,14 +1352,8 @@ CXWindowsClipboard::CReply::CReply(
|
||||
// do nothing
|
||||
}
|
||||
|
||||
CXWindowsClipboard::CReply::CReply(
|
||||
Window requestor,
|
||||
Atom target,
|
||||
::Time time,
|
||||
Atom property,
|
||||
const CString& data,
|
||||
Atom type,
|
||||
int format) :
|
||||
CXWindowsClipboard::CReply::CReply(Window requestor, Atom target, ::Time time,
|
||||
Atom property, const CString& data, Atom type, int format) :
|
||||
m_requestor(requestor),
|
||||
m_target(target),
|
||||
m_time(time),
|
||||
|
@ -113,9 +113,7 @@ CXWindowsScreen::getRoot() const
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsScreen::getScreenSize(
|
||||
SInt32* w,
|
||||
SInt32* h) const
|
||||
CXWindowsScreen::getScreenSize(SInt32* w, SInt32* h) const
|
||||
{
|
||||
assert(m_display != NULL);
|
||||
assert(w != NULL && h != NULL);
|
||||
@ -161,8 +159,7 @@ CXWindowsScreen::createBlankCursor() const
|
||||
}
|
||||
|
||||
bool
|
||||
CXWindowsScreen::getEvent(
|
||||
XEvent* xevent) const
|
||||
CXWindowsScreen::getEvent(XEvent* xevent) const
|
||||
{
|
||||
// wait for an event in a cancellable way and don't lock the
|
||||
// display while we're waiting.
|
||||
@ -217,8 +214,7 @@ CXWindowsScreen::onUnexpectedClose()
|
||||
}
|
||||
|
||||
bool
|
||||
CXWindowsScreen::processEvent(
|
||||
XEvent* xevent)
|
||||
CXWindowsScreen::processEvent(XEvent* xevent)
|
||||
{
|
||||
switch (xevent->type) {
|
||||
case SelectionClear:
|
||||
@ -288,9 +284,8 @@ CXWindowsScreen::processEvent(
|
||||
}
|
||||
|
||||
bool
|
||||
CXWindowsScreen::setDisplayClipboard(
|
||||
ClipboardID id,
|
||||
const IClipboard* clipboard)
|
||||
CXWindowsScreen::setDisplayClipboard(ClipboardID id,
|
||||
const IClipboard* clipboard)
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
|
||||
@ -319,9 +314,8 @@ CXWindowsScreen::setDisplayClipboard(
|
||||
}
|
||||
|
||||
bool
|
||||
CXWindowsScreen::getDisplayClipboard(
|
||||
ClipboardID id,
|
||||
IClipboard* clipboard) const
|
||||
CXWindowsScreen::getDisplayClipboard(ClipboardID id,
|
||||
IClipboard* clipboard) const
|
||||
{
|
||||
assert(clipboard != NULL);
|
||||
|
||||
@ -342,10 +336,8 @@ CXWindowsScreen::getDisplayClipboard(
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsScreen::processClipboardRequest(
|
||||
Window requestor,
|
||||
Time time,
|
||||
Atom property)
|
||||
CXWindowsScreen::processClipboardRequest(Window requestor,
|
||||
Time time, Atom property)
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
|
||||
@ -359,8 +351,7 @@ CXWindowsScreen::processClipboardRequest(
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsScreen::destroyClipboardRequest(
|
||||
Window requestor)
|
||||
CXWindowsScreen::destroyClipboardRequest(Window requestor)
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
|
||||
@ -374,8 +365,7 @@ CXWindowsScreen::destroyClipboardRequest(
|
||||
}
|
||||
|
||||
int
|
||||
CXWindowsScreen::ioErrorHandler(
|
||||
Display*)
|
||||
CXWindowsScreen::ioErrorHandler(Display*)
|
||||
{
|
||||
// the display has disconnected, probably because X is shutting
|
||||
// down. X forces us to exit at this point. that's arguably
|
||||
@ -395,8 +385,7 @@ CXWindowsScreen::ioErrorHandler(
|
||||
// CXWindowsScreen::CDisplayLock
|
||||
//
|
||||
|
||||
CXWindowsScreen::CDisplayLock::CDisplayLock(
|
||||
const CXWindowsScreen* screen) :
|
||||
CXWindowsScreen::CDisplayLock::CDisplayLock(const CXWindowsScreen* screen) :
|
||||
m_mutex(&screen->m_mutex),
|
||||
m_display(screen->m_display)
|
||||
{
|
||||
|
@ -8,14 +8,9 @@
|
||||
//
|
||||
|
||||
bool
|
||||
CXWindowsUtil::getWindowProperty(
|
||||
Display* display,
|
||||
Window window,
|
||||
Atom property,
|
||||
CString* data,
|
||||
Atom* type,
|
||||
int* format,
|
||||
bool deleteProperty)
|
||||
CXWindowsUtil::getWindowProperty(Display* display, Window window,
|
||||
Atom property, CString* data, Atom* type,
|
||||
int* format, bool deleteProperty)
|
||||
{
|
||||
assert(display != NULL);
|
||||
assert(data != NULL);
|
||||
@ -88,14 +83,9 @@ CXWindowsUtil::getWindowProperty(
|
||||
}
|
||||
|
||||
bool
|
||||
CXWindowsUtil::setWindowProperty(
|
||||
Display* display,
|
||||
Window window,
|
||||
Atom property,
|
||||
const void* vdata,
|
||||
UInt32 size,
|
||||
Atom type,
|
||||
SInt32 format)
|
||||
CXWindowsUtil::setWindowProperty(Display* display, Window window,
|
||||
Atom property, const void* vdata, UInt32 size,
|
||||
Atom type, SInt32 format)
|
||||
{
|
||||
const UInt32 length = 4 * XMaxRequestSize(display);
|
||||
const unsigned char* data = reinterpret_cast<const unsigned char*>(vdata);
|
||||
@ -135,9 +125,7 @@ CXWindowsUtil::setWindowProperty(
|
||||
}
|
||||
|
||||
Time
|
||||
CXWindowsUtil::getCurrentTime(
|
||||
Display* display,
|
||||
Window window)
|
||||
CXWindowsUtil::getCurrentTime(Display* display, Window window)
|
||||
{
|
||||
// select property events on window
|
||||
XWindowAttributes attr;
|
||||
@ -174,10 +162,7 @@ CXWindowsUtil::getCurrentTime(
|
||||
}
|
||||
|
||||
Bool
|
||||
CXWindowsUtil::propertyNotifyPredicate(
|
||||
Display*,
|
||||
XEvent* xevent,
|
||||
XPointer arg)
|
||||
CXWindowsUtil::propertyNotifyPredicate(Display*, XEvent* xevent, XPointer arg)
|
||||
{
|
||||
CPropertyNotifyPredicateInfo* filter =
|
||||
reinterpret_cast<CPropertyNotifyPredicateInfo*>(arg);
|
||||
@ -199,15 +184,12 @@ CXWindowsUtil::CErrorLock::CErrorLock()
|
||||
install(&CXWindowsUtil::CErrorLock::ignoreHandler, NULL);
|
||||
}
|
||||
|
||||
CXWindowsUtil::CErrorLock::CErrorLock(
|
||||
bool* flag)
|
||||
CXWindowsUtil::CErrorLock::CErrorLock(bool* flag)
|
||||
{
|
||||
install(&CXWindowsUtil::CErrorLock::saveHandler, flag);
|
||||
}
|
||||
|
||||
CXWindowsUtil::CErrorLock::CErrorLock(
|
||||
ErrorHandler handler,
|
||||
void* data)
|
||||
CXWindowsUtil::CErrorLock::CErrorLock(ErrorHandler handler, void* data)
|
||||
{
|
||||
install(handler, data);
|
||||
}
|
||||
@ -219,9 +201,7 @@ CXWindowsUtil::CErrorLock::~CErrorLock()
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsUtil::CErrorLock::install(
|
||||
ErrorHandler handler,
|
||||
void* data)
|
||||
CXWindowsUtil::CErrorLock::install(ErrorHandler handler, void* data)
|
||||
{
|
||||
m_handler = handler;
|
||||
m_userData = data;
|
||||
@ -232,9 +212,7 @@ CXWindowsUtil::CErrorLock::install(
|
||||
}
|
||||
|
||||
int
|
||||
CXWindowsUtil::CErrorLock::internalHandler(
|
||||
Display* display,
|
||||
XErrorEvent* event)
|
||||
CXWindowsUtil::CErrorLock::internalHandler(Display* display, XErrorEvent* event)
|
||||
{
|
||||
if (s_top != NULL && s_top->m_handler != NULL) {
|
||||
s_top->m_handler(display, event, s_top->m_userData);
|
||||
@ -243,19 +221,13 @@ CXWindowsUtil::CErrorLock::internalHandler(
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsUtil::CErrorLock::ignoreHandler(
|
||||
Display*,
|
||||
XErrorEvent*,
|
||||
void*)
|
||||
CXWindowsUtil::CErrorLock::ignoreHandler(Display*, XErrorEvent*, void*)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsUtil::CErrorLock::saveHandler(
|
||||
Display*,
|
||||
XErrorEvent*,
|
||||
void* flag)
|
||||
CXWindowsUtil::CErrorLock::saveHandler(Display*, XErrorEvent*, void* flag)
|
||||
{
|
||||
*reinterpret_cast<bool*>(flag) = true;
|
||||
}
|
||||
|
@ -19,8 +19,7 @@ CConfig::~CConfig()
|
||||
}
|
||||
|
||||
bool
|
||||
CConfig::addScreen(
|
||||
const CString& name)
|
||||
CConfig::addScreen(const CString& name)
|
||||
{
|
||||
// alias name must not exist
|
||||
if (m_nameToCanonicalName.find(name) != m_nameToCanonicalName.end()) {
|
||||
@ -37,8 +36,7 @@ CConfig::addScreen(
|
||||
}
|
||||
|
||||
void
|
||||
CConfig::removeScreen(
|
||||
const CString& name)
|
||||
CConfig::removeScreen(const CString& name)
|
||||
{
|
||||
// get canonical name and find cell
|
||||
CString canonical = getCanonicalName(name);
|
||||
@ -79,9 +77,7 @@ CConfig::removeAllScreens()
|
||||
}
|
||||
|
||||
bool
|
||||
CConfig::addAlias(
|
||||
const CString& canonical,
|
||||
const CString& alias)
|
||||
CConfig::addAlias(const CString& canonical, const CString& alias)
|
||||
{
|
||||
// alias name must not exist
|
||||
if (m_nameToCanonicalName.find(alias) != m_nameToCanonicalName.end()) {
|
||||
@ -100,8 +96,7 @@ CConfig::addAlias(
|
||||
}
|
||||
|
||||
bool
|
||||
CConfig::removeAlias(
|
||||
const CString& alias)
|
||||
CConfig::removeAlias(const CString& alias)
|
||||
{
|
||||
// must not be a canonical name
|
||||
if (m_map.find(alias) != m_map.end()) {
|
||||
@ -135,10 +130,8 @@ CConfig::removeAllAliases()
|
||||
}
|
||||
|
||||
bool
|
||||
CConfig::connect(
|
||||
const CString& srcName,
|
||||
EDirection srcSide,
|
||||
const CString& dstName)
|
||||
CConfig::connect(const CString& srcName,
|
||||
EDirection srcSide, const CString& dstName)
|
||||
{
|
||||
// find source cell
|
||||
CCellMap::iterator index = m_map.find(getCanonicalName(srcName));
|
||||
@ -155,9 +148,7 @@ CConfig::connect(
|
||||
}
|
||||
|
||||
bool
|
||||
CConfig::disconnect(
|
||||
const CString& srcName,
|
||||
EDirection srcSide)
|
||||
CConfig::disconnect(const CString& srcName, EDirection srcSide)
|
||||
{
|
||||
// find source cell
|
||||
CCellMap::iterator index = m_map.find(srcName);
|
||||
@ -172,22 +163,19 @@ CConfig::disconnect(
|
||||
}
|
||||
|
||||
void
|
||||
CConfig::setSynergyAddress(
|
||||
const CNetworkAddress& addr)
|
||||
CConfig::setSynergyAddress(const CNetworkAddress& addr)
|
||||
{
|
||||
m_synergyAddress = addr;
|
||||
}
|
||||
|
||||
void
|
||||
CConfig::setHTTPAddress(
|
||||
const CNetworkAddress& addr)
|
||||
CConfig::setHTTPAddress(const CNetworkAddress& addr)
|
||||
{
|
||||
m_httpAddress = addr;
|
||||
}
|
||||
|
||||
bool
|
||||
CConfig::isValidScreenName(
|
||||
const CString& name) const
|
||||
CConfig::isValidScreenName(const CString& name) const
|
||||
{
|
||||
// name is valid if matches validname
|
||||
// name ::= [A-Za-z0-9] | [A-Za-z0-9][-A-Za-z0-9]*[A-Za-z0-9]
|
||||
@ -244,22 +232,19 @@ CConfig::end() const
|
||||
}
|
||||
|
||||
bool
|
||||
CConfig::isScreen(
|
||||
const CString& name) const
|
||||
CConfig::isScreen(const CString& name) const
|
||||
{
|
||||
return (m_nameToCanonicalName.count(name) > 0);
|
||||
}
|
||||
|
||||
bool
|
||||
CConfig::isCanonicalName(
|
||||
const CString& name) const
|
||||
CConfig::isCanonicalName(const CString& name) const
|
||||
{
|
||||
return CStringUtil::CaselessCmp::equal(getCanonicalName(name), name);
|
||||
}
|
||||
|
||||
CString
|
||||
CConfig::getCanonicalName(
|
||||
const CString& name) const
|
||||
CConfig::getCanonicalName(const CString& name) const
|
||||
{
|
||||
CNameMap::const_iterator index = m_nameToCanonicalName.find(name);
|
||||
if (index == m_nameToCanonicalName.end()) {
|
||||
@ -271,9 +256,7 @@ CConfig::getCanonicalName(
|
||||
}
|
||||
|
||||
CString
|
||||
CConfig::getNeighbor(
|
||||
const CString& srcName,
|
||||
EDirection srcSide) const
|
||||
CConfig::getNeighbor(const CString& srcName, EDirection srcSide) const
|
||||
{
|
||||
// find source cell
|
||||
CCellMap::const_iterator index = m_map.find(getCanonicalName(srcName));
|
||||
@ -299,17 +282,14 @@ CConfig::getHTTPAddress() const
|
||||
}
|
||||
|
||||
const char*
|
||||
CConfig::dirName(
|
||||
EDirection dir)
|
||||
CConfig::dirName(EDirection dir)
|
||||
{
|
||||
static const char* s_name[] = { "left", "right", "top", "bottom" };
|
||||
return s_name[dir - kFirstDirection];
|
||||
}
|
||||
|
||||
bool
|
||||
CConfig::readLine(
|
||||
std::istream& s,
|
||||
CString& line)
|
||||
CConfig::readLine(std::istream& s, CString& line)
|
||||
{
|
||||
s >> std::ws;
|
||||
while (std::getline(s, line)) {
|
||||
@ -333,8 +313,7 @@ CConfig::readLine(
|
||||
}
|
||||
|
||||
void
|
||||
CConfig::readSection(
|
||||
std::istream& s)
|
||||
CConfig::readSection(std::istream& s)
|
||||
{
|
||||
static const char s_section[] = "section:";
|
||||
static const char s_network[] = "network";
|
||||
@ -383,8 +362,7 @@ CConfig::readSection(
|
||||
}
|
||||
|
||||
void
|
||||
CConfig::readSectionNetwork(
|
||||
std::istream& s)
|
||||
CConfig::readSectionNetwork(std::istream& s)
|
||||
{
|
||||
CString line;
|
||||
CString name;
|
||||
@ -440,8 +418,7 @@ CConfig::readSectionNetwork(
|
||||
}
|
||||
|
||||
void
|
||||
CConfig::readSectionScreens(
|
||||
std::istream& s)
|
||||
CConfig::readSectionScreens(std::istream& s)
|
||||
{
|
||||
CString line;
|
||||
CString name;
|
||||
@ -477,8 +454,7 @@ CConfig::readSectionScreens(
|
||||
}
|
||||
|
||||
void
|
||||
CConfig::readSectionLinks(
|
||||
std::istream& s)
|
||||
CConfig::readSectionLinks(std::istream& s)
|
||||
{
|
||||
CString line;
|
||||
CString screen;
|
||||
@ -559,8 +535,7 @@ CConfig::readSectionLinks(
|
||||
}
|
||||
|
||||
void
|
||||
CConfig::readSectionAliases(
|
||||
std::istream& s)
|
||||
CConfig::readSectionAliases(std::istream& s)
|
||||
{
|
||||
CString line;
|
||||
CString screen;
|
||||
@ -607,9 +582,7 @@ CConfig::readSectionAliases(
|
||||
//
|
||||
|
||||
std::istream&
|
||||
operator>>(
|
||||
std::istream& s,
|
||||
CConfig& config)
|
||||
operator>>(std::istream& s, CConfig& config)
|
||||
{
|
||||
// FIXME -- should track line and column to improve error reporting
|
||||
|
||||
@ -622,9 +595,7 @@ operator>>(
|
||||
}
|
||||
|
||||
std::ostream&
|
||||
operator<<(
|
||||
std::ostream& s,
|
||||
const CConfig& config)
|
||||
operator<<(std::ostream& s, const CConfig& config)
|
||||
{
|
||||
// network section
|
||||
s << "section: network" << std::endl;
|
||||
@ -710,8 +681,7 @@ operator<<(
|
||||
// CConfig I/O exceptions
|
||||
//
|
||||
|
||||
XConfigRead::XConfigRead(
|
||||
const CString& error) :
|
||||
XConfigRead::XConfigRead(const CString& error) :
|
||||
m_error(error)
|
||||
{
|
||||
// do nothing
|
||||
|
@ -31,8 +31,7 @@ CHTTPServer::~CHTTPServer()
|
||||
}
|
||||
|
||||
void
|
||||
CHTTPServer::processRequest(
|
||||
IDataSocket* socket)
|
||||
CHTTPServer::processRequest(IDataSocket* socket)
|
||||
{
|
||||
assert(socket != NULL);
|
||||
|
||||
@ -92,9 +91,7 @@ CHTTPServer::processRequest(
|
||||
}
|
||||
|
||||
void
|
||||
CHTTPServer::doProcessRequest(
|
||||
CHTTPRequest& request,
|
||||
CHTTPReply& reply)
|
||||
CHTTPServer::doProcessRequest(CHTTPRequest& request, CHTTPReply& reply)
|
||||
{
|
||||
reply.m_majorVersion = request.m_majorVersion;
|
||||
reply.m_minorVersion = request.m_minorVersion;
|
||||
@ -123,9 +120,7 @@ CHTTPServer::doProcessRequest(
|
||||
}
|
||||
|
||||
void
|
||||
CHTTPServer::doProcessGetEditMap(
|
||||
CHTTPRequest& /*request*/,
|
||||
CHTTPReply& reply)
|
||||
CHTTPServer::doProcessGetEditMap(CHTTPRequest& /*request*/, CHTTPReply& reply)
|
||||
{
|
||||
static const char* s_editMapProlog1 =
|
||||
"<html>\r\n"
|
||||
@ -234,9 +229,7 @@ CHTTPServer::doProcessGetEditMap(
|
||||
}
|
||||
|
||||
void
|
||||
CHTTPServer::doProcessPostEditMap(
|
||||
CHTTPRequest& request,
|
||||
CHTTPReply& reply)
|
||||
CHTTPServer::doProcessPostEditMap(CHTTPRequest& request, CHTTPReply& reply)
|
||||
{
|
||||
typedef std::vector<CString> ScreenArray;
|
||||
typedef std::set<CString> ScreenSet;
|
||||
@ -330,10 +323,7 @@ CHTTPServer::doProcessPostEditMap(
|
||||
}
|
||||
|
||||
bool
|
||||
CHTTPServer::parseXY(
|
||||
const CString& xy,
|
||||
SInt32& x,
|
||||
SInt32& y)
|
||||
CHTTPServer::parseXY(const CString& xy, SInt32& x, SInt32& y)
|
||||
{
|
||||
std::istringstream s(xy);
|
||||
char delimiter;
|
||||
@ -361,9 +351,7 @@ CHTTPServer::CScreenArray::~CScreenArray()
|
||||
}
|
||||
|
||||
void
|
||||
CHTTPServer::CScreenArray::resize(
|
||||
SInt32 w,
|
||||
SInt32 h)
|
||||
CHTTPServer::CScreenArray::resize(SInt32 w, SInt32 h)
|
||||
{
|
||||
m_screens.clear();
|
||||
m_screens.resize(w * h);
|
||||
@ -372,8 +360,7 @@ CHTTPServer::CScreenArray::resize(
|
||||
}
|
||||
|
||||
void
|
||||
CHTTPServer::CScreenArray::insertRow(
|
||||
SInt32 i)
|
||||
CHTTPServer::CScreenArray::insertRow(SInt32 i)
|
||||
{
|
||||
assert(i >= 0 && i <= m_h);
|
||||
|
||||
@ -396,8 +383,7 @@ CHTTPServer::CScreenArray::insertRow(
|
||||
}
|
||||
|
||||
void
|
||||
CHTTPServer::CScreenArray::insertColumn(
|
||||
SInt32 i)
|
||||
CHTTPServer::CScreenArray::insertColumn(SInt32 i)
|
||||
{
|
||||
assert(i >= 0 && i <= m_w);
|
||||
|
||||
@ -418,8 +404,7 @@ CHTTPServer::CScreenArray::insertColumn(
|
||||
}
|
||||
|
||||
void
|
||||
CHTTPServer::CScreenArray::eraseRow(
|
||||
SInt32 i)
|
||||
CHTTPServer::CScreenArray::eraseRow(SInt32 i)
|
||||
{
|
||||
assert(i >= 0 && i < m_h);
|
||||
|
||||
@ -442,8 +427,7 @@ CHTTPServer::CScreenArray::eraseRow(
|
||||
}
|
||||
|
||||
void
|
||||
CHTTPServer::CScreenArray::eraseColumn(
|
||||
SInt32 i)
|
||||
CHTTPServer::CScreenArray::eraseColumn(SInt32 i)
|
||||
{
|
||||
assert(i >= 0 && i < m_w);
|
||||
|
||||
@ -464,8 +448,7 @@ CHTTPServer::CScreenArray::eraseColumn(
|
||||
}
|
||||
|
||||
void
|
||||
CHTTPServer::CScreenArray::rotateRows(
|
||||
SInt32 i)
|
||||
CHTTPServer::CScreenArray::rotateRows(SInt32 i)
|
||||
{
|
||||
// nothing to do if no rows
|
||||
if (m_h == 0) {
|
||||
@ -496,8 +479,7 @@ CHTTPServer::CScreenArray::rotateRows(
|
||||
}
|
||||
|
||||
void
|
||||
CHTTPServer::CScreenArray::rotateColumns(
|
||||
SInt32 i)
|
||||
CHTTPServer::CScreenArray::rotateColumns(SInt32 i)
|
||||
{
|
||||
// nothing to do if no columns
|
||||
if (m_h == 0) {
|
||||
@ -528,18 +510,13 @@ CHTTPServer::CScreenArray::rotateColumns(
|
||||
}
|
||||
|
||||
void
|
||||
CHTTPServer::CScreenArray::remove(
|
||||
SInt32 x,
|
||||
SInt32 y)
|
||||
CHTTPServer::CScreenArray::remove(SInt32 x, SInt32 y)
|
||||
{
|
||||
set(x, y, CString());
|
||||
}
|
||||
|
||||
void
|
||||
CHTTPServer::CScreenArray::set(
|
||||
SInt32 x,
|
||||
SInt32 y,
|
||||
const CString& name)
|
||||
CHTTPServer::CScreenArray::set(SInt32 x, SInt32 y, const CString& name)
|
||||
{
|
||||
assert(x >= 0 && x < m_w);
|
||||
assert(y >= 0 && y < m_h);
|
||||
@ -548,9 +525,7 @@ CHTTPServer::CScreenArray::set(
|
||||
}
|
||||
|
||||
bool
|
||||
CHTTPServer::CScreenArray::isAllowed(
|
||||
SInt32 x,
|
||||
SInt32 y) const
|
||||
CHTTPServer::CScreenArray::isAllowed(SInt32 x, SInt32 y) const
|
||||
{
|
||||
assert(x >= 0 && x < m_w);
|
||||
assert(y >= 0 && y < m_h);
|
||||
@ -571,9 +546,7 @@ CHTTPServer::CScreenArray::isAllowed(
|
||||
}
|
||||
|
||||
bool
|
||||
CHTTPServer::CScreenArray::isSet(
|
||||
SInt32 x,
|
||||
SInt32 y) const
|
||||
CHTTPServer::CScreenArray::isSet(SInt32 x, SInt32 y) const
|
||||
{
|
||||
assert(x >= 0 && x < m_w);
|
||||
assert(y >= 0 && y < m_h);
|
||||
@ -582,9 +555,7 @@ CHTTPServer::CScreenArray::isSet(
|
||||
}
|
||||
|
||||
CString
|
||||
CHTTPServer::CScreenArray::get(
|
||||
SInt32 x,
|
||||
SInt32 y) const
|
||||
CHTTPServer::CScreenArray::get(SInt32 x, SInt32 y) const
|
||||
{
|
||||
assert(x >= 0 && x < m_w);
|
||||
assert(y >= 0 && y < m_h);
|
||||
@ -593,10 +564,8 @@ CHTTPServer::CScreenArray::get(
|
||||
}
|
||||
|
||||
bool
|
||||
CHTTPServer::CScreenArray::find(
|
||||
const CString& name,
|
||||
SInt32& xOut,
|
||||
SInt32& yOut) const
|
||||
CHTTPServer::CScreenArray::find(const CString& name,
|
||||
SInt32& xOut, SInt32& yOut) const
|
||||
{
|
||||
for (SInt32 y = 0; y < m_h; ++y) {
|
||||
for (SInt32 x = 0; x < m_w; ++x) {
|
||||
@ -628,8 +597,7 @@ CHTTPServer::CScreenArray::isValid() const
|
||||
}
|
||||
|
||||
bool
|
||||
CHTTPServer::CScreenArray::convertFrom(
|
||||
const CConfig& config)
|
||||
CHTTPServer::CScreenArray::convertFrom(const CConfig& config)
|
||||
{
|
||||
typedef std::set<CString> ScreenSet;
|
||||
|
||||
@ -760,8 +728,7 @@ CHTTPServer::CScreenArray::convertFrom(
|
||||
}
|
||||
|
||||
void
|
||||
CHTTPServer::CScreenArray::convertTo(
|
||||
CConfig& config) const
|
||||
CHTTPServer::CScreenArray::convertTo(CConfig& config) const
|
||||
{
|
||||
config.removeAllScreens();
|
||||
|
||||
|
@ -94,8 +94,7 @@ CMSWindowsPrimaryScreen::stop()
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsPrimaryScreen::open(
|
||||
CServer* server)
|
||||
CMSWindowsPrimaryScreen::open(CServer* server)
|
||||
{
|
||||
assert(m_server == NULL);
|
||||
assert(server != NULL);
|
||||
@ -142,9 +141,7 @@ CMSWindowsPrimaryScreen::close()
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsPrimaryScreen::enter(
|
||||
SInt32 x,
|
||||
SInt32 y)
|
||||
CMSWindowsPrimaryScreen::enter(SInt32 x, SInt32 y)
|
||||
{
|
||||
log((CLOG_INFO "entering primary at %d,%d", x, y));
|
||||
assert(m_active == true);
|
||||
@ -239,18 +236,15 @@ CMSWindowsPrimaryScreen::onConfigure()
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsPrimaryScreen::warpCursor(
|
||||
SInt32 x,
|
||||
SInt32 y)
|
||||
CMSWindowsPrimaryScreen::warpCursor(SInt32 x, SInt32 y)
|
||||
{
|
||||
// set the cursor position without generating an event
|
||||
SetCursorPos(x, y);
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsPrimaryScreen::setClipboard(
|
||||
ClipboardID /*id*/,
|
||||
const IClipboard* src)
|
||||
CMSWindowsPrimaryScreen::setClipboard(ClipboardID /*id*/,
|
||||
const IClipboard* src)
|
||||
{
|
||||
assert(m_window != NULL);
|
||||
|
||||
@ -259,8 +253,7 @@ CMSWindowsPrimaryScreen::setClipboard(
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsPrimaryScreen::grabClipboard(
|
||||
ClipboardID /*id*/)
|
||||
CMSWindowsPrimaryScreen::grabClipboard(ClipboardID /*id*/)
|
||||
{
|
||||
assert(m_window != NULL);
|
||||
|
||||
@ -271,9 +264,7 @@ CMSWindowsPrimaryScreen::grabClipboard(
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsPrimaryScreen::getSize(
|
||||
SInt32* width,
|
||||
SInt32* height) const
|
||||
CMSWindowsPrimaryScreen::getSize(SInt32* width, SInt32* height) const
|
||||
{
|
||||
getScreenSize(width, height);
|
||||
}
|
||||
@ -285,9 +276,8 @@ CMSWindowsPrimaryScreen::getJumpZoneSize() const
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsPrimaryScreen::getClipboard(
|
||||
ClipboardID /*id*/,
|
||||
IClipboard* dst) const
|
||||
CMSWindowsPrimaryScreen::getClipboard(ClipboardID /*id*/,
|
||||
IClipboard* dst) const
|
||||
{
|
||||
assert(m_window != NULL);
|
||||
|
||||
@ -373,8 +363,7 @@ CMSWindowsPrimaryScreen::onCloseDisplay()
|
||||
}
|
||||
|
||||
bool
|
||||
CMSWindowsPrimaryScreen::onPreTranslate(
|
||||
MSG* msg)
|
||||
CMSWindowsPrimaryScreen::onPreTranslate(MSG* msg)
|
||||
{
|
||||
// handle event
|
||||
switch (msg->message) {
|
||||
@ -504,11 +493,8 @@ CMSWindowsPrimaryScreen::onPreTranslate(
|
||||
}
|
||||
|
||||
LRESULT
|
||||
CMSWindowsPrimaryScreen::onEvent(
|
||||
HWND hwnd,
|
||||
UINT msg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
CMSWindowsPrimaryScreen::onEvent(HWND hwnd, UINT msg,
|
||||
WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (msg) {
|
||||
case WM_QUERYENDSESSION:
|
||||
@ -750,8 +736,7 @@ CMSWindowsPrimaryScreen::closeDesktop()
|
||||
}
|
||||
|
||||
bool
|
||||
CMSWindowsPrimaryScreen::switchDesktop(
|
||||
HDESK desk)
|
||||
CMSWindowsPrimaryScreen::switchDesktop(HDESK desk)
|
||||
{
|
||||
// did we own the clipboard?
|
||||
bool ownClipboard = (m_clipboardOwner == m_window);
|
||||
@ -1300,8 +1285,7 @@ CMSWindowsPrimaryScreen::mapKey(
|
||||
}
|
||||
|
||||
ButtonID
|
||||
CMSWindowsPrimaryScreen::mapButton(
|
||||
WPARAM button) const
|
||||
CMSWindowsPrimaryScreen::mapButton(WPARAM button) const
|
||||
{
|
||||
switch (button) {
|
||||
case WM_LBUTTONDOWN:
|
||||
@ -1350,9 +1334,7 @@ CMSWindowsPrimaryScreen::updateKeys()
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsPrimaryScreen::updateKey(
|
||||
UINT vkCode,
|
||||
bool press)
|
||||
CMSWindowsPrimaryScreen::updateKey(UINT vkCode, bool press)
|
||||
{
|
||||
if (press) {
|
||||
switch (vkCode) {
|
||||
|
@ -36,8 +36,7 @@
|
||||
|
||||
const SInt32 CServer::s_httpMaxSimultaneousRequests = 3;
|
||||
|
||||
CServer::CServer(
|
||||
const CString& serverName) :
|
||||
CServer::CServer(const CString& serverName) :
|
||||
m_name(serverName),
|
||||
m_cleanupSize(&m_mutex, 0),
|
||||
m_primary(NULL),
|
||||
@ -160,8 +159,7 @@ CServer::shutdown()
|
||||
}
|
||||
|
||||
bool
|
||||
CServer::setConfig(
|
||||
const CConfig& config)
|
||||
CServer::setConfig(const CConfig& config)
|
||||
{
|
||||
typedef std::vector<CThread> CThreads;
|
||||
CThreads threads;
|
||||
@ -229,8 +227,7 @@ CServer::getPrimaryScreenName() const
|
||||
}
|
||||
|
||||
void
|
||||
CServer::getConfig(
|
||||
CConfig* config) const
|
||||
CServer::getConfig(CConfig* config) const
|
||||
{
|
||||
assert(config != NULL);
|
||||
|
||||
@ -263,12 +260,7 @@ CServer::getActivePrimarySides() const
|
||||
}
|
||||
|
||||
void
|
||||
CServer::setInfo(
|
||||
SInt32 w,
|
||||
SInt32 h,
|
||||
SInt32 zoneSize,
|
||||
SInt32 x,
|
||||
SInt32 y)
|
||||
CServer::setInfo(SInt32 w, SInt32 h, SInt32 zoneSize, SInt32 x, SInt32 y)
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
assert(m_primaryInfo != NULL);
|
||||
@ -276,26 +268,16 @@ CServer::setInfo(
|
||||
}
|
||||
|
||||
void
|
||||
CServer::setInfo(
|
||||
const CString& client,
|
||||
SInt32 w,
|
||||
SInt32 h,
|
||||
SInt32 zoneSize,
|
||||
SInt32 x,
|
||||
SInt32 y)
|
||||
CServer::setInfo(const CString& client,
|
||||
SInt32 w, SInt32 h, SInt32 zoneSize, SInt32 x, SInt32 y)
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
setInfoNoLock(client, w, h, zoneSize, x, y);
|
||||
}
|
||||
|
||||
void
|
||||
CServer::setInfoNoLock(
|
||||
const CString& screen,
|
||||
SInt32 w,
|
||||
SInt32 h,
|
||||
SInt32 zoneSize,
|
||||
SInt32 x,
|
||||
SInt32 y)
|
||||
CServer::setInfoNoLock(const CString& screen,
|
||||
SInt32 w, SInt32 h, SInt32 zoneSize, SInt32 x, SInt32 y)
|
||||
{
|
||||
assert(!screen.empty());
|
||||
assert(w > 0);
|
||||
@ -340,8 +322,7 @@ CServer::setInfoNoLock(
|
||||
}
|
||||
|
||||
void
|
||||
CServer::grabClipboard(
|
||||
ClipboardID id)
|
||||
CServer::grabClipboard(ClipboardID id)
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
assert(m_primaryInfo != NULL);
|
||||
@ -349,20 +330,15 @@ CServer::grabClipboard(
|
||||
}
|
||||
|
||||
void
|
||||
CServer::grabClipboard(
|
||||
ClipboardID id,
|
||||
UInt32 seqNum,
|
||||
const CString& client)
|
||||
CServer::grabClipboard(ClipboardID id, UInt32 seqNum, const CString& client)
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
grabClipboardNoLock(id, seqNum, client);
|
||||
}
|
||||
|
||||
void
|
||||
CServer::grabClipboardNoLock(
|
||||
ClipboardID id,
|
||||
UInt32 seqNum,
|
||||
const CString& screen)
|
||||
CServer::grabClipboardNoLock(ClipboardID id,
|
||||
UInt32 seqNum, const CString& screen)
|
||||
{
|
||||
// note -- must be locked on entry
|
||||
CClipboardInfo& clipboard = m_clipboards[id];
|
||||
@ -421,10 +397,7 @@ CServer::grabClipboardNoLock(
|
||||
}
|
||||
|
||||
void
|
||||
CServer::setClipboard(
|
||||
ClipboardID id,
|
||||
UInt32 seqNum,
|
||||
const CString& data)
|
||||
CServer::setClipboard(ClipboardID id, UInt32 seqNum, const CString& data)
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
CClipboardInfo& clipboard = m_clipboards[id];
|
||||
@ -455,18 +428,13 @@ CServer::setClipboard(
|
||||
}
|
||||
|
||||
bool
|
||||
CServer::onCommandKey(
|
||||
KeyID /*id*/,
|
||||
KeyModifierMask /*mask*/,
|
||||
bool /*down*/)
|
||||
CServer::onCommandKey(KeyID /*id*/, KeyModifierMask /*mask*/, bool /*down*/)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
CServer::onKeyDown(
|
||||
KeyID id,
|
||||
KeyModifierMask mask)
|
||||
CServer::onKeyDown(KeyID id, KeyModifierMask mask)
|
||||
{
|
||||
log((CLOG_DEBUG1 "onKeyDown id=%d mask=0x%04x", id, mask));
|
||||
CLock lock(&m_mutex);
|
||||
@ -484,9 +452,7 @@ CServer::onKeyDown(
|
||||
}
|
||||
|
||||
void
|
||||
CServer::onKeyUp(
|
||||
KeyID id,
|
||||
KeyModifierMask mask)
|
||||
CServer::onKeyUp(KeyID id, KeyModifierMask mask)
|
||||
{
|
||||
log((CLOG_DEBUG1 "onKeyUp id=%d mask=0x%04x", id, mask));
|
||||
CLock lock(&m_mutex);
|
||||
@ -504,10 +470,7 @@ CServer::onKeyUp(
|
||||
}
|
||||
|
||||
void
|
||||
CServer::onKeyRepeat(
|
||||
KeyID id,
|
||||
KeyModifierMask mask,
|
||||
SInt32 count)
|
||||
CServer::onKeyRepeat(KeyID id, KeyModifierMask mask, SInt32 count)
|
||||
{
|
||||
log((CLOG_DEBUG1 "onKeyRepeat id=%d mask=0x%04x count=%d", id, mask, count));
|
||||
CLock lock(&m_mutex);
|
||||
@ -526,8 +489,7 @@ CServer::onKeyRepeat(
|
||||
}
|
||||
|
||||
void
|
||||
CServer::onMouseDown(
|
||||
ButtonID id)
|
||||
CServer::onMouseDown(ButtonID id)
|
||||
{
|
||||
log((CLOG_DEBUG1 "onMouseDown id=%d", id));
|
||||
CLock lock(&m_mutex);
|
||||
@ -540,8 +502,7 @@ CServer::onMouseDown(
|
||||
}
|
||||
|
||||
void
|
||||
CServer::onMouseUp(
|
||||
ButtonID id)
|
||||
CServer::onMouseUp(ButtonID id)
|
||||
{
|
||||
log((CLOG_DEBUG1 "onMouseUp id=%d", id));
|
||||
CLock lock(&m_mutex);
|
||||
@ -554,9 +515,7 @@ CServer::onMouseUp(
|
||||
}
|
||||
|
||||
bool
|
||||
CServer::onMouseMovePrimary(
|
||||
SInt32 x,
|
||||
SInt32 y)
|
||||
CServer::onMouseMovePrimary(SInt32 x, SInt32 y)
|
||||
{
|
||||
log((CLOG_DEBUG2 "onMouseMovePrimary %d,%d", x, y));
|
||||
CLock lock(&m_mutex);
|
||||
@ -564,9 +523,7 @@ CServer::onMouseMovePrimary(
|
||||
}
|
||||
|
||||
bool
|
||||
CServer::onMouseMovePrimaryNoLock(
|
||||
SInt32 x,
|
||||
SInt32 y)
|
||||
CServer::onMouseMovePrimaryNoLock(SInt32 x, SInt32 y)
|
||||
{
|
||||
// mouse move on primary (server's) screen
|
||||
assert(m_active != NULL);
|
||||
@ -621,9 +578,7 @@ CServer::onMouseMovePrimaryNoLock(
|
||||
}
|
||||
|
||||
void
|
||||
CServer::onMouseMoveSecondary(
|
||||
SInt32 dx,
|
||||
SInt32 dy)
|
||||
CServer::onMouseMoveSecondary(SInt32 dx, SInt32 dy)
|
||||
{
|
||||
log((CLOG_DEBUG2 "onMouseMoveSecondary %+d,%+d", dx, dy));
|
||||
CLock lock(&m_mutex);
|
||||
@ -631,9 +586,7 @@ CServer::onMouseMoveSecondary(
|
||||
}
|
||||
|
||||
void
|
||||
CServer::onMouseMoveSecondaryNoLock(
|
||||
SInt32 dx,
|
||||
SInt32 dy)
|
||||
CServer::onMouseMoveSecondaryNoLock(SInt32 dx, SInt32 dy)
|
||||
{
|
||||
// mouse move on secondary (client's) screen
|
||||
assert(m_active != NULL);
|
||||
@ -736,8 +689,7 @@ CServer::onMouseMoveSecondaryNoLock(
|
||||
}
|
||||
|
||||
void
|
||||
CServer::onMouseWheel(
|
||||
SInt32 delta)
|
||||
CServer::onMouseWheel(SInt32 delta)
|
||||
{
|
||||
log((CLOG_DEBUG1 "onMouseWheel %+d", delta));
|
||||
CLock lock(&m_mutex);
|
||||
@ -774,10 +726,7 @@ CServer::isLockedToScreenNoLock() const
|
||||
}
|
||||
|
||||
void
|
||||
CServer::switchScreen(
|
||||
CScreenInfo* dst,
|
||||
SInt32 x,
|
||||
SInt32 y)
|
||||
CServer::switchScreen(CScreenInfo* dst, SInt32 x, SInt32 y)
|
||||
{
|
||||
assert(dst != NULL);
|
||||
assert(x >= 0 && y >= 0 && x < dst->m_width && y < dst->m_height);
|
||||
@ -845,9 +794,7 @@ CServer::switchScreen(
|
||||
}
|
||||
|
||||
CServer::CScreenInfo*
|
||||
CServer::getNeighbor(
|
||||
CScreenInfo* src,
|
||||
CConfig::EDirection dir) const
|
||||
CServer::getNeighbor(CScreenInfo* src, CConfig::EDirection dir) const
|
||||
{
|
||||
assert(src != NULL);
|
||||
|
||||
@ -879,11 +826,8 @@ CServer::getNeighbor(
|
||||
}
|
||||
|
||||
CServer::CScreenInfo*
|
||||
CServer::getNeighbor(
|
||||
CScreenInfo* src,
|
||||
CConfig::EDirection srcSide,
|
||||
SInt32& x,
|
||||
SInt32& y) const
|
||||
CServer::getNeighbor(CScreenInfo* src,
|
||||
CConfig::EDirection srcSide, SInt32& x, SInt32& y) const
|
||||
{
|
||||
assert(src != NULL);
|
||||
|
||||
@ -1000,12 +944,8 @@ CServer::getNeighbor(
|
||||
}
|
||||
|
||||
void
|
||||
CServer::mapPosition(
|
||||
CScreenInfo* src,
|
||||
CConfig::EDirection srcSide,
|
||||
CScreenInfo* dst,
|
||||
SInt32& x,
|
||||
SInt32& y) const
|
||||
CServer::mapPosition(CScreenInfo* src, CConfig::EDirection srcSide,
|
||||
CScreenInfo* dst, SInt32& x, SInt32& y) const
|
||||
{
|
||||
assert(src != NULL);
|
||||
assert(dst != NULL);
|
||||
@ -1104,8 +1044,7 @@ CServer::acceptClients(void*)
|
||||
}
|
||||
|
||||
void
|
||||
CServer::handshakeClient(
|
||||
void* vsocket)
|
||||
CServer::handshakeClient(void* vsocket)
|
||||
{
|
||||
log((CLOG_DEBUG1 "negotiating with new client"));
|
||||
|
||||
@ -1306,8 +1245,7 @@ CServer::acceptHTTPClients(void*)
|
||||
}
|
||||
|
||||
void
|
||||
CServer::processHTTPRequest(
|
||||
void* vsocket)
|
||||
CServer::processHTTPRequest(void* vsocket)
|
||||
{
|
||||
// add this thread to the list of threads to cancel. remove from
|
||||
// list in d'tor.
|
||||
@ -1345,8 +1283,7 @@ CServer::processHTTPRequest(
|
||||
}
|
||||
|
||||
void
|
||||
CServer::clearGotClipboard(
|
||||
ClipboardID id)
|
||||
CServer::clearGotClipboard(ClipboardID id)
|
||||
{
|
||||
for (CScreenList::const_iterator index = m_screens.begin();
|
||||
index != m_screens.end(); ++index) {
|
||||
@ -1355,8 +1292,7 @@ CServer::clearGotClipboard(
|
||||
}
|
||||
|
||||
void
|
||||
CServer::sendClipboard(
|
||||
ClipboardID id)
|
||||
CServer::sendClipboard(ClipboardID id)
|
||||
{
|
||||
// do nothing if clipboard was already sent
|
||||
if (!m_active->m_gotClipboard[id]) {
|
||||
@ -1378,8 +1314,7 @@ CServer::sendClipboard(
|
||||
}
|
||||
|
||||
void
|
||||
CServer::updatePrimaryClipboard(
|
||||
ClipboardID id)
|
||||
CServer::updatePrimaryClipboard(ClipboardID id)
|
||||
{
|
||||
CClipboardInfo& clipboard = m_clipboards[id];
|
||||
|
||||
@ -1497,8 +1432,7 @@ CServer::closePrimaryScreen()
|
||||
}
|
||||
|
||||
void
|
||||
CServer::addCleanupThread(
|
||||
const CThread& thread)
|
||||
CServer::addCleanupThread(const CThread& thread)
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
m_cleanupList.insert(m_cleanupList.begin(), new CThread(thread));
|
||||
@ -1506,8 +1440,7 @@ CServer::addCleanupThread(
|
||||
}
|
||||
|
||||
void
|
||||
CServer::removeCleanupThread(
|
||||
const CThread& thread)
|
||||
CServer::removeCleanupThread(const CThread& thread)
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
for (CThreadList::iterator index = m_cleanupList.begin();
|
||||
@ -1526,8 +1459,7 @@ CServer::removeCleanupThread(
|
||||
}
|
||||
|
||||
void
|
||||
CServer::cleanupThreads(
|
||||
double timeout)
|
||||
CServer::cleanupThreads(double timeout)
|
||||
{
|
||||
log((CLOG_DEBUG1 "cleaning up threads"));
|
||||
|
||||
@ -1567,9 +1499,7 @@ CServer::cleanupThreads(
|
||||
}
|
||||
|
||||
CServer::CScreenInfo*
|
||||
CServer::addConnection(
|
||||
const CString& name,
|
||||
IServerProtocol* protocol)
|
||||
CServer::addConnection(const CString& name, IServerProtocol* protocol)
|
||||
{
|
||||
log((CLOG_DEBUG "adding connection \"%s\"", name.c_str()));
|
||||
|
||||
@ -1594,8 +1524,7 @@ CServer::addConnection(
|
||||
}
|
||||
|
||||
void
|
||||
CServer::removeConnection(
|
||||
const CString& name)
|
||||
CServer::removeConnection(const CString& name)
|
||||
{
|
||||
log((CLOG_DEBUG "removing connection \"%s\"", name.c_str()));
|
||||
CLock lock(&m_mutex);
|
||||
@ -1630,8 +1559,7 @@ CServer::removeConnection(
|
||||
// CServer::CCleanupNote
|
||||
//
|
||||
|
||||
CServer::CCleanupNote::CCleanupNote(
|
||||
CServer* server) :
|
||||
CServer::CCleanupNote::CCleanupNote(CServer* server) :
|
||||
m_server(server)
|
||||
{
|
||||
assert(m_server != NULL);
|
||||
@ -1648,10 +1576,8 @@ CServer::CCleanupNote::~CCleanupNote()
|
||||
// CServer::CConnectionNote
|
||||
//
|
||||
|
||||
CServer::CConnectionNote::CConnectionNote(
|
||||
CServer* server,
|
||||
const CString& name,
|
||||
IServerProtocol* protocol) :
|
||||
CServer::CConnectionNote::CConnectionNote(CServer* server,
|
||||
const CString& name, IServerProtocol* protocol) :
|
||||
m_server(server),
|
||||
m_name(name)
|
||||
{
|
||||
@ -1669,9 +1595,8 @@ CServer::CConnectionNote::~CConnectionNote()
|
||||
// CServer::CScreenInfo
|
||||
//
|
||||
|
||||
CServer::CScreenInfo::CScreenInfo(
|
||||
const CString& name,
|
||||
IServerProtocol* protocol) :
|
||||
CServer::CScreenInfo::CScreenInfo(const CString& name,
|
||||
IServerProtocol* protocol) :
|
||||
m_thread(CThread::getCurrentThread()),
|
||||
m_name(name),
|
||||
m_protocol(protocol),
|
||||
|
@ -9,11 +9,8 @@
|
||||
// CServerProtocol
|
||||
//
|
||||
|
||||
CServerProtocol::CServerProtocol(
|
||||
CServer* server,
|
||||
const CString& client,
|
||||
IInputStream* input,
|
||||
IOutputStream* output) :
|
||||
CServerProtocol::CServerProtocol(CServer* server, const CString& client,
|
||||
IInputStream* input, IOutputStream* output) :
|
||||
m_server(server),
|
||||
m_client(client),
|
||||
m_input(input),
|
||||
@ -54,13 +51,9 @@ CServerProtocol::getOutputStream() const
|
||||
}
|
||||
|
||||
IServerProtocol*
|
||||
CServerProtocol::create(
|
||||
SInt32 major,
|
||||
SInt32 minor,
|
||||
CServer* server,
|
||||
const CString& client,
|
||||
IInputStream* input,
|
||||
IOutputStream* output)
|
||||
CServerProtocol::create(SInt32 major, SInt32 minor,
|
||||
CServer* server, const CString& client,
|
||||
IInputStream* input, IOutputStream* output)
|
||||
{
|
||||
// disallow invalid version numbers
|
||||
if (major < 0 || minor < 0) {
|
||||
|
@ -14,11 +14,8 @@
|
||||
// CServerProtocol1_0
|
||||
//
|
||||
|
||||
CServerProtocol1_0::CServerProtocol1_0(
|
||||
CServer* server,
|
||||
const CString& client,
|
||||
IInputStream* input,
|
||||
IOutputStream* output) :
|
||||
CServerProtocol1_0::CServerProtocol1_0(CServer* server, const CString& client,
|
||||
IInputStream* input, IOutputStream* output) :
|
||||
CServerProtocol(server, client, input, output)
|
||||
{
|
||||
// do nothing
|
||||
@ -106,11 +103,8 @@ CServerProtocol1_0::sendClose()
|
||||
}
|
||||
|
||||
void
|
||||
CServerProtocol1_0::sendEnter(
|
||||
SInt32 xAbs,
|
||||
SInt32 yAbs,
|
||||
UInt32 seqNum,
|
||||
KeyModifierMask mask)
|
||||
CServerProtocol1_0::sendEnter(SInt32 xAbs, SInt32 yAbs,
|
||||
UInt32 seqNum, KeyModifierMask mask)
|
||||
{
|
||||
log((CLOG_DEBUG1 "send enter to \"%s\", %d,%d %d %04x", getClient().c_str(), xAbs, yAbs, seqNum, mask));
|
||||
CProtocolUtil::writef(getOutputStream(), kMsgCEnter,
|
||||
@ -125,25 +119,21 @@ CServerProtocol1_0::sendLeave()
|
||||
}
|
||||
|
||||
void
|
||||
CServerProtocol1_0::sendClipboard(
|
||||
ClipboardID id,
|
||||
const CString& data)
|
||||
CServerProtocol1_0::sendClipboard(ClipboardID id, const CString& data)
|
||||
{
|
||||
log((CLOG_DEBUG "send clipboard %d to \"%s\" size=%d", id, getClient().c_str(), data.size()));
|
||||
CProtocolUtil::writef(getOutputStream(), kMsgDClipboard, id, 0, &data);
|
||||
}
|
||||
|
||||
void
|
||||
CServerProtocol1_0::sendGrabClipboard(
|
||||
ClipboardID id)
|
||||
CServerProtocol1_0::sendGrabClipboard(ClipboardID id)
|
||||
{
|
||||
log((CLOG_DEBUG "send grab clipboard %d to \"%s\"", id, getClient().c_str()));
|
||||
CProtocolUtil::writef(getOutputStream(), kMsgCClipboard, id, 0);
|
||||
}
|
||||
|
||||
void
|
||||
CServerProtocol1_0::sendScreenSaver(
|
||||
bool on)
|
||||
CServerProtocol1_0::sendScreenSaver(bool on)
|
||||
{
|
||||
log((CLOG_DEBUG1 "send screen saver to \"%s\" on=%d", getClient().c_str(), on ? 1 : 0));
|
||||
CProtocolUtil::writef(getOutputStream(), kMsgCScreenSaver, on ? 1 : 0);
|
||||
@ -157,61 +147,49 @@ CServerProtocol1_0::sendInfoAcknowledgment()
|
||||
}
|
||||
|
||||
void
|
||||
CServerProtocol1_0::sendKeyDown(
|
||||
KeyID key,
|
||||
KeyModifierMask mask)
|
||||
CServerProtocol1_0::sendKeyDown(KeyID key, KeyModifierMask mask)
|
||||
{
|
||||
log((CLOG_DEBUG1 "send key down to \"%s\" id=%d, mask=0x%04x", getClient().c_str(), key, mask));
|
||||
CProtocolUtil::writef(getOutputStream(), kMsgDKeyDown, key, mask);
|
||||
}
|
||||
|
||||
void
|
||||
CServerProtocol1_0::sendKeyRepeat(
|
||||
KeyID key,
|
||||
KeyModifierMask mask,
|
||||
SInt32 count)
|
||||
CServerProtocol1_0::sendKeyRepeat(KeyID key, KeyModifierMask mask, SInt32 count)
|
||||
{
|
||||
log((CLOG_DEBUG1 "send key repeat to \"%s\" id=%d, mask=0x%04x, count=%d", getClient().c_str(), key, mask, count));
|
||||
CProtocolUtil::writef(getOutputStream(), kMsgDKeyRepeat, key, mask, count);
|
||||
}
|
||||
|
||||
void
|
||||
CServerProtocol1_0::sendKeyUp(
|
||||
KeyID key,
|
||||
KeyModifierMask mask)
|
||||
CServerProtocol1_0::sendKeyUp(KeyID key, KeyModifierMask mask)
|
||||
{
|
||||
log((CLOG_DEBUG1 "send key up to \"%s\" id=%d, mask=0x%04x", getClient().c_str(), key, mask));
|
||||
CProtocolUtil::writef(getOutputStream(), kMsgDKeyUp, key, mask);
|
||||
}
|
||||
|
||||
void
|
||||
CServerProtocol1_0::sendMouseDown(
|
||||
ButtonID button)
|
||||
CServerProtocol1_0::sendMouseDown(ButtonID button)
|
||||
{
|
||||
log((CLOG_DEBUG1 "send mouse down to \"%s\" id=%d", getClient().c_str(), button));
|
||||
CProtocolUtil::writef(getOutputStream(), kMsgDMouseDown, button);
|
||||
}
|
||||
|
||||
void
|
||||
CServerProtocol1_0::sendMouseUp(
|
||||
ButtonID button)
|
||||
CServerProtocol1_0::sendMouseUp(ButtonID button)
|
||||
{
|
||||
log((CLOG_DEBUG1 "send mouse up to \"%s\" id=%d", getClient().c_str(), button));
|
||||
CProtocolUtil::writef(getOutputStream(), kMsgDMouseUp, button);
|
||||
}
|
||||
|
||||
void
|
||||
CServerProtocol1_0::sendMouseMove(
|
||||
SInt32 xAbs,
|
||||
SInt32 yAbs)
|
||||
CServerProtocol1_0::sendMouseMove(SInt32 xAbs, SInt32 yAbs)
|
||||
{
|
||||
log((CLOG_DEBUG2 "send mouse move to \"%s\" %d,%d", getClient().c_str(), xAbs, yAbs));
|
||||
CProtocolUtil::writef(getOutputStream(), kMsgDMouseMove, xAbs, yAbs);
|
||||
}
|
||||
|
||||
void
|
||||
CServerProtocol1_0::sendMouseWheel(
|
||||
SInt32 delta)
|
||||
CServerProtocol1_0::sendMouseWheel(SInt32 delta)
|
||||
{
|
||||
log((CLOG_DEBUG2 "send mouse wheel to \"%s\" %+d", getClient().c_str(), delta));
|
||||
CProtocolUtil::writef(getOutputStream(), kMsgDMouseWheel, delta);
|
||||
|
@ -89,10 +89,7 @@ restoreCursor()
|
||||
|
||||
static
|
||||
LRESULT CALLBACK
|
||||
keyboardHook(
|
||||
int code,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
keyboardHook(int code, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (code >= 0) {
|
||||
if (g_relay) {
|
||||
@ -121,10 +118,7 @@ keyboardHook(
|
||||
|
||||
static
|
||||
LRESULT CALLBACK
|
||||
mouseHook(
|
||||
int code,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
mouseHook(int code, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (code >= 0) {
|
||||
if (g_relay) {
|
||||
@ -228,10 +222,7 @@ mouseHook(
|
||||
|
||||
static
|
||||
LRESULT CALLBACK
|
||||
cbtHook(
|
||||
int code,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
cbtHook(int code, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (code >= 0) {
|
||||
if (g_relay) {
|
||||
@ -244,10 +235,7 @@ cbtHook(
|
||||
|
||||
static
|
||||
LRESULT CALLBACK
|
||||
getMessageHook(
|
||||
int code,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
getMessageHook(int code, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (code >= 0) {
|
||||
if (g_relay) {
|
||||
@ -277,10 +265,7 @@ getMessageHook(
|
||||
|
||||
static
|
||||
LRESULT CALLBACK
|
||||
keyboardLLHook(
|
||||
int code,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
keyboardLLHook(int code, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (code >= 0) {
|
||||
if (g_relay) {
|
||||
@ -326,8 +311,7 @@ keyboardLLHook(
|
||||
|
||||
static
|
||||
DWORD WINAPI
|
||||
getKeyboardLLProc(
|
||||
void*)
|
||||
getKeyboardLLProc(void*)
|
||||
{
|
||||
// thread proc for low-level keyboard hook. this does nothing but
|
||||
// install the hook, process events, and uninstall the hook.
|
||||
@ -382,8 +366,7 @@ getKeyboardLLProc(
|
||||
|
||||
static
|
||||
DWORD WINAPI
|
||||
getKeyboardLLProc(
|
||||
void*)
|
||||
getKeyboardLLProc(void*)
|
||||
{
|
||||
g_keyHookThreadID = 0;
|
||||
SetEvent(g_keyHookEvent);
|
||||
@ -441,10 +424,7 @@ getWheelSupport()
|
||||
//
|
||||
|
||||
BOOL WINAPI
|
||||
DllMain(
|
||||
HINSTANCE instance,
|
||||
DWORD reason,
|
||||
LPVOID)
|
||||
DllMain(HINSTANCE instance, DWORD reason, LPVOID)
|
||||
{
|
||||
if (reason == DLL_PROCESS_ATTACH) {
|
||||
if (g_hinstance == NULL) {
|
||||
@ -466,8 +446,7 @@ DllMain(
|
||||
extern "C" {
|
||||
|
||||
int
|
||||
install(
|
||||
DWORD threadID)
|
||||
install(DWORD threadID)
|
||||
{
|
||||
assert(g_threadID == 0);
|
||||
assert(g_hinstance != NULL);
|
||||
@ -571,8 +550,7 @@ install(
|
||||
}
|
||||
|
||||
int
|
||||
uninstall(
|
||||
void)
|
||||
uninstall(void)
|
||||
{
|
||||
assert(g_keyboard != NULL);
|
||||
assert(g_mouse != NULL);
|
||||
@ -607,11 +585,7 @@ uninstall(
|
||||
}
|
||||
|
||||
void
|
||||
setZone(
|
||||
UInt32 sides,
|
||||
SInt32 w,
|
||||
SInt32 h,
|
||||
SInt32 jumpZoneSize)
|
||||
setZone(UInt32 sides, SInt32 w, SInt32 h, SInt32 jumpZoneSize)
|
||||
{
|
||||
g_zoneSize = jumpZoneSize;
|
||||
g_zoneSides = sides;
|
||||
@ -622,8 +596,7 @@ setZone(
|
||||
}
|
||||
|
||||
void
|
||||
setRelay(
|
||||
void)
|
||||
setRelay(void)
|
||||
{
|
||||
g_relay = true;
|
||||
g_zoneSize = 0;
|
||||
|
@ -194,8 +194,7 @@ CXWindowsPrimaryScreen::stop()
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsPrimaryScreen::open(
|
||||
CServer* server)
|
||||
CXWindowsPrimaryScreen::open(CServer* server)
|
||||
{
|
||||
assert(m_server == NULL);
|
||||
assert(server != NULL);
|
||||
@ -252,9 +251,7 @@ CXWindowsPrimaryScreen::close()
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsPrimaryScreen::enter(
|
||||
SInt32 x,
|
||||
SInt32 y)
|
||||
CXWindowsPrimaryScreen::enter(SInt32 x, SInt32 y)
|
||||
{
|
||||
log((CLOG_INFO "entering primary at %d,%d", x, y));
|
||||
assert(m_active == true);
|
||||
@ -356,19 +353,14 @@ CXWindowsPrimaryScreen::onConfigure()
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsPrimaryScreen::warpCursor(
|
||||
SInt32 x,
|
||||
SInt32 y)
|
||||
CXWindowsPrimaryScreen::warpCursor(SInt32 x, SInt32 y)
|
||||
{
|
||||
CDisplayLock display(this);
|
||||
warpCursorNoLock(display, x, y);
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsPrimaryScreen::warpCursorNoLock(
|
||||
Display* display,
|
||||
SInt32 x,
|
||||
SInt32 y)
|
||||
CXWindowsPrimaryScreen::warpCursorNoLock(Display* display, SInt32 x, SInt32 y)
|
||||
{
|
||||
assert(display != NULL);
|
||||
assert(m_window != None);
|
||||
@ -387,24 +379,20 @@ CXWindowsPrimaryScreen::warpCursorNoLock(
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsPrimaryScreen::setClipboard(
|
||||
ClipboardID id,
|
||||
const IClipboard* clipboard)
|
||||
CXWindowsPrimaryScreen::setClipboard(ClipboardID id,
|
||||
const IClipboard* clipboard)
|
||||
{
|
||||
setDisplayClipboard(id, clipboard);
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsPrimaryScreen::grabClipboard(
|
||||
ClipboardID id)
|
||||
CXWindowsPrimaryScreen::grabClipboard(ClipboardID id)
|
||||
{
|
||||
setDisplayClipboard(id, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsPrimaryScreen::getSize(
|
||||
SInt32* width,
|
||||
SInt32* height) const
|
||||
CXWindowsPrimaryScreen::getSize(SInt32* width, SInt32* height) const
|
||||
{
|
||||
getScreenSize(width, height);
|
||||
}
|
||||
@ -416,9 +404,8 @@ CXWindowsPrimaryScreen::getJumpZoneSize() const
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsPrimaryScreen::getClipboard(
|
||||
ClipboardID id,
|
||||
IClipboard* clipboard) const
|
||||
CXWindowsPrimaryScreen::getClipboard(ClipboardID id,
|
||||
IClipboard* clipboard) const
|
||||
{
|
||||
getDisplayClipboard(id, clipboard);
|
||||
}
|
||||
@ -484,8 +471,7 @@ CXWindowsPrimaryScreen::isLockedToScreen() const
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsPrimaryScreen::onOpenDisplay(
|
||||
Display* display)
|
||||
CXWindowsPrimaryScreen::onOpenDisplay(Display* display)
|
||||
{
|
||||
assert(m_window == None);
|
||||
|
||||
@ -516,16 +502,14 @@ CXWindowsPrimaryScreen::onOpenDisplay(
|
||||
}
|
||||
|
||||
CXWindowsClipboard*
|
||||
CXWindowsPrimaryScreen::createClipboard(
|
||||
ClipboardID id)
|
||||
CXWindowsPrimaryScreen::createClipboard(ClipboardID id)
|
||||
{
|
||||
CDisplayLock display(this);
|
||||
return new CXWindowsClipboard(display, m_window, id);
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsPrimaryScreen::onCloseDisplay(
|
||||
Display* display)
|
||||
CXWindowsPrimaryScreen::onCloseDisplay(Display* display)
|
||||
{
|
||||
assert(m_window != None);
|
||||
|
||||
@ -546,17 +530,14 @@ CXWindowsPrimaryScreen::onUnexpectedClose()
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsPrimaryScreen::onLostClipboard(
|
||||
ClipboardID id)
|
||||
CXWindowsPrimaryScreen::onLostClipboard(ClipboardID id)
|
||||
{
|
||||
// tell server that the clipboard was grabbed locally
|
||||
m_server->grabClipboard(id);
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsPrimaryScreen::selectEvents(
|
||||
Display* display,
|
||||
Window w) const
|
||||
CXWindowsPrimaryScreen::selectEvents(Display* display, Window w) const
|
||||
{
|
||||
// ignore errors while we adjust event masks
|
||||
CXWindowsUtil::CErrorLock lock;
|
||||
@ -566,9 +547,7 @@ CXWindowsPrimaryScreen::selectEvents(
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsPrimaryScreen::doSelectEvents(
|
||||
Display* display,
|
||||
Window w) const
|
||||
CXWindowsPrimaryScreen::doSelectEvents(Display* display, Window w) const
|
||||
{
|
||||
// we want to track the mouse everywhere on the display. to achieve
|
||||
// that we select PointerMotionMask on every window. we also select
|
||||
@ -595,8 +574,7 @@ CXWindowsPrimaryScreen::doSelectEvents(
|
||||
}
|
||||
|
||||
KeyModifierMask
|
||||
CXWindowsPrimaryScreen::mapModifier(
|
||||
unsigned int state) const
|
||||
CXWindowsPrimaryScreen::mapModifier(unsigned int state) const
|
||||
{
|
||||
// FIXME -- should be configurable
|
||||
KeyModifierMask mask = 0;
|
||||
@ -618,8 +596,7 @@ CXWindowsPrimaryScreen::mapModifier(
|
||||
}
|
||||
|
||||
KeyID
|
||||
CXWindowsPrimaryScreen::mapKey(
|
||||
XKeyEvent* event) const
|
||||
CXWindowsPrimaryScreen::mapKey(XKeyEvent* event) const
|
||||
{
|
||||
KeySym keysym;
|
||||
char dummy[1];
|
||||
@ -630,8 +607,7 @@ CXWindowsPrimaryScreen::mapKey(
|
||||
}
|
||||
|
||||
ButtonID
|
||||
CXWindowsPrimaryScreen::mapButton(
|
||||
unsigned int button) const
|
||||
CXWindowsPrimaryScreen::mapButton(unsigned int button) const
|
||||
{
|
||||
// FIXME -- should use button mapping?
|
||||
if (button >= 1 && button <= 3) {
|
||||
@ -643,8 +619,7 @@ CXWindowsPrimaryScreen::mapButton(
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsPrimaryScreen::updateModifierMap(
|
||||
Display* display)
|
||||
CXWindowsPrimaryScreen::updateModifierMap(Display* display)
|
||||
{
|
||||
// get modifier map from server
|
||||
XModifierKeymap* keymap = XGetModifierMapping(display);
|
||||
@ -679,10 +654,7 @@ CXWindowsPrimaryScreen::updateModifierMap(
|
||||
}
|
||||
|
||||
Bool
|
||||
CXWindowsPrimaryScreen::findKeyEvent(
|
||||
Display*,
|
||||
XEvent* xevent,
|
||||
XPointer arg)
|
||||
CXWindowsPrimaryScreen::findKeyEvent(Display*, XEvent* xevent, XPointer arg)
|
||||
{
|
||||
CKeyEventInfo* filter = reinterpret_cast<CKeyEventInfo*>(arg);
|
||||
return (xevent->type == filter->m_event &&
|
||||
|
@ -54,8 +54,7 @@ static CMutex* s_logMutex = NULL;
|
||||
|
||||
static
|
||||
void
|
||||
logLock(
|
||||
bool lock)
|
||||
logLock(bool lock)
|
||||
{
|
||||
assert(s_logMutex != NULL);
|
||||
|
||||
@ -76,8 +75,7 @@ static CServer* s_server = NULL;
|
||||
|
||||
static
|
||||
int
|
||||
realMain(
|
||||
CMutex* mutex)
|
||||
realMain(CMutex* mutex)
|
||||
{
|
||||
// s_serverLock should have mutex locked on entry
|
||||
|
||||
@ -293,12 +291,9 @@ PLATFORM_EXTRA
|
||||
|
||||
static
|
||||
bool
|
||||
isArg(int argi,
|
||||
int argc,
|
||||
const char** argv,
|
||||
const char* name1,
|
||||
const char* name2,
|
||||
int minRequiredParameters = 0)
|
||||
isArg(int argi, int argc, const char** argv,
|
||||
const char* name1, const char* name2,
|
||||
int minRequiredParameters = 0)
|
||||
{
|
||||
if ((name1 != NULL && strcmp(argv[argi], name1) == 0) ||
|
||||
(name2 != NULL && strcmp(argv[argi], name2) == 0)) {
|
||||
@ -317,9 +312,7 @@ isArg(int argi,
|
||||
|
||||
static
|
||||
void
|
||||
parse(
|
||||
int argc,
|
||||
const char** argv)
|
||||
parse(int argc, const char** argv)
|
||||
{
|
||||
assert(pname != NULL);
|
||||
assert(argv != NULL);
|
||||
@ -480,9 +473,7 @@ parse(
|
||||
|
||||
static
|
||||
bool
|
||||
loadConfig(
|
||||
const char* pathname,
|
||||
bool require)
|
||||
loadConfig(const char* pathname, bool require)
|
||||
{
|
||||
assert(pathname != NULL);
|
||||
|
||||
@ -556,9 +547,7 @@ loadConfig()
|
||||
|
||||
static
|
||||
bool
|
||||
logMessageBox(
|
||||
int priority,
|
||||
const char* msg)
|
||||
logMessageBox(int priority, const char* msg)
|
||||
{
|
||||
if (priority <= CLog::kFATAL) {
|
||||
MessageBox(NULL, msg, pname, MB_OK | MB_ICONWARNING);
|
||||
@ -585,10 +574,7 @@ daemonStop(void)
|
||||
|
||||
static
|
||||
int
|
||||
daemonStartup(
|
||||
IPlatform* iplatform,
|
||||
int argc,
|
||||
const char** argv)
|
||||
daemonStartup(IPlatform* iplatform, int argc, const char** argv)
|
||||
{
|
||||
// get platform pointer
|
||||
CWin32Platform* platform = static_cast<CWin32Platform*>(iplatform);
|
||||
@ -614,9 +600,7 @@ daemonStartup(
|
||||
|
||||
static
|
||||
bool
|
||||
logDiscard(
|
||||
int,
|
||||
const char*)
|
||||
logDiscard(int, const char*)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -636,11 +620,7 @@ checkParse(int e)
|
||||
}
|
||||
|
||||
int WINAPI
|
||||
WinMain(
|
||||
HINSTANCE instance,
|
||||
HINSTANCE,
|
||||
LPSTR,
|
||||
int)
|
||||
WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int)
|
||||
{
|
||||
CPlatform platform;
|
||||
|
||||
@ -779,18 +759,13 @@ WinMain(
|
||||
|
||||
static
|
||||
int
|
||||
daemonStartup(
|
||||
IPlatform*,
|
||||
int,
|
||||
const char**)
|
||||
daemonStartup(IPlatform*, int, const char**)
|
||||
{
|
||||
return restartableMain();
|
||||
}
|
||||
|
||||
int
|
||||
main(
|
||||
int argc,
|
||||
char** argv)
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
CPlatform platform;
|
||||
|
||||
|
@ -39,9 +39,7 @@ CClipboard::empty()
|
||||
}
|
||||
|
||||
void
|
||||
CClipboard::add(
|
||||
EFormat format,
|
||||
const CString& data)
|
||||
CClipboard::add(EFormat format, const CString& data)
|
||||
{
|
||||
assert(m_open);
|
||||
assert(m_owner);
|
||||
@ -51,8 +49,7 @@ CClipboard::add(
|
||||
}
|
||||
|
||||
bool
|
||||
CClipboard::open(
|
||||
Time time) const
|
||||
CClipboard::open(Time time) const
|
||||
{
|
||||
assert(!m_open);
|
||||
|
||||
@ -77,25 +74,21 @@ CClipboard::getTime() const
|
||||
}
|
||||
|
||||
bool
|
||||
CClipboard::has(
|
||||
EFormat format) const
|
||||
CClipboard::has(EFormat format) const
|
||||
{
|
||||
assert(m_open);
|
||||
return m_added[format];
|
||||
}
|
||||
|
||||
CString
|
||||
CClipboard::get(
|
||||
EFormat format) const
|
||||
CClipboard::get(EFormat format) const
|
||||
{
|
||||
assert(m_open);
|
||||
return m_data[format];
|
||||
}
|
||||
|
||||
bool
|
||||
CClipboard::copy(
|
||||
IClipboard* dst,
|
||||
const IClipboard* src)
|
||||
CClipboard::copy(IClipboard* dst, const IClipboard* src)
|
||||
{
|
||||
assert(dst != NULL);
|
||||
assert(src != NULL);
|
||||
@ -104,10 +97,7 @@ CClipboard::copy(
|
||||
}
|
||||
|
||||
bool
|
||||
CClipboard::copy(
|
||||
IClipboard* dst,
|
||||
const IClipboard* src,
|
||||
Time time)
|
||||
CClipboard::copy(IClipboard* dst, const IClipboard* src, Time time)
|
||||
{
|
||||
assert(dst != NULL);
|
||||
assert(src != NULL);
|
||||
@ -134,9 +124,7 @@ CClipboard::copy(
|
||||
}
|
||||
|
||||
void
|
||||
CClipboard::unmarshall(
|
||||
const CString& data,
|
||||
Time time)
|
||||
CClipboard::unmarshall(const CString& data, Time time)
|
||||
{
|
||||
const char* index = data.data();
|
||||
|
||||
@ -201,8 +189,7 @@ CClipboard::marshall() const
|
||||
}
|
||||
|
||||
UInt32
|
||||
CClipboard::readUInt32(
|
||||
const char* buf) const
|
||||
CClipboard::readUInt32(const char* buf) const
|
||||
{
|
||||
const unsigned char* ubuf = reinterpret_cast<const unsigned char*>(buf);
|
||||
return (static_cast<UInt32>(ubuf[0]) << 24) |
|
||||
@ -212,9 +199,7 @@ CClipboard::readUInt32(
|
||||
}
|
||||
|
||||
void
|
||||
CClipboard::writeUInt32(
|
||||
CString* buf,
|
||||
UInt32 v) const
|
||||
CClipboard::writeUInt32(CString* buf, UInt32 v) const
|
||||
{
|
||||
*buf += static_cast<UInt8>((v >> 24) & 0xff);
|
||||
*buf += static_cast<UInt8>((v >> 16) & 0xff);
|
||||
|
@ -5,9 +5,7 @@
|
||||
// CInputPacketStream
|
||||
//
|
||||
|
||||
CInputPacketStream::CInputPacketStream(
|
||||
IInputStream* stream,
|
||||
bool adopt) :
|
||||
CInputPacketStream::CInputPacketStream(IInputStream* stream, bool adopt) :
|
||||
CInputStreamFilter(stream, adopt),
|
||||
m_mutex(),
|
||||
m_size(0),
|
||||
@ -28,9 +26,7 @@ CInputPacketStream::close()
|
||||
}
|
||||
|
||||
UInt32
|
||||
CInputPacketStream::read(
|
||||
void* buffer,
|
||||
UInt32 n)
|
||||
CInputPacketStream::read(void* buffer, UInt32 n)
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
|
||||
|
@ -4,9 +4,7 @@
|
||||
// COuputPacketStream
|
||||
//
|
||||
|
||||
COutputPacketStream::COutputPacketStream(
|
||||
IOutputStream* stream,
|
||||
bool adopt) :
|
||||
COutputPacketStream::COutputPacketStream(IOutputStream* stream, bool adopt) :
|
||||
COutputStreamFilter(stream, adopt)
|
||||
{
|
||||
// do nothing
|
||||
@ -24,9 +22,7 @@ COutputPacketStream::close()
|
||||
}
|
||||
|
||||
UInt32
|
||||
COutputPacketStream::write(
|
||||
const void* buffer,
|
||||
UInt32 count)
|
||||
COutputPacketStream::write(const void* buffer, UInt32 count)
|
||||
{
|
||||
// write the length of the payload
|
||||
UInt8 length[4];
|
||||
|
@ -10,10 +10,7 @@
|
||||
//
|
||||
|
||||
void
|
||||
CProtocolUtil::writef(
|
||||
IOutputStream* stream,
|
||||
const char* fmt,
|
||||
...)
|
||||
CProtocolUtil::writef(IOutputStream* stream, const char* fmt, ...)
|
||||
{
|
||||
assert(stream != NULL);
|
||||
assert(fmt != NULL);
|
||||
@ -50,10 +47,7 @@ CProtocolUtil::writef(
|
||||
}
|
||||
|
||||
void
|
||||
CProtocolUtil::readf(
|
||||
IInputStream* stream,
|
||||
const char* fmt,
|
||||
...)
|
||||
CProtocolUtil::readf(IInputStream* stream, const char* fmt, ...)
|
||||
{
|
||||
assert(stream != NULL);
|
||||
assert(fmt != NULL);
|
||||
@ -185,9 +179,7 @@ CProtocolUtil::readf(
|
||||
}
|
||||
|
||||
UInt32
|
||||
CProtocolUtil::getLength(
|
||||
const char* fmt,
|
||||
va_list args)
|
||||
CProtocolUtil::getLength(const char* fmt, va_list args)
|
||||
{
|
||||
UInt32 n = 0;
|
||||
while (*fmt) {
|
||||
@ -236,10 +228,7 @@ CProtocolUtil::getLength(
|
||||
}
|
||||
|
||||
void
|
||||
CProtocolUtil::writef(
|
||||
void* buffer,
|
||||
const char* fmt,
|
||||
va_list args)
|
||||
CProtocolUtil::writef(void* buffer, const char* fmt, va_list args)
|
||||
{
|
||||
UInt8* dst = reinterpret_cast<UInt8*>(buffer);
|
||||
|
||||
@ -326,8 +315,7 @@ CProtocolUtil::writef(
|
||||
}
|
||||
|
||||
UInt32
|
||||
CProtocolUtil::eatLength(
|
||||
const char** pfmt)
|
||||
CProtocolUtil::eatLength(const char** pfmt)
|
||||
{
|
||||
const char* fmt = *pfmt;
|
||||
UInt32 n = 0;
|
||||
@ -352,10 +340,7 @@ CProtocolUtil::eatLength(
|
||||
}
|
||||
|
||||
void
|
||||
CProtocolUtil::read(
|
||||
IInputStream* stream,
|
||||
void* vbuffer,
|
||||
UInt32 count)
|
||||
CProtocolUtil::read(IInputStream* stream, void* vbuffer, UInt32 count)
|
||||
{
|
||||
assert(stream != NULL);
|
||||
assert(vbuffer != NULL);
|
||||
|
@ -15,9 +15,7 @@ XBadClient::getWhat() const throw()
|
||||
// XIncompatibleClient
|
||||
//
|
||||
|
||||
XIncompatibleClient::XIncompatibleClient(
|
||||
int major,
|
||||
int minor) :
|
||||
XIncompatibleClient::XIncompatibleClient(int major, int minor) :
|
||||
m_major(major),
|
||||
m_minor(minor)
|
||||
{
|
||||
@ -47,8 +45,7 @@ XIncompatibleClient::getWhat() const throw()
|
||||
// XDuplicateClient
|
||||
//
|
||||
|
||||
XDuplicateClient::XDuplicateClient(
|
||||
const CString& name) :
|
||||
XDuplicateClient::XDuplicateClient(const CString& name) :
|
||||
m_name(name)
|
||||
{
|
||||
// do nothing
|
||||
@ -71,8 +68,7 @@ XDuplicateClient::getWhat() const throw()
|
||||
// XUnknownClient
|
||||
//
|
||||
|
||||
XUnknownClient::XUnknownClient(
|
||||
const CString& name) :
|
||||
XUnknownClient::XUnknownClient(const CString& name) :
|
||||
m_name(name)
|
||||
{
|
||||
// do nothing
|
||||
|
Loading…
Reference in New Issue
Block a user