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

Unified Diff: remoting/client/normalizing_input_filter_win.h

Issue 1416233002: Add NormalizingInputFilterWin to un-pick AltGr sequences. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments. Created 5 years, 2 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 | « no previous file | remoting/client/normalizing_input_filter_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/normalizing_input_filter_win.h
diff --git a/remoting/client/normalizing_input_filter_win.h b/remoting/client/normalizing_input_filter_win.h
new file mode 100644
index 0000000000000000000000000000000000000000..e4c2f95a1eaf74e3fc308f18f78e7c496913692f
--- /dev/null
+++ b/remoting/client/normalizing_input_filter_win.h
@@ -0,0 +1,60 @@
+// Copyright 2015 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.
+
+#ifndef REMOTING_CLIENT_NORMALIZING_INPUT_FILTER_WIN_H_
+#define REMOTING_CLIENT_NORMALIZING_INPUT_FILTER_WIN_H_
+
+#include "base/macros.h"
+#include "remoting/proto/event.pb.h"
+#include "remoting/protocol/input_filter.h"
+
+namespace remoting {
+
+// NormalizingInputFilterWin works around a quirk in Windows' handling of the
+// AltGr key. When using a layout that treats RightAlt as AltGr, Windows
+// generates the following for an AltGr keydown/keyup cycle:
+//
+// keydown LeftControl
+// keydown RightAlt
+// keyup LeftControl
+// keyup RightAlt
+//
+// In a layout without AltGr the key will generate only RightAlt events.
+//
+// This filter captures LeftControl keydown events and defers them until
+// some other event occurs; if the next event is a RightAlt keydown then
+// the LeftControl is ignored and neither keydown nor keyup will be sent
+// for it.
+class NormalizingInputFilterWin : public protocol::InputFilter {
+ public:
+ explicit NormalizingInputFilterWin(protocol::InputStub* input_stub);
+ ~NormalizingInputFilterWin() override;
+
+ // InputFilter interface.
+ void InjectKeyEvent(const protocol::KeyEvent& event) override;
+ void InjectMouseEvent(const protocol::MouseEvent& event) override;
+
+ private:
+ void ProcessKeyDown(const protocol::KeyEvent& event);
+ void ProcessKeyUp(const protocol::KeyEvent& event);
+
+ // Sends the |deferred_control_keydown_|, if any, and clears it.
+ void FlushDeferredKeydownEvent();
+
+ // Holds the keydown event for LeftControl immediately after it has been
+ // pressed, until we have determined whether it is part of AltGr.
+ protocol::KeyEvent deferred_control_keydown_;
+
+ // True if LeftControl is pressed and treated as LeftControl.
+ bool left_control_is_pressed_ = false;
+
+ // True if LeftControl is pressed as part of AltGr.
+ bool altgr_is_pressed_ = false;
+
+ DISALLOW_COPY_AND_ASSIGN(NormalizingInputFilterWin);
+};
+
+} // namespace remoting
+
+#endif // REMOTING_CLIENT_NORMALIZING_INPUT_FILTER_WIN_H_
« no previous file with comments | « no previous file | remoting/client/normalizing_input_filter_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698