formatting changes.

This commit is contained in:
crs
2002-06-17 13:31:21 +00:00
parent 57fb87ad10
commit fe16546a1d
46 changed files with 485 additions and 1214 deletions

View File

@@ -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);

View File

@@ -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)) {

View File

@@ -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:

View File

@@ -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;