diff options
author | derat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-31 03:52:56 +0000 |
---|---|---|
committer | derat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-31 03:52:56 +0000 |
commit | 9822df966d60c67faaf4c4adacc70801aed9edaf (patch) | |
tree | c28ba74d57ca752e8159cc61d94790fba3fd0365 /ui | |
parent | ab56e93a64cc5d838df8b18112054b23321f97be (diff) | |
download | chromium_src-9822df966d60c67faaf4c4adacc70801aed9edaf.zip chromium_src-9822df966d60c67faaf4c4adacc70801aed9edaf.tar.gz chromium_src-9822df966d60c67faaf4c4adacc70801aed9edaf.tar.bz2 |
ash: Remap Command on Apple keyboards to Control [2/2]
This is yusukes's http://codereview.chromium.org/9854025/
with my review comments applied.
chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.cc:
* Every time when a new device is added, notify the name of
the device to KeyRewriter.
* Listens to XI_KeyPress and XI_KeyRelease events to the X
root window, and notify the device ID of the event to
KeyRewriter so that the rewriter could know the source of
the next KeyPress/KeyRelease Core event.
Note that it's not possible to monitor both XI_KeyPress and
core KeyPress events for a single X window. For example, if
we monitor XI_KeyPress events in aura::RootWindowHostLinux
(by calling XISelectEvents() for the root Aura window,
xwindow_), it becomes impossible to receive KeyPress core
events for |xwindow_| in RootWindowHostLinux. It's also
impossible to convert XI_KeyPress into core KeyPress. That
is the reason why xinput_hierarchy_changed_event_listener.cc
is used to monitor XI_KeyPress/Release events.
chrome/browser/ui/views/ash/key_rewriter.cc:
* Rewrites Command key press on an Apple keyboard to Control
key press, regardless of the user preference for remapping
modifier keys.
Part 1 of 2 (Ash part): http://codereview.chromium.org/9838010/
BUG=121012
TEST=manual
TBR=sky
Review URL: http://codereview.chromium.org/9963027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@130037 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/aura/event.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/ui/aura/event.h b/ui/aura/event.h index daa01eb..1a4f846 100644 --- a/ui/aura/event.h +++ b/ui/aura/event.h @@ -47,6 +47,10 @@ class AURA_EXPORT Event { const base::TimeDelta& time_stamp() const { return time_stamp_; } int flags() const { return flags_; } + // This is only intended to be used externally by classes that are modifying + // events in EventFilter::PreHandleKeyEvent(). + void set_flags(int flags) { flags_ = flags; } + // The following methods return true if the respective keys were pressed at // the time the event was created. bool IsShiftDown() const { return (flags_ & ui::EF_SHIFT_DOWN) != 0; } @@ -62,7 +66,6 @@ class AURA_EXPORT Event { Event(const base::NativeEvent& native_event, ui::EventType type, int flags); Event(const Event& copy); void set_type(ui::EventType type) { type_ = type; } - void set_flags(int flags) { flags_ = flags; } void set_delete_native_event(bool delete_native_event) { delete_native_event_ = delete_native_event; } @@ -250,6 +253,11 @@ class AURA_EXPORT KeyEvent : public Event { ui::KeyboardCode key_code() const { return key_code_; } bool is_char() const { return is_char_; } + // This is only intended to be used externally by classes that are modifying + // events in EventFilter::PreHandleKeyEvent(). set_character() should also be + // called. + void set_key_code(ui::KeyboardCode key_code) { key_code_ = key_code; } + private: ui::KeyboardCode key_code_; // True if this is a translated character event (vs. a raw key down). Both |