| 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 "base/message_pump_aurax11.h" | 5 #include "base/message_pump_aurax11.h" |
| 6 | 6 |
| 7 #include <glib.h> | 7 #include <glib.h> |
| 8 #include <X11/X.h> | 8 #include <X11/X.h> |
| 9 #include <X11/extensions/XInput2.h> | 9 #include <X11/extensions/XInput2.h> |
| 10 #include <X11/XKBlib.h> | 10 #include <X11/XKBlib.h> |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 #endif | 84 #endif |
| 85 | 85 |
| 86 return true; | 86 return true; |
| 87 } | 87 } |
| 88 | 88 |
| 89 Window FindEventTarget(const base::NativeEvent& xev) { | 89 Window FindEventTarget(const base::NativeEvent& xev) { |
| 90 Window target = xev->xany.window; | 90 Window target = xev->xany.window; |
| 91 if (xev->type == GenericEvent && | 91 if (xev->type == GenericEvent && |
| 92 static_cast<XIEvent*>(xev->xcookie.data)->extension == g_xinput_opcode) { | 92 static_cast<XIEvent*>(xev->xcookie.data)->extension == g_xinput_opcode) { |
| 93 target = static_cast<XIDeviceEvent*>(xev->xcookie.data)->event; | 93 target = static_cast<XIDeviceEvent*>(xev->xcookie.data)->event; |
| 94 } else if (xev->type == MapNotify) { |
| 95 target = xev->xmap.window; |
| 96 } else if (xev->type == UnmapNotify) { |
| 97 target = xev->xunmap.window; |
| 94 } | 98 } |
| 99 // TODO(erg): Are there other events that we aren't reacting to properly |
| 100 // because xev->xany.window != xev->eventname.window? |
| 101 |
| 95 return target; | 102 return target; |
| 96 } | 103 } |
| 97 | 104 |
| 98 bool InitializeXInput2() { | 105 bool InitializeXInput2() { |
| 99 static bool xinput2_supported = InitializeXInput2Internal(); | 106 static bool xinput2_supported = InitializeXInput2Internal(); |
| 100 return xinput2_supported; | 107 return xinput2_supported; |
| 101 } | 108 } |
| 102 | 109 |
| 103 bool InitializeXkb() { | 110 bool InitializeXkb() { |
| 104 Display* display = base::MessagePumpAuraX11::GetDefaultXDisplay(); | 111 Display* display = base::MessagePumpAuraX11::GetDefaultXDisplay(); |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 if (FindEventTarget(xev) == x_root_window_) { | 305 if (FindEventTarget(xev) == x_root_window_) { |
| 299 FOR_EACH_OBSERVER(MessagePumpDispatcher, root_window_dispatchers_, | 306 FOR_EACH_OBSERVER(MessagePumpDispatcher, root_window_dispatchers_, |
| 300 Dispatch(xev)); | 307 Dispatch(xev)); |
| 301 return true; | 308 return true; |
| 302 } | 309 } |
| 303 MessagePumpDispatcher* dispatcher = GetDispatcherForXEvent(xev); | 310 MessagePumpDispatcher* dispatcher = GetDispatcherForXEvent(xev); |
| 304 return dispatcher ? dispatcher->Dispatch(xev) : true; | 311 return dispatcher ? dispatcher->Dispatch(xev) : true; |
| 305 } | 312 } |
| 306 | 313 |
| 307 } // namespace base | 314 } // namespace base |
| OLD | NEW |