Improved clipboard API
Change the internal clipboard API to use a request based model in
order to be prepared for more advanced clipboard transfers.
diff --git a/common/rfb/SConnection.h b/common/rfb/SConnection.h
index 31d1cb2..6c80569 100644
--- a/common/rfb/SConnection.h
+++ b/common/rfb/SConnection.h
@@ -1,5 +1,5 @@
/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
- * Copyright 2011 Pierre Ossman for Cendio AB
+ * Copyright 2011-2019 Pierre Ossman for Cendio AB
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -80,8 +80,11 @@
virtual void setEncodings(int nEncodings, const rdr::S32* encodings);
+ virtual void clientCutText(const char* str);
+
virtual void supportsQEMUKeyEvent();
+
// Methods to be overridden in a derived class
// versionReceived() indicates that the version number has just been read
@@ -129,8 +132,42 @@
virtual void enableContinuousUpdates(bool enable,
int x, int y, int w, int h);
+ // handleClipboardRequest() is called whenever the client requests
+ // the server to send over its clipboard data. It will only be
+ // called after the server has first announced a clipboard change
+ // via announceClipboard().
+ virtual void handleClipboardRequest();
+
+ // handleClipboardAnnounce() is called to indicate a change in the
+ // clipboard on the client. Call requestClipboard() to access the
+ // actual data.
+ virtual void handleClipboardAnnounce(bool available);
+
+ // handleClipboardData() is called when the client has sent over
+ // the clipboard data as a result of a previous call to
+ // requestClipboard(). Note that this function might never be
+ // called if the clipboard data was no longer available when the
+ // client received the request.
+ virtual void handleClipboardData(const char* data);
+
+
// Other methods
+ // requestClipboard() will result in a request to the client to
+ // transfer its clipboard data. A call to handleClipboardData()
+ // will be made once the data is available.
+ virtual void requestClipboard();
+
+ // announceClipboard() informs the client of changes to the
+ // clipboard on the server. The client may later request the
+ // clipboard data via handleClipboardRequest().
+ virtual void announceClipboard(bool available);
+
+ // sendClipboardData() transfers the clipboard data to the client
+ // and should be called whenever the client has requested the
+ // clipboard via handleClipboardRequest().
+ virtual void sendClipboardData(const char* data);
+
// setAccessRights() allows a security package to limit the access rights
// of a SConnection to the server. How the access rights are treated
// is up to the derived class.
@@ -208,6 +245,8 @@
stateEnum state_;
rdr::S32 preferredEncoding;
AccessRights accessRights;
+
+ char* clientClipboard;
};
}
#endif