| 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_x.h" | 5 #include "base/message_pump_x.h" |
| 6 | 6 |
| 7 #include <X11/extensions/XInput2.h> | 7 #include <X11/extensions/XInput2.h> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 XEvent* xev) { | 137 XEvent* xev) { |
| 138 bool should_quit = false; | 138 bool should_quit = false; |
| 139 | 139 |
| 140 bool have_cookie = false; | 140 bool have_cookie = false; |
| 141 if (xev->type == GenericEvent && | 141 if (xev->type == GenericEvent && |
| 142 XGetEventData(xev->xgeneric.display, &xev->xcookie)) { | 142 XGetEventData(xev->xgeneric.display, &xev->xcookie)) { |
| 143 have_cookie = true; | 143 have_cookie = true; |
| 144 } | 144 } |
| 145 | 145 |
| 146 if (!WillProcessXEvent(xev)) { | 146 if (!WillProcessXEvent(xev)) { |
| 147 MessagePumpDispatcher::DispatchStatus status = | 147 if (!dispatcher->Dispatch(xev)) { |
| 148 dispatcher->Dispatch(xev); | |
| 149 | |
| 150 if (status == MessagePumpDispatcher::EVENT_QUIT) { | |
| 151 should_quit = true; | 148 should_quit = true; |
| 152 Quit(); | 149 Quit(); |
| 153 } else if (status == MessagePumpDispatcher::EVENT_IGNORED) { | |
| 154 DVLOG(1) << "Event (" << xev->type << ") not handled."; | |
| 155 } | 150 } |
| 156 DidProcessXEvent(xev); | 151 DidProcessXEvent(xev); |
| 157 } | 152 } |
| 158 | 153 |
| 159 if (have_cookie) { | 154 if (have_cookie) { |
| 160 XFreeEventData(xev->xgeneric.display, &xev->xcookie); | 155 XFreeEventData(xev->xgeneric.display, &xev->xcookie); |
| 161 } | 156 } |
| 162 | 157 |
| 163 return should_quit; | 158 return should_quit; |
| 164 } | 159 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 190 return true; | 185 return true; |
| 191 } | 186 } |
| 192 return false; | 187 return false; |
| 193 } | 188 } |
| 194 | 189 |
| 195 void MessagePumpX::DidProcessXEvent(XEvent* xevent) { | 190 void MessagePumpX::DidProcessXEvent(XEvent* xevent) { |
| 196 FOR_EACH_OBSERVER(MessagePumpObserver, observers(), DidProcessEvent(xevent)); | 191 FOR_EACH_OBSERVER(MessagePumpObserver, observers(), DidProcessEvent(xevent)); |
| 197 } | 192 } |
| 198 | 193 |
| 199 } // namespace base | 194 } // namespace base |
| OLD | NEW |