mirror of
https://github.com/kasmtech/KasmVNC.git
synced 2025-02-16 10:29:19 +01:00
Also clear local clipboards
This commit is contained in:
parent
66f3013998
commit
1bd674d7b3
@ -86,6 +86,8 @@ namespace rfb {
|
||||
virtual void handleClipboardAnnounceBinary(const unsigned __unused_attr num,
|
||||
const char __unused_attr mimes[][32]) {}
|
||||
|
||||
virtual void clearLocalClipboards() {}
|
||||
|
||||
protected:
|
||||
virtual ~SDesktop() {}
|
||||
};
|
||||
|
@ -871,6 +871,8 @@ void VNCServerST::checkAPIMessages(network::GetAPIMessager *apimessager,
|
||||
desktop->handleClipboardAnnounceBinary(0, NULL);
|
||||
|
||||
sendBinaryClipboardData("text/plain", NULL, 0);
|
||||
|
||||
desktop->clearLocalClipboards();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -182,6 +182,11 @@ XserverDesktop::queryConnection(network::Socket* sock,
|
||||
return rfb::VNCServerST::PENDING;
|
||||
}
|
||||
|
||||
void XserverDesktop::clearLocalClipboards()
|
||||
{
|
||||
vncClearLocalClipboards();
|
||||
}
|
||||
|
||||
void XserverDesktop::announceClipboard(bool available)
|
||||
{
|
||||
try {
|
||||
|
@ -61,6 +61,7 @@ public:
|
||||
void setFramebuffer(int w, int h, void* fbptr, int stride);
|
||||
void refreshScreenLayout();
|
||||
void requestClipboard();
|
||||
void clearLocalClipboards();
|
||||
void announceClipboard(bool available);
|
||||
void clearBinaryClipboardData();
|
||||
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 vncHandleClipboardAnnounceBinary(const unsigned num, const char mimes[][32]);
|
||||
void vncClearLocalClipboards();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user