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

Side by Side Diff: ui/views/focus/focus_manager.cc

Issue 308023002: Add EF_IS_REPEAT flag to KeyEvent to handle repeated accelerators correctly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use ui::EF_IS_REPEAT in test instead Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/events/event_utils.h ('k') | ui/wm/core/accelerator_delegate.h » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/views/focus/focus_manager.h" 5 #include "ui/views/focus/focus_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 int modifiers = ui::EF_NONE; 62 int modifiers = ui::EF_NONE;
63 if (event.IsShiftDown()) 63 if (event.IsShiftDown())
64 modifiers |= ui::EF_SHIFT_DOWN; 64 modifiers |= ui::EF_SHIFT_DOWN;
65 if (event.IsControlDown()) 65 if (event.IsControlDown())
66 modifiers |= ui::EF_CONTROL_DOWN; 66 modifiers |= ui::EF_CONTROL_DOWN;
67 if (event.IsAltDown()) 67 if (event.IsAltDown())
68 modifiers |= ui::EF_ALT_DOWN; 68 modifiers |= ui::EF_ALT_DOWN;
69 ui::Accelerator accelerator(event.key_code(), modifiers); 69 ui::Accelerator accelerator(event.key_code(), modifiers);
70 accelerator.set_type(event.type()); 70 accelerator.set_type(event.type());
71 accelerator.set_is_repeat(event.IsRepeat());
71 72
72 if (event.type() == ui::ET_KEY_PRESSED) { 73 if (event.type() == ui::ET_KEY_PRESSED) {
73 // If the focused view wants to process the key event as is, let it be. 74 // If the focused view wants to process the key event as is, let it be.
74 if (focused_view_ && focused_view_->SkipDefaultKeyEventProcessing(event) && 75 if (focused_view_ && focused_view_->SkipDefaultKeyEventProcessing(event) &&
75 !accelerator_manager_->HasPriorityHandler(accelerator)) 76 !accelerator_manager_->HasPriorityHandler(accelerator))
76 return true; 77 return true;
77 78
78 // Intercept Tab related messages for focus traversal. 79 // Intercept Tab related messages for focus traversal.
79 // Note that we don't do focus traversal if the root window is not part of 80 // Note that we don't do focus traversal if the root window is not part of
80 // the active window hierarchy as this would mean we have no focused view 81 // the active window hierarchy as this would mean we have no focused view
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 } 580 }
580 if (key_code == ui::VKEY_RIGHT || key_code == ui::VKEY_DOWN) { 581 if (key_code == ui::VKEY_RIGHT || key_code == ui::VKEY_DOWN) {
581 AdvanceFocus(false); 582 AdvanceFocus(false);
582 return true; 583 return true;
583 } 584 }
584 585
585 return false; 586 return false;
586 } 587 }
587 588
588 } // namespace views 589 } // namespace views
OLDNEW
« no previous file with comments | « ui/events/event_utils.h ('k') | ui/wm/core/accelerator_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698