diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-12-08 22:31:27 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-12-08 22:31:27 +0300 |
commit | 50a25d4209c4412bbe6632baabeb931694d8ed25 (patch) | |
tree | 83ecc598641b47b73b7fa3720444df826b9f5710 /src | |
parent | b595695ec90d7e9207675f9b8c8ae2e978b03c5f (diff) | |
download | manaplus-50a25d4209c4412bbe6632baabeb931694d8ed25.tar.gz manaplus-50a25d4209c4412bbe6632baabeb931694d8ed25.tar.bz2 manaplus-50a25d4209c4412bbe6632baabeb931694d8ed25.tar.xz manaplus-50a25d4209c4412bbe6632baabeb931694d8ed25.zip |
Add pasting into two clipboards under xserver.
Diffstat (limited to 'src')
-rw-r--r-- | src/utils/copynpaste.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/utils/copynpaste.cpp b/src/utils/copynpaste.cpp index 784870e05..5105d38e5 100644 --- a/src/utils/copynpaste.cpp +++ b/src/utils/copynpaste.cpp @@ -407,8 +407,16 @@ bool retrieveBuffer(std::string& text, std::string::size_type& pos) return false; } +bool runxsel(std::string& text, const char *p1, const char *p2 = nullptr); + bool sendBuffer(std::string& text) { + runxsel(text, "-i"); + runxsel(text, "-b", "-i"); +} + +bool runxsel(std::string& text, const char *p1, const char *p2) +{ pid_t pid; int fd[2]; @@ -432,7 +440,11 @@ bool sendBuffer(std::string& text) } close(fd[0]); } - execl("/usr/bin/xsel", "xsel", "-b", "-i", (char *)nullptr); + if (p2) + execl("/usr/bin/xsel", "xsel", p1, p2, (char *)nullptr); + else + execl("/usr/bin/xsel", "xsel", p1, (char *)nullptr); + exit(1); } |