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

Side by Side Diff: components/exo/keyboard.cc

Issue 1559163002: Clean up event flags a bit: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comment Created 4 years, 11 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/libgtk2ui/gtk2_util.cc ('k') | components/exo/pointer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/exo/keyboard.h" 5 #include "components/exo/keyboard.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "components/exo/keyboard_delegate.h" 8 #include "components/exo/keyboard_delegate.h"
9 #include "components/exo/surface.h" 9 #include "components/exo/surface.h"
10 #include "ui/aura/client/focus_client.h" 10 #include "ui/aura/client/focus_client.h"
(...skipping 18 matching lines...) Expand all
29 focus_->RemoveSurfaceObserver(this); 29 focus_->RemoveSurfaceObserver(this);
30 aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow()) 30 aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow())
31 ->RemoveObserver(this); 31 ->RemoveObserver(this);
32 ash::Shell::GetInstance()->RemovePreTargetHandler(this); 32 ash::Shell::GetInstance()->RemovePreTargetHandler(this);
33 } 33 }
34 34
35 //////////////////////////////////////////////////////////////////////////////// 35 ////////////////////////////////////////////////////////////////////////////////
36 // ui::EventHandler overrides: 36 // ui::EventHandler overrides:
37 37
38 void Keyboard::OnKeyEvent(ui::KeyEvent* event) { 38 void Keyboard::OnKeyEvent(ui::KeyEvent* event) {
39 const int kModifierMask = ui::EF_CAPS_LOCK_DOWN | ui::EF_SHIFT_DOWN | 39 // These modifiers reflect what Wayland is aware of. For example,
40 ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN | 40 // EF_SCROLL_LOCK_ON is missing because Wayland doesn't support scroll lock.
41 ui::EF_COMMAND_DOWN | ui::EF_ALTGR_DOWN | 41 const int kModifierMask = ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN |
42 ui::EF_MOD3_DOWN | ui::EF_NUM_LOCK_DOWN; 42 ui::EF_ALT_DOWN | ui::EF_COMMAND_DOWN |
43 ui::EF_ALTGR_DOWN | ui::EF_MOD3_DOWN |
44 ui::EF_NUM_LOCK_ON | ui::EF_CAPS_LOCK_ON;
43 int modifier_flags = event->flags() & kModifierMask; 45 int modifier_flags = event->flags() & kModifierMask;
44 if (modifier_flags != modifier_flags_) { 46 if (modifier_flags != modifier_flags_) {
45 modifier_flags_ = modifier_flags; 47 modifier_flags_ = modifier_flags;
46 if (focus_) 48 if (focus_)
47 delegate_->OnKeyboardModifiers(modifier_flags_); 49 delegate_->OnKeyboardModifiers(modifier_flags_);
48 } 50 }
49 51
50 switch (event->type()) { 52 switch (event->type()) {
51 case ui::ET_KEY_PRESSED: { 53 case ui::ET_KEY_PRESSED: {
52 auto it = 54 auto it =
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 112
111 Surface* Keyboard::GetEffectiveFocus(aura::Window* window) const { 113 Surface* Keyboard::GetEffectiveFocus(aura::Window* window) const {
112 Surface* focus = Surface::AsSurface(window); 114 Surface* focus = Surface::AsSurface(window);
113 if (!focus) 115 if (!focus)
114 return nullptr; 116 return nullptr;
115 117
116 return delegate_->CanAcceptKeyboardEventsForSurface(focus) ? focus : nullptr; 118 return delegate_->CanAcceptKeyboardEventsForSurface(focus) ? focus : nullptr;
117 } 119 }
118 120
119 } // namespace exo 121 } // namespace exo
OLDNEW
« no previous file with comments | « chrome/browser/ui/libgtk2ui/gtk2_util.cc ('k') | components/exo/pointer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698