From 7422120014b51f0057bb41b3e9b6405957a01b63 Mon Sep 17 00:00:00 2001 From: michi_cc Date: Mon, 5 Aug 2013 20:37:06 +0000 Subject: (svn r25679) -Codechange: [Win32] Get the result string of an IME input directly without a trip through the window messaging system. --- src/window.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/window.cpp') diff --git a/src/window.cpp b/src/window.cpp index 1ef8afa44..522a10a6f 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -2532,6 +2532,33 @@ void HandleCtrlChanged() } } +/** + * Insert a text string at the cursor position into the edit box widget. + * @param wid Edit box widget. + * @param str Text string to insert. + */ +/* virtual */ void Window::InsertTextString(int wid, const char *str) +{ + QueryString *query = this->GetQueryString(wid); + if (query == NULL) return; + + if (query->text.InsertString(str)) { + this->SetWidgetDirty(wid); + this->OnEditboxChanged(wid); + } +} + +/** + * Handle text input. + * @param str Text string to input. + */ +void HandleTextInput(const char *str) +{ + if (!EditBoxInGlobalFocus()) return; + + _focused_window->InsertTextString(_focused_window->window_class == WC_CONSOLE ? 0 : _focused_window->nested_focus->index, str); +} + /** * Local counter that is incremented each time an mouse input event is detected. * The counter is used to stop auto-scrolling. -- cgit v1.2.3-70-g09d2