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 DispatchStatus status = dispatcher->Dispatch(xev); |
148 dispatcher->Dispatch(xev); | |
149 | 148 |
150 if (status == MessagePumpDispatcher::EVENT_QUIT) { | 149 if (status == EVENT_QUIT) { |
151 should_quit = true; | 150 should_quit = true; |
152 Quit(); | 151 Quit(); |
153 } else if (status == MessagePumpDispatcher::EVENT_IGNORED) { | 152 } else if (status == EVENT_IGNORED) { |
154 DVLOG(1) << "Event (" << xev->type << ") not handled."; | 153 DVLOG(1) << "Event (" << xev->type << ") not handled."; |
155 } | 154 } |
156 DidProcessXEvent(xev); | 155 DidProcessXEvent(xev); |
157 } | 156 } |
158 | 157 |
159 if (have_cookie) { | 158 if (have_cookie) { |
160 XFreeEventData(xev->xgeneric.display, &xev->xcookie); | 159 XFreeEventData(xev->xgeneric.display, &xev->xcookie); |
161 } | 160 } |
162 | 161 |
163 return should_quit; | 162 return should_quit; |
(...skipping 26 matching lines...) Expand all Loading... |
190 return true; | 189 return true; |
191 } | 190 } |
192 return false; | 191 return false; |
193 } | 192 } |
194 | 193 |
195 void MessagePumpX::DidProcessXEvent(XEvent* xevent) { | 194 void MessagePumpX::DidProcessXEvent(XEvent* xevent) { |
196 FOR_EACH_OBSERVER(MessagePumpObserver, observers(), DidProcessEvent(xevent)); | 195 FOR_EACH_OBSERVER(MessagePumpObserver, observers(), DidProcessEvent(xevent)); |
197 } | 196 } |
198 | 197 |
199 } // namespace base | 198 } // namespace base |
OLD | NEW |