| 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_glib_x.h" | 5 #include "base/message_pump_glib_x.h" |
| 6 | 6 |
| 7 #include <gdk/gdkx.h> | 7 #include <gdk/gdkx.h> |
| 8 #if defined(HAVE_XINPUT2) | 8 #if defined(HAVE_XINPUT2) |
| 9 #include <X11/extensions/XInput2.h> | 9 #include <X11/extensions/XInput2.h> |
| 10 #else | 10 #else |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 if (!WillProcessXEvent(&xev)) { | 73 if (!WillProcessXEvent(&xev)) { |
| 74 MessagePumpGlibXDispatcher::DispatchStatus status = | 74 MessagePumpGlibXDispatcher::DispatchStatus status = |
| 75 static_cast<MessagePumpGlibXDispatcher*> | 75 static_cast<MessagePumpGlibXDispatcher*> |
| 76 (GetDispatcher())->DispatchX(&xev); | 76 (GetDispatcher())->DispatchX(&xev); |
| 77 | 77 |
| 78 if (status == MessagePumpGlibXDispatcher::EVENT_QUIT) { | 78 if (status == MessagePumpGlibXDispatcher::EVENT_QUIT) { |
| 79 should_quit = true; | 79 should_quit = true; |
| 80 Quit(); | 80 Quit(); |
| 81 } else if (status == MessagePumpGlibXDispatcher::EVENT_IGNORED) { | 81 } else if (status == MessagePumpGlibXDispatcher::EVENT_IGNORED) { |
| 82 DLOG(WARNING) << "Event (" << xev.type << ") not handled."; | |
| 83 } | 82 } |
| 84 } | 83 } |
| 85 | 84 |
| 86 #if defined(HAVE_XINPUT2) | 85 #if defined(HAVE_XINPUT2) |
| 87 if (have_cookie) { | 86 if (have_cookie) { |
| 88 XFreeEventData(xev.xgeneric.display, &xev.xcookie); | 87 XFreeEventData(xev.xgeneric.display, &xev.xcookie); |
| 89 } | 88 } |
| 90 #endif | 89 #endif |
| 91 } else { | 90 } else { |
| 92 // TODO(sad): A couple of extra events can still sneak in during this. | 91 // TODO(sad): A couple of extra events can still sneak in during this. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 | 163 |
| 165 capture_x_events_[ButtonPress] = true; | 164 capture_x_events_[ButtonPress] = true; |
| 166 capture_gdk_events_[GDK_BUTTON_PRESS] = true; | 165 capture_gdk_events_[GDK_BUTTON_PRESS] = true; |
| 167 | 166 |
| 168 capture_x_events_[ButtonRelease] = true; | 167 capture_x_events_[ButtonRelease] = true; |
| 169 capture_gdk_events_[GDK_BUTTON_RELEASE] = true; | 168 capture_gdk_events_[GDK_BUTTON_RELEASE] = true; |
| 170 | 169 |
| 171 capture_x_events_[MotionNotify] = true; | 170 capture_x_events_[MotionNotify] = true; |
| 172 capture_gdk_events_[GDK_MOTION_NOTIFY] = true; | 171 capture_gdk_events_[GDK_MOTION_NOTIFY] = true; |
| 173 | 172 |
| 173 capture_x_events_[MappingNotify] = true; |
| 174 |
| 174 #if defined(HAVE_XINPUT2) | 175 #if defined(HAVE_XINPUT2) |
| 175 capture_x_events_[GenericEvent] = true; | 176 capture_x_events_[GenericEvent] = true; |
| 176 #endif | 177 #endif |
| 177 } | 178 } |
| 178 | 179 |
| 179 #if defined(HAVE_XINPUT2) | 180 #if defined(HAVE_XINPUT2) |
| 180 void MessagePumpGlibX::InitializeXInput2(void) { | 181 void MessagePumpGlibX::InitializeXInput2(void) { |
| 181 GdkDisplay* display = gdk_display_get_default(); | 182 GdkDisplay* display = gdk_display_get_default(); |
| 182 if (!display) | 183 if (!display) |
| 183 return; | 184 return; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 198 return; | 199 return; |
| 199 } | 200 } |
| 200 } | 201 } |
| 201 #endif // HAVE_XINPUT2 | 202 #endif // HAVE_XINPUT2 |
| 202 | 203 |
| 203 bool MessagePumpXObserver::WillProcessXEvent(XEvent* xev) { | 204 bool MessagePumpXObserver::WillProcessXEvent(XEvent* xev) { |
| 204 return false; | 205 return false; |
| 205 } | 206 } |
| 206 | 207 |
| 207 } // namespace base | 208 } // namespace base |
| OLD | NEW |