Also clear local clipboards
This commit is contained in:
@@ -86,6 +86,8 @@ namespace rfb {
|
|||||||
virtual void handleClipboardAnnounceBinary(const unsigned __unused_attr num,
|
virtual void handleClipboardAnnounceBinary(const unsigned __unused_attr num,
|
||||||
const char __unused_attr mimes[][32]) {}
|
const char __unused_attr mimes[][32]) {}
|
||||||
|
|
||||||
|
virtual void clearLocalClipboards() {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~SDesktop() {}
|
virtual ~SDesktop() {}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -871,6 +871,8 @@ void VNCServerST::checkAPIMessages(network::GetAPIMessager *apimessager,
|
|||||||
desktop->handleClipboardAnnounceBinary(0, NULL);
|
desktop->handleClipboardAnnounceBinary(0, NULL);
|
||||||
|
|
||||||
sendBinaryClipboardData("text/plain", NULL, 0);
|
sendBinaryClipboardData("text/plain", NULL, 0);
|
||||||
|
|
||||||
|
desktop->clearLocalClipboards();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,6 +182,11 @@ XserverDesktop::queryConnection(network::Socket* sock,
|
|||||||
return rfb::VNCServerST::PENDING;
|
return rfb::VNCServerST::PENDING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void XserverDesktop::clearLocalClipboards()
|
||||||
|
{
|
||||||
|
vncClearLocalClipboards();
|
||||||
|
}
|
||||||
|
|
||||||
void XserverDesktop::announceClipboard(bool available)
|
void XserverDesktop::announceClipboard(bool available)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ public:
|
|||||||
void setFramebuffer(int w, int h, void* fbptr, int stride);
|
void setFramebuffer(int w, int h, void* fbptr, int stride);
|
||||||
void refreshScreenLayout();
|
void refreshScreenLayout();
|
||||||
void requestClipboard();
|
void requestClipboard();
|
||||||
|
void clearLocalClipboards();
|
||||||
void announceClipboard(bool available);
|
void announceClipboard(bool available);
|
||||||
void clearBinaryClipboardData();
|
void clearBinaryClipboardData();
|
||||||
void sendBinaryClipboardData(const char* mime, const unsigned char *data,
|
void sendBinaryClipboardData(const char* mime, const unsigned char *data,
|
||||||
|
|||||||
@@ -763,3 +763,42 @@ static void vncClientStateCallback(CallbackListPtr * l,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void vncClearLocalClipboard(Atom selection)
|
||||||
|
{
|
||||||
|
SelectionInfoRec info;
|
||||||
|
Selection *pSel;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
rc = dixLookupSelection(&pSel, selection, serverClient, DixSetAttrAccess);
|
||||||
|
if (rc != Success)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (pSel->client && (pSel->client != serverClient)) {
|
||||||
|
xEvent event = {
|
||||||
|
.u.selectionClear.time = currentTime.milliseconds,
|
||||||
|
.u.selectionClear.window = pSel->window,
|
||||||
|
.u.selectionClear.atom = pSel->selection
|
||||||
|
};
|
||||||
|
event.u.u.type = SelectionClear;
|
||||||
|
WriteEventsToClient(pSel->client, 1, &event);
|
||||||
|
}
|
||||||
|
|
||||||
|
pSel->lastTimeChanged = currentTime;
|
||||||
|
pSel->window = None;
|
||||||
|
pSel->pWin = NULL;
|
||||||
|
pSel->client = NullClient;
|
||||||
|
|
||||||
|
LOG_DEBUG("Cleared %s selection", NameForAtom(selection));
|
||||||
|
|
||||||
|
info.selection = pSel;
|
||||||
|
info.client = serverClient;
|
||||||
|
info.kind = SelectionSetOwner;
|
||||||
|
CallCallbacks(&SelectionCallback, &info);
|
||||||
|
}
|
||||||
|
|
||||||
|
void vncClearLocalClipboards()
|
||||||
|
{
|
||||||
|
vncClearLocalClipboard(xaPRIMARY);
|
||||||
|
vncClearLocalClipboard(xaCLIPBOARD);
|
||||||
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ void vncSelectionInit(void);
|
|||||||
|
|
||||||
void vncHandleClipboardAnnounce(int available);
|
void vncHandleClipboardAnnounce(int available);
|
||||||
void vncHandleClipboardAnnounceBinary(const unsigned num, const char mimes[][32]);
|
void vncHandleClipboardAnnounceBinary(const unsigned num, const char mimes[][32]);
|
||||||
|
void vncClearLocalClipboards();
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user