summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-25 20:30:20 +0000
committeralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-25 20:30:20 +0000
commit2f40848979624555b28ea3d3794fc078456dcd18 (patch)
tree55d1acacf8c33bb534d0c4c1360affb70596f544
parentca1d44d9aa94ada374ec5dd2cbe09914fdc6c337 (diff)
downloadchromium_src-2f40848979624555b28ea3d3794fc078456dcd18.zip
chromium_src-2f40848979624555b28ea3d3794fc078456dcd18.tar.gz
chromium_src-2f40848979624555b28ea3d3794fc078456dcd18.tar.bz2
Do not suppress local echo in RemoteInputFilter on Windows.
Injected input events are filtered out by the local input monitor (LocalInputMonitorWin) on Windows. RemoteInputFilter should not try to filter then out the second time. BUG=177132 Review URL: https://chromiumcodereview.appspot.com/12294052 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184468 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--remoting/host/client_session.cc6
-rw-r--r--remoting/host/client_session_unittest.cc9
-rw-r--r--remoting/host/desktop_session_agent.cc6
-rw-r--r--remoting/host/remote_input_filter.cc50
-rw-r--r--remoting/host/remote_input_filter.h6
5 files changed, 55 insertions, 22 deletions
diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc
index f2f4fa6..fd289cb 100644
--- a/remoting/host/client_session.cc
+++ b/remoting/host/client_session.cc
@@ -78,6 +78,12 @@ ClientSession::ClientSession(
// |auth_*_filter_|'s states reflect whether the session is authenticated.
auth_input_filter_.set_enabled(false);
auth_clipboard_filter_.set_enabled(false);
+
+#if defined(OS_WIN)
+ // LocalInputMonitorWin filters out an echo of the injected input before it
+ // reaches |remote_input_filter_|.
+ remote_input_filter_.SetExpectLocalEcho(false);
+#endif // defined(OS_WIN)
}
void ClientSession::NotifyClientResolution(
diff --git a/remoting/host/client_session_unittest.cc b/remoting/host/client_session_unittest.cc
index abe7eee..9eb6348 100644
--- a/remoting/host/client_session_unittest.cc
+++ b/remoting/host/client_session_unittest.cc
@@ -369,11 +369,16 @@ TEST_F(ClientSessionTest, LocalInputTest) {
.WillOnce(DoAll(
// This event should get through to the input stub.
InjectMouseEvent(connection_, mouse_event1),
- // This one should too because the local event echoes the remote one.
+#if !defined(OS_WIN)
+ // The OS echoes the injected event back.
LocalMouseMoved(client_session_.get(), mouse_event1),
+#endif // !defined(OS_WIN)
+ // This one should get throught as well.
InjectMouseEvent(connection_, mouse_event2),
- // This one should not.
+ // Now this is a genuine local event.
LocalMouseMoved(client_session_.get(), mouse_event1),
+ // This one should be blocked because of the previous local input
+ // event.
InjectMouseEvent(connection_, mouse_event3),
// TODO(jamiewalch): Verify that remote inputs are re-enabled
// eventually (via dependency injection, not sleep!)
diff --git a/remoting/host/desktop_session_agent.cc b/remoting/host/desktop_session_agent.cc
index cd47677..5fbba57 100644
--- a/remoting/host/desktop_session_agent.cc
+++ b/remoting/host/desktop_session_agent.cc
@@ -205,6 +205,12 @@ void DesktopSessionAgent::OnStartSessionAgent(
input_tracker_.reset(new protocol::InputEventTracker(event_executor_.get()));
remote_input_filter_.reset(new RemoteInputFilter(input_tracker_.get()));
+#if defined(OS_WIN)
+ // LocalInputMonitorWin filters out an echo of the injected input before it
+ // reaches |remote_input_filter_|.
+ remote_input_filter_->SetExpectLocalEcho(false);
+#endif // defined(OS_WIN)
+
// Start the event executor.
scoped_ptr<protocol::ClipboardStub> clipboard_stub(
new DesktopSesssionClipboardStub(this));
diff --git a/remoting/host/remote_input_filter.cc b/remoting/host/remote_input_filter.cc
index 7863398..002188e 100644
--- a/remoting/host/remote_input_filter.cc
+++ b/remoting/host/remote_input_filter.cc
@@ -26,7 +26,8 @@ const int64 kRemoteBlockTimeoutMillis = 2000;
namespace remoting {
RemoteInputFilter::RemoteInputFilter(protocol::InputEventTracker* event_tracker)
- : event_tracker_(event_tracker) {
+ : event_tracker_(event_tracker),
+ expect_local_echo_(true) {
}
RemoteInputFilter::~RemoteInputFilter() {
@@ -36,25 +37,34 @@ void RemoteInputFilter::LocalMouseMoved(const SkIPoint& mouse_pos) {
// If this is a genuine local input event (rather than an echo of a remote
// input event that we've just injected), then ignore remote inputs for a
// short time.
- std::list<SkIPoint>::iterator found_position =
- std::find(injected_mouse_positions_.begin(),
- injected_mouse_positions_.end(), mouse_pos);
- if (found_position != injected_mouse_positions_.end()) {
- // Remove it from the list, and any positions that were added before it,
- // if any. This is because the local input monitor is assumed to receive
- // injected mouse position events in the order in which they were injected
- // (if at all). If the position is found somewhere other than the front of
- // the queue, this would be because the earlier positions weren't
- // successfully injected (or the local input monitor might have skipped over
- // some positions), and not because the events were out-of-sequence. These
- // spurious positions should therefore be discarded.
- injected_mouse_positions_.erase(injected_mouse_positions_.begin(),
- ++found_position);
- } else {
- // Release all pressed buttons or keys, disable inputs, and note the time.
- event_tracker_->ReleaseAll();
- latest_local_input_time_ = base::TimeTicks::Now();
+ if (expect_local_echo_) {
+ std::list<SkIPoint>::iterator found_position =
+ std::find(injected_mouse_positions_.begin(),
+ injected_mouse_positions_.end(), mouse_pos);
+ if (found_position != injected_mouse_positions_.end()) {
+ // Remove it from the list, and any positions that were added before it,
+ // if any. This is because the local input monitor is assumed to receive
+ // injected mouse position events in the order in which they were injected
+ // (if at all). If the position is found somewhere other than the front
+ // of the queue, this would be because the earlier positions weren't
+ // successfully injected (or the local input monitor might have skipped
+ // over some positions), and not because the events were out-of-sequence.
+ // These spurious positions should therefore be discarded.
+ injected_mouse_positions_.erase(injected_mouse_positions_.begin(),
+ ++found_position);
+ return;
+ }
}
+
+ // Release all pressed buttons or keys, disable inputs, and note the time.
+ event_tracker_->ReleaseAll();
+ latest_local_input_time_ = base::TimeTicks::Now();
+}
+
+void RemoteInputFilter::SetExpectLocalEcho(bool expect_local_echo) {
+ expect_local_echo_ = expect_local_echo;
+ if (!expect_local_echo_)
+ injected_mouse_positions_.clear();
}
void RemoteInputFilter::InjectKeyEvent(const protocol::KeyEvent& event) {
@@ -66,7 +76,7 @@ void RemoteInputFilter::InjectKeyEvent(const protocol::KeyEvent& event) {
void RemoteInputFilter::InjectMouseEvent(const protocol::MouseEvent& event) {
if (ShouldIgnoreInput())
return;
- if (event.has_x() && event.has_y()) {
+ if (expect_local_echo_ && event.has_x() && event.has_y()) {
injected_mouse_positions_.push_back(SkIPoint::Make(event.x(), event.y()));
if (injected_mouse_positions_.size() > kNumRemoteMousePositions) {
VLOG(1) << "Injected mouse positions queue full.";
diff --git a/remoting/host/remote_input_filter.h b/remoting/host/remote_input_filter.h
index 2446098..f2ca41d 100644
--- a/remoting/host/remote_input_filter.h
+++ b/remoting/host/remote_input_filter.h
@@ -30,6 +30,9 @@ class RemoteInputFilter : public protocol::InputStub {
// and block remote input for a short while.
void LocalMouseMoved(const SkIPoint& mouse_pos);
+ // Informs the filter that injecting input causes an echo.
+ void SetExpectLocalEcho(bool expect_local_echo);
+
// InputStub overrides.
virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE;
virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE;
@@ -46,6 +49,9 @@ class RemoteInputFilter : public protocol::InputStub {
// Time at which local input events were most recently observed.
base::TimeTicks latest_local_input_time_;
+ // If |true| than the filter assumes that injecting input causes an echo.
+ bool expect_local_echo_;
+
DISALLOW_COPY_AND_ASSIGN(RemoteInputFilter);
};