OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_loop/message_pump_x11.h" | 5 #include "base/message_loop/message_pump_x11.h" |
6 | 6 |
7 #include <glib.h> | 7 #include <glib.h> |
8 #include <X11/X.h> | 8 #include <X11/X.h> |
9 #include <X11/extensions/XInput2.h> | 9 #include <X11/extensions/XInput2.h> |
10 #include <X11/XKBlib.h> | 10 #include <X11/XKBlib.h> |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 if (!g_xdisplay) | 151 if (!g_xdisplay) |
152 g_xdisplay = XOpenDisplay(NULL); | 152 g_xdisplay = XOpenDisplay(NULL); |
153 return g_xdisplay; | 153 return g_xdisplay; |
154 } | 154 } |
155 | 155 |
156 // static | 156 // static |
157 bool MessagePumpX11::HasXInput2() { | 157 bool MessagePumpX11::HasXInput2() { |
158 return InitializeXInput2(); | 158 return InitializeXInput2(); |
159 } | 159 } |
160 | 160 |
161 #if !defined(TOOLKIT_GTK) | 161 #if defined(TOOLKIT_GTK) |
| 162 // static |
| 163 MessagePumpX11* MessagePumpX11::Current() { |
| 164 MessageLoop* loop = MessageLoop::current(); |
| 165 return static_cast<MessagePumpX11*>(loop->pump_gpu()); |
| 166 } |
| 167 #else |
162 // static | 168 // static |
163 MessagePumpX11* MessagePumpX11::Current() { | 169 MessagePumpX11* MessagePumpX11::Current() { |
164 MessageLoopForUI* loop = MessageLoopForUI::current(); | 170 MessageLoopForUI* loop = MessageLoopForUI::current(); |
165 return static_cast<MessagePumpX11*>(loop->pump_ui()); | 171 return static_cast<MessagePumpX11*>(loop->pump_ui()); |
166 } | 172 } |
167 #endif | 173 #endif |
168 | 174 |
169 void MessagePumpX11::AddDispatcherForWindow( | 175 void MessagePumpX11::AddDispatcherForWindow( |
170 MessagePumpDispatcher* dispatcher, | 176 MessagePumpDispatcher* dispatcher, |
171 unsigned long xid) { | 177 unsigned long xid) { |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 if (FindEventTarget(xev) == x_root_window_) { | 314 if (FindEventTarget(xev) == x_root_window_) { |
309 FOR_EACH_OBSERVER(MessagePumpDispatcher, root_window_dispatchers_, | 315 FOR_EACH_OBSERVER(MessagePumpDispatcher, root_window_dispatchers_, |
310 Dispatch(xev)); | 316 Dispatch(xev)); |
311 return true; | 317 return true; |
312 } | 318 } |
313 MessagePumpDispatcher* dispatcher = GetDispatcherForXEvent(xev); | 319 MessagePumpDispatcher* dispatcher = GetDispatcherForXEvent(xev); |
314 return dispatcher ? dispatcher->Dispatch(xev) : true; | 320 return dispatcher ? dispatcher->Dispatch(xev) : true; |
315 } | 321 } |
316 | 322 |
317 } // namespace base | 323 } // namespace base |
OLD | NEW |