| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/events/platform/x11/x11_event_source.h" | 5 #include "ui/events/platform/x11/x11_event_source.h" |
| 6 | 6 |
| 7 #include <glib.h> | 7 #include <glib.h> |
| 8 #include <X11/extensions/XInput2.h> | 8 #include <X11/extensions/XInput2.h> |
| 9 #include <X11/X.h> | 9 #include <X11/X.h> |
| 10 #include <X11/Xlib.h> | 10 #include <X11/Xlib.h> |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 | 189 |
| 190 uint32_t X11EventSource::DispatchEvent(XEvent* xevent) { | 190 uint32_t X11EventSource::DispatchEvent(XEvent* xevent) { |
| 191 bool have_cookie = false; | 191 bool have_cookie = false; |
| 192 if (xevent->type == GenericEvent && | 192 if (xevent->type == GenericEvent && |
| 193 XGetEventData(xevent->xgeneric.display, &xevent->xcookie)) { | 193 XGetEventData(xevent->xgeneric.display, &xevent->xcookie)) { |
| 194 have_cookie = true; | 194 have_cookie = true; |
| 195 } | 195 } |
| 196 | 196 |
| 197 // TODO(sad): Remove this once all MessagePumpObservers are turned into | 197 // TODO(sad): Remove this once all MessagePumpObservers are turned into |
| 198 // PlatformEventObservers. | 198 // PlatformEventObservers. |
| 199 uint32_t action = ui::POST_DISPATCH_NONE; | 199 base::MessagePumpX11::Current()->WillProcessXEvent(xevent); |
| 200 if (!base::MessagePumpX11::Current()->WillProcessXEvent(xevent)) { | 200 uint32_t action = PlatformEventSource::DispatchEvent(xevent); |
| 201 action = PlatformEventSource::DispatchEvent(xevent); | 201 base::MessagePumpX11::Current()->DidProcessXEvent(xevent); |
| 202 base::MessagePumpX11::Current()->DidProcessXEvent(xevent); | |
| 203 } | |
| 204 | 202 |
| 205 if (have_cookie) | 203 if (have_cookie) |
| 206 XFreeEventData(xevent->xgeneric.display, &xevent->xcookie); | 204 XFreeEventData(xevent->xgeneric.display, &xevent->xcookie); |
| 207 return action; | 205 return action; |
| 208 } | 206 } |
| 209 | 207 |
| 210 scoped_ptr<PlatformEventSource> PlatformEventSource::CreateDefault() { | 208 scoped_ptr<PlatformEventSource> PlatformEventSource::CreateDefault() { |
| 211 return scoped_ptr<PlatformEventSource>( | 209 return scoped_ptr<PlatformEventSource>( |
| 212 new X11EventSource(gfx::GetXDisplay())); | 210 new X11EventSource(gfx::GetXDisplay())); |
| 213 } | 211 } |
| 214 | 212 |
| 215 } // namespace ui | 213 } // namespace ui |
| OLD | NEW |