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

Unified Diff: remoting/client/input_handler.cc

Issue 7316011: Release all keys on blur. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Avoid error messages on blur before the session is created. Created 9 years, 5 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/client/input_handler.h ('k') | remoting/client/plugin/chromoting_instance.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/input_handler.cc
diff --git a/remoting/client/input_handler.cc b/remoting/client/input_handler.cc
index 1dddc0abf4d2babc3cd009c6d4db61a1c0cbc787..690ce04bd03e7bac4fa18f08d078ee2a62ffedea 100644
--- a/remoting/client/input_handler.cc
+++ b/remoting/client/input_handler.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -22,9 +22,18 @@ InputHandler::InputHandler(ClientContext* context,
view_(view) {
}
+InputHandler::~InputHandler() {
+}
+
void InputHandler::SendKeyEvent(bool press, int keycode) {
protocol::InputStub* stub = connection_->input_stub();
if (stub) {
+ if (press) {
+ pressed_keys_.insert(keycode);
+ } else {
+ pressed_keys_.erase(keycode);
+ }
+
KeyEvent* event = new KeyEvent();
event->set_keycode(keycode);
event->set_pressed(press);
@@ -56,4 +65,13 @@ void InputHandler::SendMouseButtonEvent(bool button_down,
}
}
+void InputHandler::ReleaseAllKeys() {
+ std::set<int> pressed_keys_copy = pressed_keys_;
+ std::set<int>::iterator i;
+ for (i = pressed_keys_copy.begin(); i != pressed_keys_copy.end(); ++i) {
+ SendKeyEvent(false, *i);
+ }
+ pressed_keys_.clear();
+}
+
} // namespace remoting
« no previous file with comments | « remoting/client/input_handler.h ('k') | remoting/client/plugin/chromoting_instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698