Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_ibus.h" | 5 #include "ui/base/ime/input_method_ibus.h" |
| 6 | 6 |
| 7 #include <glib.h> | 7 #include <glib.h> |
| 8 #include <glib-object.h> | 8 #include <glib-object.h> |
| 9 #include <X11/X.h> | 9 #include <X11/X.h> |
| 10 #include <X11/Xlib.h> | 10 #include <X11/Xlib.h> |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 327 } | 327 } |
| 328 | 328 |
| 329 void InputMethodIBus::OnCaretBoundsChanged(const TextInputClient* client) { | 329 void InputMethodIBus::OnCaretBoundsChanged(const TextInputClient* client) { |
| 330 if (!context_focused_ || !IsTextInputClientFocused(client)) | 330 if (!context_focused_ || !IsTextInputClientFocused(client)) |
| 331 return; | 331 return; |
| 332 | 332 |
| 333 // The current text input type should not be NONE if |context_| is focused. | 333 // The current text input type should not be NONE if |context_| is focused. |
| 334 DCHECK(!IsTextInputTypeNone()); | 334 DCHECK(!IsTextInputTypeNone()); |
| 335 const gfx::Rect rect = GetTextInputClient()->GetCaretBounds(); | 335 const gfx::Rect rect = GetTextInputClient()->GetCaretBounds(); |
| 336 | 336 |
| 337 gfx::Rect composition_head; | |
| 338 GetTextInputClient()->GetCompositionCharacterBounds(0, &composition_head); | |
|
Yusuke Sato
2012/06/13 14:31:26
I guess when it returns false, composition_head is
Seigo Nonaka
2012/06/13 15:07:18
It is correct but I didn't documented well about t
| |
| 339 | |
| 337 // This function runs asynchronously. | 340 // This function runs asynchronously. |
| 338 ibus_client_->SetCursorLocation( | 341 ibus_client_->SetCursorLocation(context_, |
| 339 context_, rect.x(), rect.y(), rect.width(), rect.height()); | 342 rect.x(), |
| 343 rect.y(), | |
| 344 rect.width(), | |
| 345 rect.height(), | |
| 346 composition_head); | |
| 340 } | 347 } |
| 341 | 348 |
| 342 void InputMethodIBus::CancelComposition(const TextInputClient* client) { | 349 void InputMethodIBus::CancelComposition(const TextInputClient* client) { |
| 343 if (context_focused_ && IsTextInputClientFocused(client)) | 350 if (context_focused_ && IsTextInputClientFocused(client)) |
| 344 ResetContext(); | 351 ResetContext(); |
| 345 } | 352 } |
| 346 | 353 |
| 347 std::string InputMethodIBus::GetInputLocale() { | 354 std::string InputMethodIBus::GetInputLocale() { |
| 348 // Not supported. | 355 // Not supported. |
| 349 return ""; | 356 return ""; |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 856 static IBusBus* ibus = NULL; | 863 static IBusBus* ibus = NULL; |
| 857 | 864 |
| 858 if (!ibus) { | 865 if (!ibus) { |
| 859 ibus = ibus_client_->GetConnection(); | 866 ibus = ibus_client_->GetConnection(); |
| 860 DCHECK(ibus); | 867 DCHECK(ibus); |
| 861 } | 868 } |
| 862 return ibus; | 869 return ibus; |
| 863 } | 870 } |
| 864 | 871 |
| 865 } // namespace ui | 872 } // namespace ui |
| OLD | NEW |