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

Unified Diff: ui/views/events/event.cc

Issue 10535046: Add Windows commandline switch --enable-views-textfield. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revert TextfieldController change. Created 8 years, 6 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: ui/views/events/event.cc
diff --git a/ui/views/events/event.cc b/ui/views/events/event.cc
index fa8ce364a55d3284f540eff7db373962962f20c6..a1a31554f3e1457adbf9a0fa84635cd1eca1c74c 100644
--- a/ui/views/events/event.cc
+++ b/ui/views/events/event.cc
@@ -87,6 +87,22 @@ KeyEvent::KeyEvent(ui::EventType type,
unmodified_character_(0) {
}
+bool KeyEvent::IsNumPadDigit() const {
+ if (key_code_ >= VK_NUMPAD0 && key_code_ <= VK_NUMPAD9)
+ return true;
+
+ // Check for num pad keys without NumLock.
+ // Note: there is no easy way to know if a the key that was pressed comes from
+ // the num pad or the rest of the keyboard. Investigating how
+ // TranslateMessage() generates the WM_KEYCHAR from an
+ // ALT + <NumPad sequences> it appears it looks at the extended key flag
+ // (which is on if the key pressed comes from one of the 3 clusters to
+ // the left of the numeric keypad). So we use it as well.
+ return ((flags() & ui::EF_EXTENDED) == 0) &&
+ ((key_code_ >= VK_PRIOR && key_code_ <= VK_DOWN) || // All but 0 and 5.
+ (key_code_ == VK_CLEAR) || (key_code_ == VK_INSERT)); // Keys 0 and 5.
+}
+
////////////////////////////////////////////////////////////////////////////////
// MouseEvent, public:

Powered by Google App Engine
This is Rietveld 408576698