summaryrefslogtreecommitdiffstats
path: root/remoting/host
diff options
context:
space:
mode:
authorgarykac@chromium.org <garykac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-17 05:46:55 +0000
committergarykac@chromium.org <garykac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-17 05:46:55 +0000
commit530cc37d1b78b56cbe42f2a341ac3282f988e1c4 (patch)
tree14ff4b5eaeab8a10d81b44128690c42227c53b50 /remoting/host
parente9621112681353ce4ce280022e8349bf2b9b44d2 (diff)
downloadchromium_src-530cc37d1b78b56cbe42f2a341ac3282f988e1c4.zip
chromium_src-530cc37d1b78b56cbe42f2a341ac3282f988e1c4.tar.gz
chromium_src-530cc37d1b78b56cbe42f2a341ac3282f988e1c4.tar.bz2
Mac scroll wheel support for Chromoting.
BUG=84289 TEST=manual Review URL: http://codereview.chromium.org/8299006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105768 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host')
-rw-r--r--remoting/host/event_executor_mac.cc26
1 files changed, 18 insertions, 8 deletions
diff --git a/remoting/host/event_executor_mac.cc b/remoting/host/event_executor_mac.cc
index 512d763..6844df0 100644
--- a/remoting/host/event_executor_mac.cc
+++ b/remoting/host/event_executor_mac.cc
@@ -219,7 +219,10 @@ void EventExecutorMac::InjectKeyEvent(const KeyEvent& event) {
if (key_sym != -1) {
// We use the deprecated event injection API because the new one doesn't
// work with switched-out sessions (curtain mode).
- CGPostKeyboardEvent(0, key_sym, event.pressed());
+ CGError error = CGPostKeyboardEvent(0, key_sym, event.pressed());
+ if (error != kCGErrorSuccess) {
+ LOG(WARNING) << "CGPostKeyboardEvent error " << error;
+ }
}
}
}
@@ -266,15 +269,22 @@ void EventExecutorMac::InjectMouseEvent(const MouseEvent& event) {
MiddleBit = 1 << (MouseEvent::BUTTON_MIDDLE - 1),
RightBit = 1 << (MouseEvent::BUTTON_RIGHT - 1)
};
- CGPostMouseEvent(position, true, 3,
- (mouse_buttons_ & LeftBit) != 0,
- (mouse_buttons_ & RightBit) != 0,
- (mouse_buttons_ & MiddleBit) != 0);
+ CGError error = CGPostMouseEvent(position, true, 3,
+ (mouse_buttons_ & LeftBit) != 0,
+ (mouse_buttons_ & RightBit) != 0,
+ (mouse_buttons_ & MiddleBit) != 0);
+ if (error != kCGErrorSuccess) {
+ LOG(WARNING) << "CGPostMouseEvent error " << error;
+ }
if (event.has_wheel_offset_x() && event.has_wheel_offset_y()) {
- // TODO(jamiewalch): Use either CGPostScrollWheelEvent() or
- // CGEventCreateScrollWheelEvent() to inject scroll events.
- NOTIMPLEMENTED() << "No scroll wheel support yet.";
+ int dx = event.wheel_offset_x();
+ int dy = event.wheel_offset_y();
+ // Note that |dy| (the vertical wheel) is the primary wheel.
+ error = CGPostScrollWheelEvent(2, dy, dx);
+ if (error != kCGErrorSuccess) {
+ LOG(WARNING) << "CGPostScrollWheelEvent error " << error;
+ }
}
}