OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 bool MessagePumpX::ProcessXEvent(MessagePumpDispatcher* dispatcher, | 135 bool MessagePumpX::ProcessXEvent(MessagePumpDispatcher* dispatcher, |
136 XEvent* xev) { | 136 XEvent* xev) { |
137 bool should_quit = false; | 137 bool should_quit = false; |
138 | 138 |
139 bool have_cookie = false; | 139 bool have_cookie = false; |
140 if (xev->type == GenericEvent && | 140 if (xev->type == GenericEvent && |
141 XGetEventData(xev->xgeneric.display, &xev->xcookie)) { | 141 XGetEventData(xev->xgeneric.display, &xev->xcookie)) { |
142 have_cookie = true; | 142 have_cookie = true; |
143 } | 143 } |
144 | 144 |
145 if (WillProcessXEvent(xev) == EVENT_CONTINUE) { | 145 if (!WillProcessXEvent(xev)) { |
146 MessagePumpDispatcher::DispatchStatus status = | 146 MessagePumpDispatcher::DispatchStatus status = |
147 dispatcher->Dispatch(xev); | 147 dispatcher->Dispatch(xev); |
148 | 148 |
149 if (status == MessagePumpDispatcher::EVENT_QUIT) { | 149 if (status == MessagePumpDispatcher::EVENT_QUIT) { |
150 should_quit = true; | 150 should_quit = true; |
151 Quit(); | 151 Quit(); |
152 } else if (status == MessagePumpDispatcher::EVENT_IGNORED) { | 152 } else if (status == MessagePumpDispatcher::EVENT_IGNORED) { |
153 DVLOG(1) << "Event (" << xev->type << ") not handled."; | 153 DVLOG(1) << "Event (" << xev->type << ") not handled."; |
154 } | 154 } |
155 DidProcessXEvent(xev); | 155 DidProcessXEvent(xev); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 return true; | 192 return true; |
193 } | 193 } |
194 return false; | 194 return false; |
195 } | 195 } |
196 | 196 |
197 void MessagePumpX::DidProcessXEvent(XEvent* xevent) { | 197 void MessagePumpX::DidProcessXEvent(XEvent* xevent) { |
198 FOR_EACH_OBSERVER(MessagePumpObserver, observers(), DidProcessEvent(xevent)); | 198 FOR_EACH_OBSERVER(MessagePumpObserver, observers(), DidProcessEvent(xevent)); |
199 } | 199 } |
200 | 200 |
201 } // namespace base | 201 } // namespace base |
OLD | NEW |