| 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 #include "ui/aura/dispatcher_linux.h" | 5 #include "ui/aura/dispatcher_linux.h" |
| 6 | 6 |
| 7 #include <X11/extensions/XInput2.h> | 7 #include <X11/extensions/XInput2.h> |
| 8 | 8 |
| 9 #include "ui/base/events.h" | 9 #include "ui/base/events.h" |
| 10 | 10 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 it != dispatchers_.end(); ++it) { | 45 it != dispatchers_.end(); ++it) { |
| 46 it->second->Dispatch(xev); | 46 it->second->Dispatch(xev); |
| 47 } | 47 } |
| 48 return true; | 48 return true; |
| 49 } | 49 } |
| 50 | 50 |
| 51 MessageLoop::Dispatcher* dispatcher = GetDispatcherForXEvent(xev); | 51 MessageLoop::Dispatcher* dispatcher = GetDispatcherForXEvent(xev); |
| 52 return dispatcher ? dispatcher->Dispatch(xev) : true; | 52 return dispatcher ? dispatcher->Dispatch(xev) : true; |
| 53 } | 53 } |
| 54 | 54 |
| 55 bool DispatcherLinux::ShouldExit() { |
| 56 return false; |
| 57 } |
| 58 |
| 55 MessageLoop::Dispatcher* DispatcherLinux::GetDispatcherForXEvent( | 59 MessageLoop::Dispatcher* DispatcherLinux::GetDispatcherForXEvent( |
| 56 XEvent* xev) const { | 60 XEvent* xev) const { |
| 57 ::Window window = xev->xany.window; | 61 ::Window window = xev->xany.window; |
| 58 if (xev->type == GenericEvent) { | 62 if (xev->type == GenericEvent) { |
| 59 XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(xev->xcookie.data); | 63 XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(xev->xcookie.data); |
| 60 window = xievent->event; | 64 window = xievent->event; |
| 61 } | 65 } |
| 62 DispatchersMap::const_iterator it = dispatchers_.find(window); | 66 DispatchersMap::const_iterator it = dispatchers_.find(window); |
| 63 return it != dispatchers_.end() ? it->second : NULL; | 67 return it != dispatchers_.end() ? it->second : NULL; |
| 64 } | 68 } |
| 65 | 69 |
| 66 MessageLoop::Dispatcher* CreateDispatcher() { | 70 MessageLoop::Dispatcher* CreateDispatcher() { |
| 67 return new DispatcherLinux; | 71 return new DispatcherLinux; |
| 68 } | 72 } |
| 69 | 73 |
| 70 } // namespace aura | 74 } // namespace aura |
| OLD | NEW |