Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: ui/base/ime/ibus_client_impl.cc

Issue 10534134: Fix candidate window position issue. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix braces Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/base/ime/ibus_client_impl.h ('k') | ui/base/ime/input_method_ibus.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/ibus_client_impl.h" 5 #include "ui/base/ime/ibus_client_impl.h"
6 6
7 #include <ibus.h> 7 #include <ibus.h>
8 #include <X11/X.h> 8 #include <X11/X.h>
9 #include <X11/Xlib.h> 9 #include <X11/Xlib.h>
10 #undef FocusIn 10 #undef FocusIn
11 #undef FocusOut 11 #undef FocusOut
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/i18n/char_iterator.h" 14 #include "base/i18n/char_iterator.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
17 #include "ui/base/ime/composition_text.h" 17 #include "ui/base/ime/composition_text.h"
18 #include "ui/gfx/rect.h"
18 19
19 // input_method_ibus.cc assumes X and IBus use the same mask for Lock, Control, 20 // input_method_ibus.cc assumes X and IBus use the same mask for Lock, Control,
20 // Shift, Alt, and buttons. Check if the assumption is really correct. 21 // Shift, Alt, and buttons. Check if the assumption is really correct.
21 COMPILE_ASSERT(IBUS_LOCK_MASK == LockMask, test_mask); 22 COMPILE_ASSERT(IBUS_LOCK_MASK == LockMask, test_mask);
22 COMPILE_ASSERT(IBUS_CONTROL_MASK == ControlMask, test_mask); 23 COMPILE_ASSERT(IBUS_CONTROL_MASK == ControlMask, test_mask);
23 COMPILE_ASSERT(IBUS_SHIFT_MASK == ShiftMask, test_mask); 24 COMPILE_ASSERT(IBUS_SHIFT_MASK == ShiftMask, test_mask);
24 COMPILE_ASSERT(IBUS_MOD1_MASK == Mod1Mask, test_mask); 25 COMPILE_ASSERT(IBUS_MOD1_MASK == Mod1Mask, test_mask);
25 COMPILE_ASSERT(IBUS_BUTTON1_MASK == Button1Mask, test_mask); 26 COMPILE_ASSERT(IBUS_BUTTON1_MASK == Button1Mask, test_mask);
26 COMPILE_ASSERT(IBUS_BUTTON2_MASK == Button2Mask, test_mask); 27 COMPILE_ASSERT(IBUS_BUTTON2_MASK == Button2Mask, test_mask);
27 COMPILE_ASSERT(IBUS_BUTTON3_MASK == Button3Mask, test_mask); 28 COMPILE_ASSERT(IBUS_BUTTON3_MASK == Button3Mask, test_mask);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 void IBusClientImpl::Reset(IBusInputContext* context) { 119 void IBusClientImpl::Reset(IBusInputContext* context) {
119 ibus_input_context_reset(context); 120 ibus_input_context_reset(context);
120 } 121 }
121 122
122 IBusClient::InputMethodType IBusClientImpl::GetInputMethodType() { 123 IBusClient::InputMethodType IBusClientImpl::GetInputMethodType() {
123 // This object cannot know the type of the current IME, hence return NORMAL. 124 // This object cannot know the type of the current IME, hence return NORMAL.
124 return INPUT_METHOD_NORMAL; 125 return INPUT_METHOD_NORMAL;
125 } 126 }
126 127
127 void IBusClientImpl::SetCursorLocation(IBusInputContext* context, 128 void IBusClientImpl::SetCursorLocation(IBusInputContext* context,
128 int32 x, 129 const gfx::Rect& cursor_location,
129 int32 y, 130 const gfx::Rect& composition_head) {
130 int32 w, 131 ibus_input_context_set_cursor_location(context,
131 int32 h) { 132 cursor_location.x(),
132 ibus_input_context_set_cursor_location(context, x, y, w, h); 133 cursor_location.y(),
134 cursor_location.width(),
135 cursor_location.height());
133 } 136 }
134 137
135 void IBusClientImpl::SendKeyEvent(IBusInputContext* context, 138 void IBusClientImpl::SendKeyEvent(IBusInputContext* context,
136 uint32 keyval, 139 uint32 keyval,
137 uint32 keycode, 140 uint32 keycode,
138 uint32 state, 141 uint32 state,
139 PendingKeyEvent* pending_key) { 142 PendingKeyEvent* pending_key) {
140 // Note: 143 // Note:
141 // 1. We currently set timeout to -1, because ibus doesn't have a mechanism to 144 // 1. We currently set timeout to -1, because ibus doesn't have a mechanism to
142 // associate input method results to corresponding key event, thus there is 145 // associate input method results to corresponding key event, thus there is
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 } 244 }
242 245
243 string16 IBusClientImpl::ExtractCommitText(IBusText* text) { 246 string16 IBusClientImpl::ExtractCommitText(IBusText* text) {
244 if (!text || !text->text) 247 if (!text || !text->text)
245 return WideToUTF16(L""); 248 return WideToUTF16(L"");
246 return UTF8ToUTF16(text->text); 249 return UTF8ToUTF16(text->text);
247 } 250 }
248 251
249 } // namespace internal 252 } // namespace internal
250 } // namespace ui 253 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/ime/ibus_client_impl.h ('k') | ui/base/ime/input_method_ibus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698