From 3f84fc198131ff706e18c56f612e38ff147b0005 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 24 Aug 2011 20:13:14 +0300 Subject: Add support for copy text to clipboard (Ctrl+C). In X enviroments used xsel to copy string to clipboard. In windows used native clipboard api. MacOSX not supported. --- src/gui/widgets/textfield.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/gui/widgets/textfield.cpp') diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index 2729e5407..d9f5bed9a 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -309,6 +309,10 @@ void TextField::keyPressed(gcn::KeyEvent &keyEvent) } break; + case 3: + handleCopy(); + break; + case 22: // Control code 22, SYNCHRONOUS IDLE, sent on Ctrl+v // hack to prevent paste key sticking if (mLastEventPaste && mLastEventPaste > cur_time) @@ -348,3 +352,9 @@ void TextField::handlePaste() setCaretPosition(static_cast(caretPos)); } } + +void TextField::handleCopy() +{ + std::string text = getText(); + sendBuffer(text); +} -- cgit v1.2.3-70-g09d2