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

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 const int kModifierMask =
40 ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN | 40 ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN |
41 ui::EF_COMMAND_DOWN | ui::EF_ALTGR_DOWN | 41 ui::EF_COMMAND_DOWN | ui::EF_ALTGR_DOWN | ui::EF_MOD3_DOWN |
42 ui::EF_MOD3_DOWN | ui::EF_NUM_LOCK_DOWN; 42 ui::EF_NUM_LOCK_ON | ui::EF_CAPS_LOCK_ON | ui::EF_SCROLL_LOCK_ON;
reveman 2016/01/07 12:02:59 nit: please avoid adding ui::EF_SCROLL_LOCK_ON as
Peter Kasting 2016/01/07 12:15:24 Oh, I thought you had told me this would have no e
reveman 2016/01/07 12:32:36 Sorry, I failed to think of this before. It wouldn
43 int modifier_flags = event->flags() & kModifierMask; 43 int modifier_flags = event->flags() & kModifierMask;
44 if (modifier_flags != modifier_flags_) { 44 if (modifier_flags != modifier_flags_) {
45 modifier_flags_ = modifier_flags; 45 modifier_flags_ = modifier_flags;
46 if (focus_) 46 if (focus_)
47 delegate_->OnKeyboardModifiers(modifier_flags_); 47 delegate_->OnKeyboardModifiers(modifier_flags_);
48 } 48 }
49 49
50 switch (event->type()) { 50 switch (event->type()) {
51 case ui::ET_KEY_PRESSED: { 51 case ui::ET_KEY_PRESSED: {
52 auto it = 52 auto it =
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 110
111 Surface* Keyboard::GetEffectiveFocus(aura::Window* window) const { 111 Surface* Keyboard::GetEffectiveFocus(aura::Window* window) const {
112 Surface* focus = Surface::AsSurface(window); 112 Surface* focus = Surface::AsSurface(window);
113 if (!focus) 113 if (!focus)
114 return nullptr; 114 return nullptr;
115 115
116 return delegate_->CanAcceptKeyboardEventsForSurface(focus) ? focus : nullptr; 116 return delegate_->CanAcceptKeyboardEventsForSurface(focus) ? focus : nullptr;
117 } 117 }
118 118
119 } // namespace exo 119 } // 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