| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef UI_AURA_DISPATCHER_LINUX_H_ | |
| 6 #define UI_AURA_DISPATCHER_LINUX_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 #include <vector> | |
| 10 #include <X11/Xlib.h> | |
| 11 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class. | |
| 12 #undef RootWindow | |
| 13 | |
| 14 #include "base/basictypes.h" | |
| 15 #include "base/compiler_specific.h" | |
| 16 #include "base/message_loop.h" | |
| 17 #include "ui/aura/aura_export.h" | |
| 18 | |
| 19 namespace aura { | |
| 20 | |
| 21 class AURA_EXPORT DispatcherLinux : public MessageLoop::Dispatcher, | |
| 22 public base::MessagePumpObserver { | |
| 23 public: | |
| 24 DispatcherLinux(); | |
| 25 virtual ~DispatcherLinux(); | |
| 26 | |
| 27 // Adds/Removes |dispatcher| for the |x_window|. | |
| 28 void AddDispatcherForWindow(MessageLoop::Dispatcher* dispatcher, | |
| 29 ::Window x_window); | |
| 30 void RemoveDispatcherForWindow(::Window x_window); | |
| 31 | |
| 32 // Adds/Removes |dispatcher| to receive all events sent to the X | |
| 33 // root window. | |
| 34 void AddDispatcherForRootWindow(MessageLoop::Dispatcher* dispatcher); | |
| 35 void RemoveDispatcherForRootWindow(MessageLoop::Dispatcher* dispatcher); | |
| 36 | |
| 37 // Overridden from MessageLoop::Dispatcher: | |
| 38 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; | |
| 39 | |
| 40 // Overridden from base::MessagePumpObserver: | |
| 41 virtual base::EventStatus WillProcessEvent( | |
| 42 const base::NativeEvent& event) OVERRIDE; | |
| 43 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE; | |
| 44 | |
| 45 private: | |
| 46 typedef std::map< ::Window, MessageLoop::Dispatcher* > DispatchersMap; | |
| 47 typedef std::vector<MessageLoop::Dispatcher*> Dispatchers; | |
| 48 | |
| 49 MessageLoop::Dispatcher* GetDispatcherForXEvent(XEvent* xev) const; | |
| 50 | |
| 51 DispatchersMap dispatchers_; | |
| 52 Dispatchers root_window_dispatchers_; | |
| 53 | |
| 54 ::Window x_root_window_; | |
| 55 | |
| 56 DISALLOW_COPY_AND_ASSIGN(DispatcherLinux); | |
| 57 }; | |
| 58 | |
| 59 } // namespace aura | |
| 60 | |
| 61 #endif // UI_AURA_DISPATCHER_LINUX_H_ | |
| OLD | NEW |