| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/chromeos/input_method/xkeyboard.h" | 5 #include "chrome/browser/chromeos/input_method/xkeyboard.h" |
| 6 | 6 |
| 7 #include <queue> | 7 #include <queue> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include <X11/XKBlib.h> | 10 #include <X11/XKBlib.h> |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 const std::string layout_to_set = execute_queue_.front(); | 246 const std::string layout_to_set = execute_queue_.front(); |
| 247 | 247 |
| 248 std::vector<std::string> argv; | 248 std::vector<std::string> argv; |
| 249 base::ProcessHandle handle = base::kNullProcessHandle; | 249 base::ProcessHandle handle = base::kNullProcessHandle; |
| 250 | 250 |
| 251 argv.push_back(kSetxkbmapCommand); | 251 argv.push_back(kSetxkbmapCommand); |
| 252 argv.push_back("-layout"); | 252 argv.push_back("-layout"); |
| 253 argv.push_back(layout_to_set); | 253 argv.push_back(layout_to_set); |
| 254 argv.push_back("-synch"); | 254 argv.push_back("-synch"); |
| 255 | 255 |
| 256 base::LaunchOptions options; | 256 if (!base::LaunchProcess(argv, base::LaunchOptions(), &handle)) { |
| 257 options.process_handle = &handle; | |
| 258 if (!base::LaunchProcess(argv, options)) { | |
| 259 LOG(ERROR) << "Failed to execute setxkbmap: " << layout_to_set; | 257 LOG(ERROR) << "Failed to execute setxkbmap: " << layout_to_set; |
| 260 execute_queue_ = std::queue<std::string>(); // clear the queue. | 258 execute_queue_ = std::queue<std::string>(); // clear the queue. |
| 261 return; | 259 return; |
| 262 } | 260 } |
| 263 | 261 |
| 264 // g_child_watch_add is necessary to prevent the process from becoming a | 262 // g_child_watch_add is necessary to prevent the process from becoming a |
| 265 // zombie. | 263 // zombie. |
| 266 const base::ProcessId pid = base::GetProcId(handle); | 264 const base::ProcessId pid = base::GetProcId(handle); |
| 267 g_child_watch_add(pid, | 265 g_child_watch_add(pid, |
| 268 reinterpret_cast<GChildWatchFunc>(OnSetLayoutFinish), | 266 reinterpret_cast<GChildWatchFunc>(OnSetLayoutFinish), |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 bool SetAutoRepeatEnabled(bool enabled) { | 406 bool SetAutoRepeatEnabled(bool enabled) { |
| 409 return XKeyboard::GetInstance()->SetAutoRepeatEnabled(enabled); | 407 return XKeyboard::GetInstance()->SetAutoRepeatEnabled(enabled); |
| 410 } | 408 } |
| 411 | 409 |
| 412 bool SetAutoRepeatRate(const AutoRepeatRate& rate) { | 410 bool SetAutoRepeatRate(const AutoRepeatRate& rate) { |
| 413 return XKeyboard::GetInstance()->SetAutoRepeatRate(rate); | 411 return XKeyboard::GetInstance()->SetAutoRepeatRate(rate); |
| 414 } | 412 } |
| 415 | 413 |
| 416 } // namespace input_method | 414 } // namespace input_method |
| 417 } // namespace chromeos | 415 } // namespace chromeos |
| OLD | NEW |