OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chromeos/ime/ime_keyboard_x11.h" | 5 #include "ui/base/ime/chromeos/ime_keyboard_x11.h" |
6 #include "ui/gfx/x/x11_types.h" | |
7 | |
8 // These includes conflict with base/tracked_objects.h so must come last. | |
9 #include <X11/XKBlib.h> | |
10 #include <X11/Xlib.h> | |
6 | 11 |
7 namespace chromeos { | 12 namespace chromeos { |
8 namespace input_method { | 13 namespace input_method { |
9 namespace { | 14 namespace { |
10 | 15 |
11 // The delay in milliseconds that we'll wait between checking if | 16 // The delay in milliseconds that we'll wait between checking if |
12 // setxkbmap command finished. | 17 // setxkbmap command finished. |
13 const int kSetLayoutCommandCheckDelayMs = 100; | 18 const int kSetLayoutCommandCheckDelayMs = 100; |
14 | 19 |
15 // The command we use to set the current XKB layout and modifier key mapping. | 20 // The command we use to set the current XKB layout and modifier key mapping. |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
266 if (execute_queue_.empty()) { | 271 if (execute_queue_.empty()) { |
267 DVLOG(1) << "OnSetLayoutFinish: execute_queue_ is empty. " | 272 DVLOG(1) << "OnSetLayoutFinish: execute_queue_ is empty. " |
268 << "base::LaunchProcess failed?"; | 273 << "base::LaunchProcess failed?"; |
269 return; | 274 return; |
270 } | 275 } |
271 execute_queue_.pop(); | 276 execute_queue_.pop(); |
272 MaybeExecuteSetLayoutCommand(); | 277 MaybeExecuteSetLayoutCommand(); |
273 } | 278 } |
274 | 279 |
275 // static | 280 // static |
276 bool ImeKeyboard::GetAutoRepeatEnabledForTesting() { | 281 UI_BASE_EXPORT bool ImeKeyboard::GetAutoRepeatEnabledForTesting() { |
Jun Mukai
2014/11/20 08:25:06
Similarly: see my comment on ime_keyboard_ozone.cc
Shu Chen
2014/11/20 08:34:39
Done.
| |
277 XKeyboardState state = {}; | 282 XKeyboardState state = {}; |
278 XGetKeyboardControl(gfx::GetXDisplay(), &state); | 283 XGetKeyboardControl(gfx::GetXDisplay(), &state); |
279 return state.global_auto_repeat != AutoRepeatModeOff; | 284 return state.global_auto_repeat != AutoRepeatModeOff; |
280 } | 285 } |
281 | 286 |
282 // static | 287 // static |
283 bool ImeKeyboard::GetAutoRepeatRateForTesting(AutoRepeatRate* out_rate) { | 288 UI_BASE_EXPORT bool ImeKeyboard::GetAutoRepeatRateForTesting( |
289 AutoRepeatRate* out_rate) { | |
284 return XkbGetAutoRepeatRate(gfx::GetXDisplay(), | 290 return XkbGetAutoRepeatRate(gfx::GetXDisplay(), |
285 XkbUseCoreKbd, | 291 XkbUseCoreKbd, |
286 &(out_rate->initial_delay_in_ms), | 292 &(out_rate->initial_delay_in_ms), |
287 &(out_rate->repeat_interval_in_ms)) == True; | 293 &(out_rate->repeat_interval_in_ms)) == True; |
288 } | 294 } |
289 | 295 |
290 // static | 296 // static |
291 bool ImeKeyboard::CheckLayoutNameForTesting(const std::string& layout_name) { | 297 UI_BASE_EXPORT bool ImeKeyboard::CheckLayoutNameForTesting( |
298 const std::string& layout_name) { | |
292 return CheckLayoutName(layout_name); | 299 return CheckLayoutName(layout_name); |
293 } | 300 } |
294 | 301 |
295 // static | 302 // static |
296 ImeKeyboard* ImeKeyboard::Create() { return new ImeKeyboardX11(); } | 303 UI_BASE_EXPORT ImeKeyboard* ImeKeyboard::Create() { |
304 return new ImeKeyboardX11(); | |
305 } | |
297 | 306 |
298 } // namespace input_method | 307 } // namespace input_method |
299 } // namespace chromeos | 308 } // namespace chromeos |
OLD | NEW |