aboutsummaryrefslogtreecommitdiff
path: root/source/Irrlicht/CGUIEditBox.cpp
diff options
context:
space:
mode:
authornumzero <numzer0@yandex.ru>2023-03-25 10:42:11 +0300
committernumzero <numzer0@yandex.ru>2023-03-25 10:42:47 +0300
commitd97d1708d68a98c039db8a06c4110bfc961d3fb1 (patch)
tree1a90cd7a34793982aa9376468feb41e67d2b7cdc /source/Irrlicht/CGUIEditBox.cpp
parentba77d01c91a363ad932ecd26c3eaba82ddf7a6f0 (diff)
parent799c8b936f9a2cc4f3a8bc56237fb9a8dedf853e (diff)
downloadirrlicht-d97d1708d68a98c039db8a06c4110bfc961d3fb1.tar.xz
Resolve conflicts with master
Diffstat (limited to 'source/Irrlicht/CGUIEditBox.cpp')
-rw-r--r--source/Irrlicht/CGUIEditBox.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/source/Irrlicht/CGUIEditBox.cpp b/source/Irrlicht/CGUIEditBox.cpp
index cf4b64e..24b8099 100644
--- a/source/Irrlicht/CGUIEditBox.cpp
+++ b/source/Irrlicht/CGUIEditBox.cpp
@@ -1135,6 +1135,34 @@ bool CGUIEditBox::processMouse(const SEvent& event)
return true;
}
}
+ case EMIE_MMOUSE_PRESSED_DOWN: {
+ if (!AbsoluteClippingRect.isPointInside(core::position2d<s32>(
+ event.MouseInput.X, event.MouseInput.Y)))
+ return false;
+
+ if (!Environment->hasFocus(this)) {
+ BlinkStartTime = os::Timer::getTime();
+ }
+
+ // move cursor and disable marking
+ CursorPos = getCursorPos(event.MouseInput.X, event.MouseInput.Y);
+ MouseMarking = false;
+ setTextMarkers(CursorPos, CursorPos);
+
+ // paste from the primary selection
+ inputString([&] {
+ irr::core::stringw inserted_text;
+ if (!Operator)
+ return inserted_text;
+ const c8 *inserted_text_utf8 = Operator->getTextFromPrimarySelection();
+ if (!inserted_text_utf8)
+ return inserted_text;
+ core::multibyteToWString(inserted_text, inserted_text_utf8);
+ return inserted_text;
+ }());
+
+ return true;
+ }
default:
break;
}
@@ -1624,6 +1652,17 @@ void CGUIEditBox::setTextMarkers(s32 begin, s32 end)
{
MarkBegin = begin;
MarkEnd = end;
+
+ if (!PasswordBox && Operator && MarkBegin != MarkEnd) {
+ // copy to primary selection
+ const s32 realmbgn = MarkBegin < MarkEnd ? MarkBegin : MarkEnd;
+ const s32 realmend = MarkBegin < MarkEnd ? MarkEnd : MarkBegin;
+
+ core::stringc s;
+ wStringToMultibyte(s, Text.subString(realmbgn, realmend - realmbgn));
+ Operator->copyToPrimarySelection(s.c_str());
+ }
+
sendGuiEvent(EGET_EDITBOX_MARKING_CHANGED);
}
}