| 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 } | 160 } |
| 161 | 161 |
| 162 // static | 162 // static |
| 163 bool MessagePumpX::HasXInput2() { | 163 bool MessagePumpX::HasXInput2() { |
| 164 return xiopcode != -1; | 164 return xiopcode != -1; |
| 165 } | 165 } |
| 166 | 166 |
| 167 void MessagePumpX::InitXSource() { | 167 void MessagePumpX::InitXSource() { |
| 168 DCHECK(!x_source_); | 168 DCHECK(!x_source_); |
| 169 GPollFD* x_poll = new GPollFD(); | 169 GPollFD* x_poll = new GPollFD(); |
| 170 x_poll->fd = ConnectionNumber(g_xdisplay); | 170 x_poll->fd = ConnectionNumber(GetDefaultXDisplay()); |
| 171 x_poll->events = G_IO_IN; | 171 x_poll->events = G_IO_IN; |
| 172 | 172 |
| 173 x_source_ = g_source_new(&XSourceFuncs, sizeof(GSource)); | 173 x_source_ = g_source_new(&XSourceFuncs, sizeof(GSource)); |
| 174 g_source_add_poll(x_source_, x_poll); | 174 g_source_add_poll(x_source_, x_poll); |
| 175 g_source_set_can_recurse(x_source_, FALSE); | 175 g_source_set_can_recurse(x_source_, FALSE); |
| 176 g_source_attach(x_source_, g_main_context_default()); | 176 g_source_attach(x_source_, g_main_context_default()); |
| 177 } | 177 } |
| 178 | 178 |
| 179 bool MessagePumpX::ShouldCaptureXEvent(XEvent* xev) { | 179 bool MessagePumpX::ShouldCaptureXEvent(XEvent* xev) { |
| 180 return | 180 return |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 capture_gdk_events_[GDK_MOTION_NOTIFY] = true; | 331 capture_gdk_events_[GDK_MOTION_NOTIFY] = true; |
| 332 | 332 |
| 333 capture_x_events_[GenericEvent] = true; | 333 capture_x_events_[GenericEvent] = true; |
| 334 } | 334 } |
| 335 | 335 |
| 336 COMPILE_ASSERT(XLASTEvent >= LASTEvent, XLASTEvent_too_small); | 336 COMPILE_ASSERT(XLASTEvent >= LASTEvent, XLASTEvent_too_small); |
| 337 | 337 |
| 338 #endif // defined(TOOLKIT_USES_GTK) | 338 #endif // defined(TOOLKIT_USES_GTK) |
| 339 | 339 |
| 340 } // namespace base | 340 } // namespace base |
| OLD | NEW |