| OLD | NEW | 
|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "ui/base/ime/input_method_linux_x11.h" | 5 #include "ui/base/ime/input_method_linux_x11.h" | 
| 6 | 6 | 
| 7 #include "base/environment.h" | 7 #include "base/environment.h" | 
| 8 #include "ui/base/ime/linux/linux_input_method_context_factory.h" | 8 #include "ui/base/ime/linux/linux_input_method_context_factory.h" | 
| 9 #include "ui/base/ime/text_input_client.h" | 9 #include "ui/base/ime/text_input_client.h" | 
| 10 #include "ui/events/event.h" | 10 #include "ui/events/event.h" | 
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 101     if (ch) { | 101     if (ch) { | 
| 102       GetTextInputClient()->InsertChar(ch, event.flags()); | 102       GetTextInputClient()->InsertChar(ch, event.flags()); | 
| 103       return true; | 103       return true; | 
| 104     } | 104     } | 
| 105   } | 105   } | 
| 106   return handled; | 106   return handled; | 
| 107 } | 107 } | 
| 108 | 108 | 
| 109 void InputMethodLinuxX11::OnTextInputTypeChanged( | 109 void InputMethodLinuxX11::OnTextInputTypeChanged( | 
| 110     const TextInputClient* client) { | 110     const TextInputClient* client) { | 
| 111   if (IsTextInputClientFocused(client)) { | 111   if (!IsTextInputClientFocused(client)) | 
| 112     input_method_context_->Reset(); | 112     return; | 
| 113     // TODO(yoichio): Support inputmode HTML attribute. | 113   input_method_context_->Reset(); | 
| 114     input_method_context_->OnTextInputTypeChanged(client->GetTextInputType()); | 114   // TODO(yoichio): Support inputmode HTML attribute. | 
| 115   } | 115   input_method_context_->OnTextInputTypeChanged(client->GetTextInputType()); | 
| 116   InputMethodBase::OnTextInputTypeChanged(client); |  | 
| 117 } | 116 } | 
| 118 | 117 | 
| 119 void InputMethodLinuxX11::OnCaretBoundsChanged(const TextInputClient* client) { | 118 void InputMethodLinuxX11::OnCaretBoundsChanged(const TextInputClient* client) { | 
| 120   if (IsTextInputClientFocused(client)) { | 119   if (!IsTextInputClientFocused(client)) | 
| 121     input_method_context_->OnCaretBoundsChanged( | 120     return; | 
| 122         GetTextInputClient()->GetCaretBounds()); | 121   input_method_context_->OnCaretBoundsChanged( | 
| 123   } | 122       GetTextInputClient()->GetCaretBounds()); | 
| 124   InputMethodBase::OnCaretBoundsChanged(client); |  | 
| 125 } | 123 } | 
| 126 | 124 | 
| 127 void InputMethodLinuxX11::CancelComposition(const TextInputClient* client) { | 125 void InputMethodLinuxX11::CancelComposition(const TextInputClient* client) { | 
| 128   if (!IsTextInputClientFocused(client)) | 126   if (!IsTextInputClientFocused(client)) | 
| 129     return; | 127     return; | 
| 130 |  | 
| 131   input_method_context_->Reset(); | 128   input_method_context_->Reset(); | 
| 132   input_method_context_->OnTextInputTypeChanged(client->GetTextInputType()); | 129   input_method_context_->OnTextInputTypeChanged(client->GetTextInputType()); | 
| 133 } | 130 } | 
| 134 | 131 | 
| 135 void InputMethodLinuxX11::OnInputLocaleChanged() { | 132 void InputMethodLinuxX11::OnInputLocaleChanged() { | 
| 136 } | 133 } | 
| 137 | 134 | 
| 138 std::string InputMethodLinuxX11::GetInputLocale() { | 135 std::string InputMethodLinuxX11::GetInputLocale() { | 
| 139   return ""; | 136   return ""; | 
| 140 } | 137 } | 
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 203     if (ch) { | 200     if (ch) { | 
| 204       GetTextInputClient()->InsertChar(ch, event.flags()); | 201       GetTextInputClient()->InsertChar(ch, event.flags()); | 
| 205       return true; | 202       return true; | 
| 206     } | 203     } | 
| 207   } | 204   } | 
| 208 | 205 | 
| 209   return false; | 206   return false; | 
| 210 } | 207 } | 
| 211 | 208 | 
| 212 }  // namespace ui | 209 }  // namespace ui | 
| OLD | NEW | 
|---|