Dawoodoz/DFPSR

Implement clipboard access

Closed this issue · 3 comments

Copying and pasting in the textbox is currently using a global variable instead of accessing the system's clipboard. This should remain as a fallback implementation, so that implementing clipboard access for new platforms is optional.

For security reasons, access to the clipboard is tied to window management, so that anti-virus software can see a connection between pressing Ctrl+V and accessing the clipboard through the same window. There are libraries that isolate clipboard access into stand-alone applications, but using those when you already have a window displayed, may get the application incorrectly flagged as malware. Because this library already has window management connected to the components, the best security practice would be to use this connection and let clipboard access be a part of the portable window API and called automatically by attached textboxes.

Linux has features for accessing multiple clipboards, but just having default copy/paste is enough for a portable media layer, so that there are not too many things to test on different operating systems.

X11 clipboard access is partially implemented in the experimental branch, without the ability to push copied content to the clipboard on termination. Closing the application will currently lose copied content from the program, but it is at least possible to copy by reference.

The name convention for methods with and without the mutex doesn't make sense any more, which leads to an unacceptable risk for dead-locks and race-conditions when the method names are mixed up. A better design pattern is needed to handle the growing complexity.

Implemented the basics for both Linux and MS-Wndows, with some edge cases not handled.