Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Unified Diff: remoting/protocol/input_event_tracker.cc

Issue 11781003: Connect to DesktopEnvironment's stubs only when audio/video schedulers are about to be created. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/protocol/input_event_tracker.cc
diff --git a/remoting/protocol/input_event_tracker.cc b/remoting/protocol/input_event_tracker.cc
index ab9e585205e3feac801efe9a47e381a4b98b4b4d..785997e1044deaad7c300a4aa77296cbb8e2b229 100644
--- a/remoting/protocol/input_event_tracker.cc
+++ b/remoting/protocol/input_event_tracker.cc
@@ -28,30 +28,33 @@ int InputEventTracker::PressedKeyCount() const {
}
void InputEventTracker::ReleaseAll() {
- std::set<uint32>::iterator i;
- for (i = pressed_keys_.begin(); i != pressed_keys_.end(); ++i) {
- KeyEvent event;
- event.set_pressed(false);
- event.set_usb_keycode(*i);
- input_stub_->InjectKeyEvent(event);
- }
- pressed_keys_.clear();
+ if (input_stub_) {
+ std::set<uint32>::iterator i;
+ for (i = pressed_keys_.begin(); i != pressed_keys_.end(); ++i) {
+ KeyEvent event;
+ event.set_pressed(false);
+ event.set_usb_keycode(*i);
+ input_stub_->InjectKeyEvent(event);
+ }
- for (int i = MouseEvent::BUTTON_UNDEFINED + 1;
- i < MouseEvent::BUTTON_MAX; ++i) {
- if (mouse_button_state_ & (1 << (i - 1))) {
- MouseEvent mouse;
+ for (int i = MouseEvent::BUTTON_UNDEFINED + 1;
+ i < MouseEvent::BUTTON_MAX; ++i) {
+ if (mouse_button_state_ & (1 << (i - 1))) {
+ MouseEvent mouse;
- // TODO(wez): EventInjectors should cope with positionless events by
- // using the current cursor position, and we wouldn't set position here.
- mouse.set_x(mouse_pos_.x());
- mouse.set_y(mouse_pos_.y());
+ // TODO(wez): EventInjectors should cope with positionless events by
+ // using the current cursor position, and we wouldn't set position here.
+ mouse.set_x(mouse_pos_.x());
+ mouse.set_y(mouse_pos_.y());
- mouse.set_button((MouseEvent::MouseButton)i);
- mouse.set_button_down(false);
- input_stub_->InjectMouseEvent(mouse);
+ mouse.set_button((MouseEvent::MouseButton)i);
+ mouse.set_button_down(false);
+ input_stub_->InjectMouseEvent(mouse);
+ }
}
}
+
+ pressed_keys_.clear();
mouse_button_state_ = 0;
}
@@ -65,7 +68,9 @@ void InputEventTracker::InjectKeyEvent(const KeyEvent& event) {
}
}
}
- input_stub_->InjectKeyEvent(event);
+
+ if (input_stub_)
+ input_stub_->InjectKeyEvent(event);
}
void InputEventTracker::InjectMouseEvent(const MouseEvent& event) {
@@ -83,7 +88,9 @@ void InputEventTracker::InjectMouseEvent(const MouseEvent& event) {
}
}
}
- input_stub_->InjectMouseEvent(event);
+
+ if (input_stub_)
+ input_stub_->InjectMouseEvent(event);
}
} // namespace protocol
« remoting/protocol/input_event_tracker.h ('K') | « remoting/protocol/input_event_tracker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698