diff --git a/xbmc/GUIUserMessages.h b/xbmc/GUIUserMessages.h index 89188ffe6ba5c..86eaa2a45e0f0 100644 --- a/xbmc/GUIUserMessages.h +++ b/xbmc/GUIUserMessages.h @@ -134,5 +134,4 @@ #define GUI_MSG_SHOW_PICTURE GUI_MSG_USER + 36 // Sent to text field to support 'input method' -#define GUI_MSG_INPUT_TEXT GUI_MSG_USER + 37 #define GUI_MSG_INPUT_TEXT_EDIT GUI_MSG_USER + 38 diff --git a/xbmc/dialogs/GUIDialogKeyboardGeneric.cpp b/xbmc/dialogs/GUIDialogKeyboardGeneric.cpp index 258d825b01e06..f8b4f25754443 100644 --- a/xbmc/dialogs/GUIDialogKeyboardGeneric.cpp +++ b/xbmc/dialogs/GUIDialogKeyboardGeneric.cpp @@ -219,7 +219,6 @@ bool CGUIDialogKeyboardGeneric::OnMessage(CGUIMessage& message) break; case GUI_MSG_SET_TEXT: - case GUI_MSG_INPUT_TEXT: case GUI_MSG_INPUT_TEXT_EDIT: { // the edit control only handles these messages if it is either focues @@ -270,9 +269,9 @@ void CGUIDialogKeyboardGeneric::Character(const std::string &ch) CGUIControl *edit = GetControl(CTL_EDIT); if (edit) { - CGUIMessage msg(GUI_MSG_INPUT_TEXT, GetID(), CTL_EDIT); - msg.SetLabel(ch); - edit->OnMessage(msg); + CAction action(ACTION_INPUT_TEXT); + action.SetText(ch); + edit->OnAction(action); } } diff --git a/xbmc/guilib/GUIEditControl.cpp b/xbmc/guilib/GUIEditControl.cpp index 63a6244ba055f..96bcd87fa13c1 100644 --- a/xbmc/guilib/GUIEditControl.cpp +++ b/xbmc/guilib/GUIEditControl.cpp @@ -103,17 +103,6 @@ bool CGUIEditControl::OnMessage(CGUIMessage &message) SetLabel2(message.GetLabel()); UpdateText(); } - else if (message.GetMessage() == GUI_MSG_INPUT_TEXT && !message.GetLabel().empty() - && (HasFocus() || message.GetControlId() == GetID())) - { - m_edit.clear(); - std::wstring str; - g_charsetConverter.utf8ToW(message.GetLabel(), str); - m_text2.insert(m_cursorPos, str); - m_cursorPos += str.size(); - UpdateText(); - return true; - } else if (message.GetMessage() == GUI_MSG_INPUT_TEXT_EDIT && HasFocus()) { g_charsetConverter.utf8ToW(message.GetLabel(), m_edit); @@ -292,6 +281,16 @@ bool CGUIEditControl::OnAction(const CAction &action) OnSMSCharacter(action.GetID() - REMOTE_0); return true; } + else if (action.GetID() == ACTION_INPUT_TEXT) + { + m_edit.clear(); + std::wstring str; + g_charsetConverter.utf8ToW(action.GetText(), str); + m_text2.insert(m_cursorPos, str); + m_cursorPos += str.size(); + UpdateText(); + return true; + } } return CGUIButtonControl::OnAction(action); } diff --git a/xbmc/osx/OSXTextInputResponder.mm b/xbmc/osx/OSXTextInputResponder.mm index 49e9030d2636f..b77e56834e754 100644 --- a/xbmc/osx/OSXTextInputResponder.mm +++ b/xbmc/osx/OSXTextInputResponder.mm @@ -27,6 +27,8 @@ #include "guilib/GUIWindowManager.h" #include "GUIUserMessages.h" #include "utils/log.h" +#include "ApplicationMessenger.h" +#include "guilib/key.h" #undef BOOL void SendKeyboardText(const char *text) @@ -37,9 +39,12 @@ void SendKeyboardText(const char *text) if ((unsigned char)*text < ' ' || *text == 127) return; - CGUIMessage msg(GUI_MSG_INPUT_TEXT, 0, 0); - msg.SetLabel(text); - g_windowManager.SendThreadMessage(msg, g_windowManager.GetFocusedWindow()); + ThreadMessage tMsg = {TMSG_GUI_ACTION}; + tMsg.param1 = WINDOW_INVALID; + CAction *action = new CAction(ACTION_INPUT_TEXT); + action->SetText(text); + tMsg.lpVoid = action; + CApplicationMessenger::Get().SendMessage(tMsg, false); } void SendEditingText(const char *text, unsigned int location, unsigned int length)