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