OLD | NEW |
---|---|
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 #ifndef UI_AURA_DISPATCHER_LINUX_H_ | 5 #ifndef UI_AURA_DISPATCHER_LINUX_H_ |
6 #define UI_AURA_DISPATCHER_LINUX_H_ | 6 #define UI_AURA_DISPATCHER_LINUX_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <vector> | |
10 #include <X11/Xlib.h> | 11 #include <X11/Xlib.h> |
11 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class. | 12 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class. |
12 #undef RootWindow | 13 #undef RootWindow |
13 | 14 |
14 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
15 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
16 #include "base/message_loop.h" | 17 #include "base/message_loop.h" |
17 | 18 |
18 namespace aura { | 19 namespace aura { |
19 | 20 |
20 class DispatcherLinux : public MessageLoop::Dispatcher, | 21 class DispatcherLinux : public MessageLoop::Dispatcher, |
21 public base::MessagePumpObserver { | 22 public base::MessagePumpObserver { |
22 public: | 23 public: |
23 DispatcherLinux(); | 24 DispatcherLinux(); |
24 virtual ~DispatcherLinux(); | 25 virtual ~DispatcherLinux(); |
25 | 26 |
26 void WindowDispatcherCreated(::Window window, | 27 // Register/Unregister Dispatcher for the |window|. |
27 MessageLoop::Dispatcher* dispatcher); | 28 void RegisterDispatcher(::Window window, |
Daniel Erat
2012/05/22 14:33:42
nit: rename to RegisterWindowDispatcher() or Rende
oshima
2012/05/22 19:50:02
Agreed. Renamed to RegisterDispatcherFor{Root}Wind
| |
28 void WindowDispatcherDestroying(::Window window); | 29 MessageLoop::Dispatcher* dispatcher); |
30 void UnregisterDispatcher(::Window window); | |
31 | |
32 // Register/Unregister Dispatchers for RootWindow. | |
Daniel Erat
2012/05/22 14:33:42
nit: reword this comment to something like:
// Re
oshima
2012/05/22 19:50:02
Done.
| |
33 void RegisterRootWindowDispatcher(MessageLoop::Dispatcher* dispatcher); | |
34 void UnregisterRootWindowDispatcher(MessageLoop::Dispatcher* dispatcher); | |
29 | 35 |
30 // Overridden from MessageLoop::Dispatcher: | 36 // Overridden from MessageLoop::Dispatcher: |
31 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; | 37 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; |
32 | 38 |
33 // Overridden from base::MessagePumpObserver: | 39 // Overridden from base::MessagePumpObserver: |
34 virtual base::EventStatus WillProcessEvent( | 40 virtual base::EventStatus WillProcessEvent( |
35 const base::NativeEvent& event) OVERRIDE; | 41 const base::NativeEvent& event) OVERRIDE; |
36 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE; | 42 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE; |
37 | 43 |
38 private: | 44 private: |
39 typedef std::map< ::Window, MessageLoop::Dispatcher* > DispatchersMap; | 45 typedef std::map< ::Window, MessageLoop::Dispatcher* > DispatchersMap; |
46 typedef std::vector<MessageLoop::Dispatcher*> Dispatchers; | |
40 | 47 |
41 MessageLoop::Dispatcher* GetDispatcherForXEvent(XEvent* xev) const; | 48 MessageLoop::Dispatcher* GetDispatcherForXEvent(XEvent* xev) const; |
49 void DispatchRootWindowEvent(XEvent* xev); | |
42 | 50 |
43 DispatchersMap dispatchers_; | 51 DispatchersMap dispatchers_; |
52 Dispatchers root_window_dispatchers_; | |
53 | |
54 ::Window root_window_; | |
Daniel Erat
2012/05/22 14:33:42
nit: rename to |x_root_window_|?
oshima
2012/05/22 19:50:02
Done.
| |
44 | 55 |
45 DISALLOW_COPY_AND_ASSIGN(DispatcherLinux); | 56 DISALLOW_COPY_AND_ASSIGN(DispatcherLinux); |
46 }; | 57 }; |
47 | 58 |
48 } // namespace aura | 59 } // namespace aura |
49 | 60 |
50 #endif // UI_AURA_DISPATCHER_LINUX_H_ | 61 #endif // UI_AURA_DISPATCHER_LINUX_H_ |
OLD | NEW |