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

Unified Diff: remoting/host/client_session.cc

Issue 10255007: Clamp events before they are sent to EventExecutors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix typo. Created 8 years, 8 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
« no previous file with comments | « remoting/host/client_session.h ('k') | remoting/host/event_executor_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/client_session.cc
diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc
index d45cda4cd683dfb2335221a9165e40c5b4ae945f..04a0ac951f54a4da603388b2103b990bd8fb90c6 100644
--- a/remoting/host/client_session.cc
+++ b/remoting/host/client_session.cc
@@ -21,8 +21,9 @@ ClientSession::ClientSession(
connection_(connection.Pass()),
client_jid_(connection_->session()->jid()),
host_event_stub_(host_event_stub),
- input_tracker_(host_event_stub),
+ input_tracker_(host_event_stub_),
remote_input_filter_(&input_tracker_),
+ mouse_input_filter_(&remote_input_filter_),
capturer_(capturer) {
connection_->SetEventHandler(this);
@@ -59,20 +60,11 @@ void ClientSession::InjectKeyEvent(const protocol::KeyEvent& event) {
void ClientSession::InjectMouseEvent(const protocol::MouseEvent& event) {
DCHECK(CalledOnValidThread());
- protocol::MouseEvent event_to_inject = event;
- if (event.has_x() && event.has_y()) {
- // In case the client sends events with off-screen coordinates, modify
- // the event to lie within the current screen area. This is better than
- // simply discarding the event, which might lose a button-up event at the
- // end of a drag'n'drop (or cause other related problems).
- SkIPoint pos(SkIPoint::Make(event.x(), event.y()));
- const SkISize& screen = capturer_->size_most_recent();
- pos.setX(std::max(0, std::min(screen.width() - 1, pos.x())));
- pos.setY(std::max(0, std::min(screen.height() - 1, pos.y())));
- event_to_inject.set_x(pos.x());
- event_to_inject.set_y(pos.y());
- }
- auth_input_filter_.InjectMouseEvent(event_to_inject);
+ // Ensure that the MouseInputFilter is clamping to the current dimensions.
+ mouse_input_filter_.set_output_size(capturer_->size_most_recent());
+ mouse_input_filter_.set_input_size(capturer_->size_most_recent());
+
+ auth_input_filter_.InjectMouseEvent(event);
}
void ClientSession::NotifyClientDimensions(
@@ -149,7 +141,7 @@ void ClientSession::SetDisableInputs(bool disable_inputs) {
disable_input_filter_.set_input_stub(NULL);
input_tracker_.ReleaseAll();
} else {
- disable_input_filter_.set_input_stub(&remote_input_filter_);
+ disable_input_filter_.set_input_stub(&mouse_input_filter_);
}
}
« no previous file with comments | « remoting/host/client_session.h ('k') | remoting/host/event_executor_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698