OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef UI_VIEWS_FOCUS_ACCELERATOR_HANDLER_H_ | 5 #ifndef UI_VIEWS_FOCUS_ACCELERATOR_HANDLER_H_ |
6 #define UI_VIEWS_FOCUS_ACCELERATOR_HANDLER_H_ | 6 #define UI_VIEWS_FOCUS_ACCELERATOR_HANDLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 | 10 |
11 #if defined(TOOLKIT_USES_GTK) | 11 #if defined(TOOLKIT_USES_GTK) |
12 #include <gdk/gdk.h> | 12 #include <gdk/gdk.h> |
13 #endif | 13 #endif |
14 | 14 |
15 #include <set> | 15 #include <set> |
16 #include <vector> | 16 #include <vector> |
17 | 17 |
18 #include "base/message_loop.h" | 18 #include "base/message_loop.h" |
19 #include "views/views_export.h" | 19 #include "views/views_export.h" |
20 | 20 |
21 namespace views { | 21 namespace views { |
22 | 22 |
23 #if defined(TOUCH_UI) || defined(USE_AURA) | 23 #if defined(USE_AURA) && defined(USE_X11) && !defined(USE_WAYLAND) |
24 #if defined(USE_X11) && !defined(USE_WAYLAND) | |
25 // Dispatch an XEvent to the RootView. Return true if the event was dispatched | 24 // Dispatch an XEvent to the RootView. Return true if the event was dispatched |
26 // and handled, false otherwise. | 25 // and handled, false otherwise. |
27 bool VIEWS_EXPORT DispatchXEvent(XEvent* xevent); | 26 bool VIEWS_EXPORT DispatchXEvent(XEvent* xevent); |
28 #endif // USE_X11 && !USE_WAYLAND | 27 #endif // USE_AURA && USE_X11 && !USE_WAYLAND |
29 #endif // TOUCH_UI || USE_AURA | |
30 | 28 |
31 // This class delegates the key messages to the associated FocusManager class | 29 // This class delegates the key messages to the associated FocusManager class |
32 // for the window that is receiving these messages for accelerator processing. | 30 // for the window that is receiving these messages for accelerator processing. |
33 class VIEWS_EXPORT AcceleratorHandler : public MessageLoop::Dispatcher { | 31 class VIEWS_EXPORT AcceleratorHandler : public MessageLoop::Dispatcher { |
34 public: | 32 public: |
35 AcceleratorHandler(); | 33 AcceleratorHandler(); |
36 | 34 |
37 // Dispatcher method. This returns true if an accelerator was processed by the | 35 // Dispatcher method. This returns true if an accelerator was processed by the |
38 // focus manager | 36 // focus manager |
39 #if defined(OS_WIN) | 37 #if defined(OS_WIN) |
40 virtual bool Dispatch(const MSG& msg); | 38 virtual bool Dispatch(const MSG& msg); |
41 #elif defined(USE_WAYLAND) | 39 #elif defined(USE_WAYLAND) |
42 virtual base::MessagePumpDispatcher::DispatchStatus Dispatch( | 40 virtual base::MessagePumpDispatcher::DispatchStatus Dispatch( |
43 base::wayland::WaylandEvent* ev); | 41 base::wayland::WaylandEvent* ev); |
44 #elif defined(TOUCH_UI) || defined(USE_AURA) | 42 #elif defined(USE_AURA) |
45 virtual base::MessagePumpDispatcher::DispatchStatus Dispatch(XEvent* xev); | 43 virtual base::MessagePumpDispatcher::DispatchStatus Dispatch(XEvent* xev); |
46 #else | 44 #else |
47 virtual bool Dispatch(GdkEvent* event); | 45 virtual bool Dispatch(GdkEvent* event); |
48 #endif | 46 #endif |
49 | 47 |
50 private: | 48 private: |
51 #if defined(OS_WIN) | 49 #if defined(OS_WIN) |
52 // The keys currently pressed and consumed by the FocusManager. | 50 // The keys currently pressed and consumed by the FocusManager. |
53 std::set<WPARAM> pressed_keys_; | 51 std::set<WPARAM> pressed_keys_; |
54 #endif | 52 #endif |
55 | 53 |
56 DISALLOW_COPY_AND_ASSIGN(AcceleratorHandler); | 54 DISALLOW_COPY_AND_ASSIGN(AcceleratorHandler); |
57 }; | 55 }; |
58 | 56 |
59 } // namespace views | 57 } // namespace views |
60 | 58 |
61 #endif // UI_VIEWS_FOCUS_ACCELERATOR_HANDLER_H_ | 59 #endif // UI_VIEWS_FOCUS_ACCELERATOR_HANDLER_H_ |
OLD | NEW |