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 25 matching lines...) Expand all Loading... |
36 gdk_window_add_filter(NULL, &GdkEventFilter, this); | 36 gdk_window_add_filter(NULL, &GdkEventFilter, this); |
37 gdk_event_handler_set(&EventDispatcherX, this, NULL); | 37 gdk_event_handler_set(&EventDispatcherX, this, NULL); |
38 | 38 |
39 #if defined(HAVE_XINPUT2) | 39 #if defined(HAVE_XINPUT2) |
40 InitializeXInput2(); | 40 InitializeXInput2(); |
41 #endif | 41 #endif |
42 InitializeEventsToCapture(); | 42 InitializeEventsToCapture(); |
43 } | 43 } |
44 | 44 |
45 MessagePumpGlibX::~MessagePumpGlibX() { | 45 MessagePumpGlibX::~MessagePumpGlibX() { |
| 46 gdk_window_remove_filter(NULL, &GdkEventFilter, this); |
| 47 |
| 48 // It is not necessary to reset the GDK event handler using |
| 49 // gdk_event_handler_set since it's done in the destructor for |
| 50 // MessagePumpForUI. |
46 } | 51 } |
47 | 52 |
48 bool MessagePumpGlibX::ShouldCaptureXEvent(XEvent* xev) { | 53 bool MessagePumpGlibX::ShouldCaptureXEvent(XEvent* xev) { |
49 return capture_x_events_[xev->type] | 54 return capture_x_events_[xev->type] |
50 #if defined(HAVE_XINPUT2) | 55 #if defined(HAVE_XINPUT2) |
51 && (xev->type != GenericEvent || xev->xcookie.extension == xiopcode_) | 56 && (xev->type != GenericEvent || xev->xcookie.extension == xiopcode_) |
52 #endif | 57 #endif |
53 ; | 58 ; |
54 } | 59 } |
55 | 60 |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 return; | 225 return; |
221 } | 226 } |
222 } | 227 } |
223 #endif // HAVE_XINPUT2 | 228 #endif // HAVE_XINPUT2 |
224 | 229 |
225 bool MessagePumpXObserver::WillProcessXEvent(XEvent* xev) { | 230 bool MessagePumpXObserver::WillProcessXEvent(XEvent* xev) { |
226 return false; | 231 return false; |
227 } | 232 } |
228 | 233 |
229 } // namespace base | 234 } // namespace base |
OLD | NEW |