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

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

View File

@@ -28,6 +28,21 @@ public:
CMSWindowsClipboard(HWND window);
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
static bool isOwnedBySynergy();