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 if (!GetTextInputClient()->GetCompositionCharacterBounds(0, | |
| 339 &composition_head)) | |
|
Yusuke Sato
2012/06/13 15:17:38
{} is needed for a multi-line if.
Seigo Nonaka
2012/06/14 01:04:57
Done.
| |
| 340 composition_head = gfx::Rect(); | |
| 341 | |
| 337 // This function runs asynchronously. | 342 // This function runs asynchronously. |
| 338 ibus_client_->SetCursorLocation( | 343 ibus_client_->SetCursorLocation(context_, rect, composition_head); |
| 339 context_, rect.x(), rect.y(), rect.width(), rect.height()); | |
| 340 } | 344 } |
| 341 | 345 |
| 342 void InputMethodIBus::CancelComposition(const TextInputClient* client) { | 346 void InputMethodIBus::CancelComposition(const TextInputClient* client) { |
| 343 if (context_focused_ && IsTextInputClientFocused(client)) | 347 if (context_focused_ && IsTextInputClientFocused(client)) |
| 344 ResetContext(); | 348 ResetContext(); |
| 345 } | 349 } |
| 346 | 350 |
| 347 std::string InputMethodIBus::GetInputLocale() { | 351 std::string InputMethodIBus::GetInputLocale() { |
| 348 // Not supported. | 352 // Not supported. |
| 349 return ""; | 353 return ""; |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 856 static IBusBus* ibus = NULL; | 860 static IBusBus* ibus = NULL; |
| 857 | 861 |
| 858 if (!ibus) { | 862 if (!ibus) { |
| 859 ibus = ibus_client_->GetConnection(); | 863 ibus = ibus_client_->GetConnection(); |
| 860 DCHECK(ibus); | 864 DCHECK(ibus); |
| 861 } | 865 } |
| 862 return ibus; | 866 return ibus; |
| 863 } | 867 } |
| 864 | 868 |
| 865 } // namespace ui | 869 } // namespace ui |
| OLD | NEW |