Integrated fixes from 1.0 branch.

This commit is contained in:
crs 2003-08-06 21:09:25 +00:00
parent 345de4cd11
commit 2f9cdfd1b2
7 changed files with 34 additions and 11 deletions

View File

@ -36,6 +36,7 @@ CAdvancedOptions::CAdvancedOptions(HWND parent, CConfig* config) :
{ {
assert(s_singleton == NULL); assert(s_singleton == NULL);
s_singleton = this; s_singleton = this;
init();
} }
CAdvancedOptions::~CAdvancedOptions() CAdvancedOptions::~CAdvancedOptions()
@ -95,7 +96,7 @@ CAdvancedOptions::getCommandLine(bool isClient, const CString& serverName) const
} }
void void
CAdvancedOptions::init(HWND hwnd) CAdvancedOptions::init()
{ {
// get values from registry // get values from registry
HKEY key = CArchMiscWindows::openKey(HKEY_CURRENT_USER, getSettingsPath()); HKEY key = CArchMiscWindows::openKey(HKEY_CURRENT_USER, getSettingsPath());
@ -110,9 +111,6 @@ CAdvancedOptions::init(HWND hwnd)
} }
CArchMiscWindows::closeKey(key); CArchMiscWindows::closeKey(key);
} }
// now set GUI
doInit(hwnd);
} }
void void
@ -194,7 +192,7 @@ CAdvancedOptions::doDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM)
{ {
switch (message) { switch (message) {
case WM_INITDIALOG: case WM_INITDIALOG:
init(hwnd); doInit(hwnd);
return TRUE; return TRUE;
case WM_COMMAND: case WM_COMMAND:

View File

@ -54,7 +54,7 @@ public:
//@} //@}
private: private:
void init(HWND hwnd); void init();
void doInit(HWND hwnd); void doInit(HWND hwnd);
bool save(HWND hwnd); bool save(HWND hwnd);
void setDefaults(HWND hwnd); void setDefaults(HWND hwnd);

View File

@ -190,7 +190,7 @@ CMSWindowsClientTaskBarReceiver::copyLog() const
if (!data.empty()) { if (!data.empty()) {
CMSWindowsClipboard clipboard(m_window); CMSWindowsClipboard clipboard(m_window);
clipboard.open(0); clipboard.open(0);
clipboard.empty(); clipboard.emptyUnowned();
clipboard.add(IClipboard::kText, data); clipboard.add(IClipboard::kText, data);
clipboard.close(); clipboard.close();
} }

View File

@ -210,7 +210,7 @@ CMSWindowsServerTaskBarReceiver::copyLog() const
if (!data.empty()) { if (!data.empty()) {
CMSWindowsClipboard clipboard(m_window); CMSWindowsClipboard clipboard(m_window);
clipboard.open(0); clipboard.open(0);
clipboard.empty(); clipboard.emptyUnowned();
clipboard.add(IClipboard::kText, data); clipboard.add(IClipboard::kText, data);
clipboard.close(); clipboard.close();
} }

View File

@ -20,7 +20,7 @@
// CArchLogWindows // CArchLogWindows
// //
CArchLogWindows::CArchLogWindows() CArchLogWindows::CArchLogWindows() : m_eventLog(NULL)
{ {
// do nothing // do nothing
} }
@ -33,7 +33,7 @@ CArchLogWindows::~CArchLogWindows()
void void
CArchLogWindows::openLog(const char* name) CArchLogWindows::openLog(const char* name)
{ {
if (!CArchMiscWindows::isWindows95Family()) { if (m_eventLog == NULL && !CArchMiscWindows::isWindows95Family()) {
m_eventLog = RegisterEventSource(NULL, name); m_eventLog = RegisterEventSource(NULL, name);
} }
} }

View File

@ -43,7 +43,7 @@ CMSWindowsClipboard::~CMSWindowsClipboard()
} }
bool bool
CMSWindowsClipboard::empty() CMSWindowsClipboard::emptyUnowned()
{ {
LOG((CLOG_DEBUG "empty clipboard")); LOG((CLOG_DEBUG "empty clipboard"));
@ -53,6 +53,16 @@ CMSWindowsClipboard::empty()
return false; return false;
} }
return true;
}
bool
CMSWindowsClipboard::empty()
{
if (!emptyUnowned()) {
return false;
}
// mark clipboard as being owned by synergy // mark clipboard as being owned by synergy
HGLOBAL data = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, 1); HGLOBAL data = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, 1);
SetClipboardData(getOwnershipFormat(), data); SetClipboardData(getOwnershipFormat(), data);

View File

@ -28,6 +28,21 @@ public:
CMSWindowsClipboard(HWND window); CMSWindowsClipboard(HWND window);
virtual ~CMSWindowsClipboard(); virtual ~CMSWindowsClipboard();
//! Empty clipboard without ownership
/*!
Take ownership of the clipboard and clear all data from it.
This must be called between a successful open() and close().
Return false if the clipboard ownership could not be taken;
the clipboard should not be emptied in this case. Unlike
empty(), isOwnedBySynergy() will return false when emptied
this way. This is useful when synergy wants to put data on
clipboard but pretend (to itself) that some other app did it.
When using empty(), synergy assumes the data came from the
server and doesn't need to be sent back. emptyUnowned()
makes synergy send the data to the server.
*/
bool emptyUnowned();
//! Test if clipboard is owned by synergy //! Test if clipboard is owned by synergy
static bool isOwnedBySynergy(); static bool isOwnedBySynergy();