applied refactoring to win32 code.

This commit is contained in:
crs
2002-07-11 13:13:37 +00:00
parent 3468f3d503
commit feeb15a08d
18 changed files with 201 additions and 164 deletions

View File

@@ -191,8 +191,7 @@ CClient::close()
}
void
CClient::enter(SInt32 xAbs, SInt32 yAbs,
UInt32 seqNum, KeyModifierMask mask, bool)
CClient::enter(SInt32 xAbs, SInt32 yAbs, UInt32, KeyModifierMask mask, bool)
{
{
CLock lock(&m_mutex);
@@ -216,6 +215,8 @@ CClient::leave()
sendClipboard(id);
}
}
return true;
}
void

View File

@@ -1,5 +1,5 @@
#include "CMSWindowsSecondaryScreen.h"
#include "CClient.h"
#include "IScreenReceiver.h"
#include "CClipboard.h"
#include "CMSWindowsClipboard.h"
#include "CMSWindowsScreenSaver.h"
@@ -22,8 +22,9 @@
// CMSWindowsSecondaryScreen
//
CMSWindowsSecondaryScreen::CMSWindowsSecondaryScreen() :
m_client(NULL),
CMSWindowsSecondaryScreen::CMSWindowsSecondaryScreen(
IScreenReceiver* receiver) :
m_receiver(receiver),
m_threadID(0),
m_lastThreadID(0),
m_desk(NULL),
@@ -32,6 +33,8 @@ CMSWindowsSecondaryScreen::CMSWindowsSecondaryScreen() :
m_active(false),
m_nextClipboardWindow(NULL)
{
assert(m_receiver != NULL);
m_is95Family = CPlatform::isWindows95Family();
// make sure this thread has a message queue
@@ -78,14 +81,8 @@ CMSWindowsSecondaryScreen::stop()
}
void
CMSWindowsSecondaryScreen::open(CClient* client)
CMSWindowsSecondaryScreen::open()
{
assert(m_client == NULL);
assert(client != NULL);
// set the client
m_client = client;
// open the display
openDisplay();
@@ -109,8 +106,6 @@ CMSWindowsSecondaryScreen::open(CClient* client)
void
CMSWindowsSecondaryScreen::close()
{
assert(m_client != NULL);
// release keys that are logically pressed
releaseKeys();
@@ -119,9 +114,6 @@ CMSWindowsSecondaryScreen::close()
// close the display
closeDisplay();
// done with client
m_client = NULL;
}
void
@@ -189,8 +181,8 @@ CMSWindowsSecondaryScreen::leave()
if (m_clipboardOwner != clipboardOwner) {
m_clipboardOwner = clipboardOwner;
if (m_clipboardOwner != m_window) {
m_client->onClipboardChanged(kClipboardClipboard);
m_client->onClipboardChanged(kClipboardSelection);
m_receiver->onGrabClipboard(kClipboardClipboard);
m_receiver->onGrabClipboard(kClipboardSelection);
}
}
}
@@ -555,8 +547,8 @@ CMSWindowsSecondaryScreen::onEvent(HWND hwnd, UINT msg,
// window to do that).
m_clipboardOwner = GetClipboardOwner();
if (m_clipboardOwner != m_window && m_clipboardOwner != NULL) {
m_client->onClipboardChanged(kClipboardClipboard);
m_client->onClipboardChanged(kClipboardSelection);
m_receiver->onGrabClipboard(kClipboardClipboard);
m_receiver->onGrabClipboard(kClipboardSelection);
}
return 0;
@@ -573,7 +565,13 @@ CMSWindowsSecondaryScreen::onEvent(HWND hwnd, UINT msg,
// screen resolution has changed
updateScreenShape();
m_multimon = isMultimon();
m_client->onResolutionChanged();
// send new info
CClientInfo info;
getShape(info.m_x, info.m_y, info.m_w, info.m_h);
getMousePos(info.m_mx, info.m_my);
info.m_zoneSize = getJumpZoneSize();
m_receiver->onInfoChanged(info);
return 0;
}

View File

@@ -13,16 +13,18 @@
#include "CString.h"
#include "stdvector.h"
class IScreenReceiver;
class CMSWindowsSecondaryScreen : public CMSWindowsScreen,
public ISecondaryScreen {
public:
CMSWindowsSecondaryScreen();
CMSWindowsSecondaryScreen(IScreenReceiver*);
virtual ~CMSWindowsSecondaryScreen();
// ISecondaryScreen overrides
virtual void run();
virtual void stop();
virtual void open(CClient*);
virtual void open();
virtual void close();
virtual void enter(SInt32 xAbsolute, SInt32 yAbsolute,
KeyModifierMask mask);
@@ -95,7 +97,7 @@ private:
private:
CMutex m_mutex;
CClient* m_client;
IScreenReceiver* m_receiver;
// true if windows 95/98/me
bool m_is95Family;

View File

@@ -239,6 +239,7 @@ CServerProxy::onGrabClipboard(ClipboardID id)
log((CLOG_DEBUG1 "sending clipboard %d changed", id));
CLock lock(&m_mutex);
CProtocolUtil::writef(getOutputStream(), kMsgCClipboard, id, m_seqNum);
return true;
}
void
@@ -253,7 +254,7 @@ void
CServerProxy::flushCompressedMouse()
{
bool send = false;
SInt32 x, y;
SInt32 x = 0, y = 0;
{
CLock lock(&m_mutex);
if (m_compressMouse) {

View File

@@ -108,6 +108,10 @@ SOURCE=.\client.rc
SOURCE=.\CMSWindowsSecondaryScreen.cpp
# End Source File
# Begin Source File
SOURCE=.\CServerProxy.cpp
# End Source File
# End Group
# Begin Group "Header Files"
@@ -120,6 +124,18 @@ SOURCE=.\CClient.h
SOURCE=.\CMSWindowsSecondaryScreen.h
# End Source File
# Begin Source File
SOURCE=.\CServerProxy.h
# End Source File
# Begin Source File
SOURCE=.\ISecondaryScreen.h
# End Source File
# Begin Source File
SOURCE=.\resource.h
# End Source File
# End Group
# Begin Group "Resource Files"