mirror of
https://github.com/debauchee/barrier.git
synced 2026-05-08 23:14:20 +08:00
Integrated fixes from 1.0 branch.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user