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 "remoting/host/event_executor.h" | 5 #include "remoting/host/event_executor.h" |
6 | 6 |
7 #include <X11/Xlib.h> | 7 #include <X11/Xlib.h> |
8 #include <X11/extensions/XTest.h> | 8 #include <X11/extensions/XTest.h> |
9 #include <X11/extensions/XInput.h> | 9 #include <X11/extensions/XInput.h> |
10 | 10 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 } | 157 } |
158 | 158 |
159 EventExecutorLinux::Core::Core( | 159 EventExecutorLinux::Core::Core( |
160 scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 160 scoped_refptr<base::SingleThreadTaskRunner> task_runner) |
161 : task_runner_(task_runner), | 161 : task_runner_(task_runner), |
162 latest_mouse_position_(SkIPoint::Make(-1, -1)), | 162 latest_mouse_position_(SkIPoint::Make(-1, -1)), |
163 wheel_ticks_x_(0.0f), | 163 wheel_ticks_x_(0.0f), |
164 wheel_ticks_y_(0.0f), | 164 wheel_ticks_y_(0.0f), |
165 display_(XOpenDisplay(NULL)), | 165 display_(XOpenDisplay(NULL)), |
166 root_window_(BadValue) { | 166 root_window_(BadValue) { |
167 #if defined(REMOTING_HOST_LINUX_CLIPBOARD) | |
168 if (!task_runner_->BelongsToCurrentThread()) | |
169 task_runner_->PostTask(FROM_HERE, base::Bind(&Core::InitClipboard, this)); | |
170 #endif // REMOTING_HOST_LINUX_CLIPBOARD | |
171 } | 167 } |
172 | 168 |
173 bool EventExecutorLinux::Core::Init() { | 169 bool EventExecutorLinux::Core::Init() { |
174 CHECK(display_); | 170 CHECK(display_); |
175 | 171 |
| 172 #if defined(REMOTING_HOST_LINUX_CLIPBOARD) |
| 173 if (!task_runner_->BelongsToCurrentThread()) |
| 174 task_runner_->PostTask(FROM_HERE, base::Bind(&Core::InitClipboard, this)); |
| 175 #endif // REMOTING_HOST_LINUX_CLIPBOARD |
| 176 |
176 root_window_ = RootWindow(display_, DefaultScreen(display_)); | 177 root_window_ = RootWindow(display_, DefaultScreen(display_)); |
177 if (root_window_ == BadValue) { | 178 if (root_window_ == BadValue) { |
178 LOG(ERROR) << "Unable to get the root window"; | 179 LOG(ERROR) << "Unable to get the root window"; |
179 return false; | 180 return false; |
180 } | 181 } |
181 | 182 |
182 // TODO(ajwong): Do we want to check the major/minor version at all for XTest? | 183 // TODO(ajwong): Do we want to check the major/minor version at all for XTest? |
183 int major = 0; | 184 int major = 0; |
184 int minor = 0; | 185 int minor = 0; |
185 if (!XTestQueryExtension(display_, &test_event_base_, &test_error_base_, | 186 if (!XTestQueryExtension(display_, &test_event_base_, &test_error_base_, |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 490 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
490 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { | 491 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { |
491 scoped_ptr<EventExecutorLinux> executor( | 492 scoped_ptr<EventExecutorLinux> executor( |
492 new EventExecutorLinux(main_task_runner)); | 493 new EventExecutorLinux(main_task_runner)); |
493 if (!executor->Init()) | 494 if (!executor->Init()) |
494 return scoped_ptr<EventExecutor>(NULL); | 495 return scoped_ptr<EventExecutor>(NULL); |
495 return executor.PassAs<EventExecutor>(); | 496 return executor.PassAs<EventExecutor>(); |
496 } | 497 } |
497 | 498 |
498 } // namespace remoting | 499 } // namespace remoting |
OLD | NEW |