OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/ime/input_method_ibus.h" | 5 #include "views/ime/input_method_ibus.h" |
6 | 6 |
7 #include <ibus.h> | 7 #include <ibus.h> |
8 | 8 |
9 #include <cstring> | 9 #include <cstring> |
10 #include <set> | 10 #include <set> |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
362 ibus_keyval, ibus_keycode, ibus_state, -1, NULL, | 362 ibus_keyval, ibus_keycode, ibus_state, -1, NULL, |
363 reinterpret_cast<GAsyncReadyCallback>(ProcessKeyEventDone), | 363 reinterpret_cast<GAsyncReadyCallback>(ProcessKeyEventDone), |
364 pending_key); | 364 pending_key); |
365 | 365 |
366 // We don't want to suppress the result generated by this key event, but it | 366 // We don't want to suppress the result generated by this key event, but it |
367 // may cause problem. See comment in ResetContext() method. | 367 // may cause problem. See comment in ResetContext() method. |
368 suppress_next_result_ = false; | 368 suppress_next_result_ = false; |
369 } | 369 } |
370 | 370 |
371 void InputMethodIBus::OnTextInputTypeChanged(View* view) { | 371 void InputMethodIBus::OnTextInputTypeChanged(View* view) { |
372 InputMethodBase::OnTextInputTypeChanged(view); | |
372 if (context_ && IsViewFocused(view)) { | 373 if (context_ && IsViewFocused(view)) { |
373 ResetContext(); | 374 ResetContext(); |
374 UpdateContextFocusState(); | 375 UpdateContextFocusState(); |
375 } | 376 } |
376 } | 377 } |
377 | 378 |
378 void InputMethodIBus::OnCaretBoundsChanged(View* view) { | 379 void InputMethodIBus::OnCaretBoundsChanged(View* view) { |
379 if (!context_focused_ || !IsViewFocused(view)) | 380 if (!context_focused_ || !IsViewFocused(view)) |
380 return; | 381 return; |
381 | 382 |
(...skipping 24 matching lines...) Expand all Loading... | |
406 // Not supported. | 407 // Not supported. |
407 return std::string(""); | 408 return std::string(""); |
408 } | 409 } |
409 | 410 |
410 base::i18n::TextDirection InputMethodIBus::GetInputTextDirection() { | 411 base::i18n::TextDirection InputMethodIBus::GetInputTextDirection() { |
411 // Not supported. | 412 // Not supported. |
412 return base::i18n::UNKNOWN_DIRECTION; | 413 return base::i18n::UNKNOWN_DIRECTION; |
413 } | 414 } |
414 | 415 |
415 bool InputMethodIBus::IsActive() { | 416 bool InputMethodIBus::IsActive() { |
416 return context_ != NULL; | 417 // We always need to receive TextInputTypeChanged signal, |
418 // so just return true here. | |
bryeung
2011/06/22 01:56:02
This seems dangerous. Is there no way to ensure t
| |
419 return true; | |
417 } | 420 } |
418 | 421 |
419 // static | 422 // static |
420 bool InputMethodIBus::IsInputMethodIBusEnabled() { | 423 bool InputMethodIBus::IsInputMethodIBusEnabled() { |
421 #if defined(TOUCH_UI) | 424 #if defined(TOUCH_UI) |
422 return true; | 425 return true; |
423 #else | 426 #else |
424 return inputmethod_ibus_enabled || | 427 return inputmethod_ibus_enabled || |
425 CommandLine::ForCurrentProcess()->HasSwitch( | 428 CommandLine::ForCurrentProcess()->HasSwitch( |
426 kEnableInputMethodIBusSwitch); | 429 kEnableInputMethodIBusSwitch); |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
987 DCHECK_EQ(GetIBus(), bus); | 990 DCHECK_EQ(GetIBus(), bus); |
988 DCHECK(data); | 991 DCHECK(data); |
989 IBusInputContext* ic = | 992 IBusInputContext* ic = |
990 ibus_bus_create_input_context_async_finish(bus, res, NULL); | 993 ibus_bus_create_input_context_async_finish(bus, res, NULL); |
991 if (ic) | 994 if (ic) |
992 data->StoreOrAbandonInputContext(ic); | 995 data->StoreOrAbandonInputContext(ic); |
993 delete data; | 996 delete data; |
994 } | 997 } |
995 | 998 |
996 } // namespace views | 999 } // namespace views |
OLD | NEW |