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

Side by Side Diff: ash/accelerators/accelerator_dispatcher_linux.cc

Issue 9538015: Allows ash accelerators in wrench menu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes win compile Created 8 years, 9 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
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 "ash/accelerators/accelerator_dispatcher.h" 5 #include "ash/accelerators/accelerator_dispatcher.h"
6 6
7 #include <X11/Xlib.h> 7 #include <X11/Xlib.h>
8 8
9 // Xlib defines RootWindow 9 // Xlib defines RootWindow
10 #ifdef RootWindow 10 #ifdef RootWindow
11 #undef RootWindow 11 #undef RootWindow
12 #endif 12 #endif
13 13
14 #include "ash/accelerators/accelerator_controller.h" 14 #include "ash/accelerators/accelerator_controller.h"
15 #include "ash/ime/event.h"
15 #include "ash/shell.h" 16 #include "ash/shell.h"
16 #include "ui/aura/env.h" 17 #include "ui/aura/env.h"
17 #include "ui/aura/event.h" 18 #include "ui/aura/event.h"
18 #include "ui/aura/root_window.h" 19 #include "ui/aura/root_window.h"
19 #include "ui/base/accelerators/accelerator.h" 20 #include "ui/base/accelerators/accelerator.h"
20 #include "ui/base/events.h" 21 #include "ui/base/events.h"
21 22
22 namespace ash { 23 namespace ash {
23 24
24 namespace { 25 namespace {
25 26
26 const int kModifierMask = (ui::EF_SHIFT_DOWN | 27 const int kModifierMask = (ui::EF_SHIFT_DOWN |
27 ui::EF_CONTROL_DOWN | 28 ui::EF_CONTROL_DOWN |
28 ui::EF_ALT_DOWN); 29 ui::EF_ALT_DOWN);
29 } // namespace 30 } // namespace
30 31
31 base::MessagePumpDispatcher::DispatchStatus AcceleratorDispatcher::Dispatch( 32 base::MessagePumpDispatcher::DispatchStatus AcceleratorDispatcher::Dispatch(
32 XEvent* xev) { 33 XEvent* xev) {
34 // TODO(oshima): Consolidate win and linux. http://crbug.com/116282
33 if (!associated_window_) 35 if (!associated_window_)
34 return EVENT_QUIT; 36 return EVENT_QUIT;
35 if (!ui::IsNoopEvent(xev) && !associated_window_->CanReceiveEvents()) 37 if (!ui::IsNoopEvent(xev) && !associated_window_->CanReceiveEvents())
36 return aura::Env::GetInstance()->GetDispatcher()->Dispatch(xev); 38 return aura::Env::GetInstance()->GetDispatcher()->Dispatch(xev);
37 39
38 if (xev->type == KeyPress) { 40 if (xev->type == KeyPress || xev->type == KeyRelease) {
39 ash::AcceleratorController* accelerator_controller = 41 ash::AcceleratorController* accelerator_controller =
40 ash::Shell::GetInstance()->accelerator_controller(); 42 ash::Shell::GetInstance()->accelerator_controller();
41 ui::Accelerator accelerator(ui::KeyboardCodeFromNative(xev), 43 if (accelerator_controller) {
42 ui::EventFlagsFromNative(xev) & kModifierMask); 44 ui::Accelerator accelerator(ui::KeyboardCodeFromNative(xev),
43 if (accelerator_controller && accelerator_controller->Process(accelerator)) 45 ui::EventFlagsFromNative(xev) & kModifierMask);
44 return EVENT_PROCESSED; 46 if (accelerator_controller->Process(accelerator))
47 return EVENT_PROCESSED;
48
49 accelerator.set_type(TranslatedKeyEvent(xev, false).type());
50 if (accelerator_controller->Process(accelerator))
51 return EVENT_PROCESSED;
52 }
45 } 53 }
46 return nested_dispatcher_->Dispatch(xev); 54 return nested_dispatcher_->Dispatch(xev);
47 } 55 }
48 56
49 } // namespace ash 57 } // namespace ash
OLDNEW
« no previous file with comments | « ash/accelerators/accelerator_dispatcher.h ('k') | ash/accelerators/accelerator_dispatcher_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698