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 <ApplicationServices/ApplicationServices.h> | 7 #include <ApplicationServices/ApplicationServices.h> |
8 #include <Carbon/Carbon.h> | 8 #include <Carbon/Carbon.h> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 #pragma clang diagnostic pop | 198 #pragma clang diagnostic pop |
199 if (error != kCGErrorSuccess) { | 199 if (error != kCGErrorSuccess) { |
200 LOG(WARNING) << "CGPostMouseEvent error " << error; | 200 LOG(WARNING) << "CGPostMouseEvent error " << error; |
201 } | 201 } |
202 | 202 |
203 if (event.has_wheel_delta_x() && event.has_wheel_delta_y()) { | 203 if (event.has_wheel_delta_x() && event.has_wheel_delta_y()) { |
204 int delta_x = static_cast<int>(event.wheel_delta_x()); | 204 int delta_x = static_cast<int>(event.wheel_delta_x()); |
205 int delta_y = static_cast<int>(event.wheel_delta_y()); | 205 int delta_y = static_cast<int>(event.wheel_delta_y()); |
206 base::mac::ScopedCFTypeRef<CGEventRef> event( | 206 base::mac::ScopedCFTypeRef<CGEventRef> event( |
207 CGEventCreateScrollWheelEvent( | 207 CGEventCreateScrollWheelEvent( |
208 NULL, kCGScrollEventUnitPixel, 2, delta_x, delta_y)); | 208 NULL, kCGScrollEventUnitPixel, 2, delta_y, delta_x)); |
209 if (event) | 209 if (event) |
210 CGEventPost(kCGHIDEventTap, event); | 210 CGEventPost(kCGHIDEventTap, event); |
211 } else if (event.has_wheel_offset_x() && event.has_wheel_offset_y()) { | 211 } else if (event.has_wheel_offset_x() && event.has_wheel_offset_y()) { |
212 int dx = event.wheel_offset_x(); | 212 int dx = event.wheel_offset_x(); |
213 int dy = event.wheel_offset_y(); | 213 int dy = event.wheel_offset_y(); |
214 // Note that |dy| (the vertical wheel) is the primary wheel. | 214 // Note that |dy| (the vertical wheel) is the primary wheel. |
215 #pragma clang diagnostic push | 215 #pragma clang diagnostic push |
216 #pragma clang diagnostic ignored "-Wdeprecated-declarations" | 216 #pragma clang diagnostic ignored "-Wdeprecated-declarations" |
217 error = CGPostScrollWheelEvent(2, dy, dx); | 217 error = CGPostScrollWheelEvent(2, dy, dx); |
218 #pragma clang diagnostic pop | 218 #pragma clang diagnostic pop |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 | 251 |
252 } // namespace | 252 } // namespace |
253 | 253 |
254 scoped_ptr<EventExecutor> EventExecutor::Create( | 254 scoped_ptr<EventExecutor> EventExecutor::Create( |
255 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 255 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
256 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { | 256 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { |
257 return scoped_ptr<EventExecutor>(new EventExecutorMac(main_task_runner)); | 257 return scoped_ptr<EventExecutor>(new EventExecutorMac(main_task_runner)); |
258 } | 258 } |
259 | 259 |
260 } // namespace remoting | 260 } // namespace remoting |
OLD | NEW |