| 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 | |
| 168 // static | 162 // static |
| 169 MessagePumpX11* MessagePumpX11::Current() { | 163 MessagePumpX11* MessagePumpX11::Current() { |
| 170 MessageLoopForUI* loop = MessageLoopForUI::current(); | 164 MessageLoopForUI* loop = MessageLoopForUI::current(); |
| 171 return static_cast<MessagePumpX11*>(loop->pump_ui()); | 165 return static_cast<MessagePumpX11*>(loop->pump_ui()); |
| 172 } | 166 } |
| 173 #endif | 167 #endif |
| 174 | 168 |
| 175 void MessagePumpX11::AddDispatcherForWindow( | 169 void MessagePumpX11::AddDispatcherForWindow( |
| 176 MessagePumpDispatcher* dispatcher, | 170 MessagePumpDispatcher* dispatcher, |
| 177 unsigned long xid) { | 171 unsigned long xid) { |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 if (FindEventTarget(xev) == x_root_window_) { | 308 if (FindEventTarget(xev) == x_root_window_) { |
| 315 FOR_EACH_OBSERVER(MessagePumpDispatcher, root_window_dispatchers_, | 309 FOR_EACH_OBSERVER(MessagePumpDispatcher, root_window_dispatchers_, |
| 316 Dispatch(xev)); | 310 Dispatch(xev)); |
| 317 return true; | 311 return true; |
| 318 } | 312 } |
| 319 MessagePumpDispatcher* dispatcher = GetDispatcherForXEvent(xev); | 313 MessagePumpDispatcher* dispatcher = GetDispatcherForXEvent(xev); |
| 320 return dispatcher ? dispatcher->Dispatch(xev) : true; | 314 return dispatcher ? dispatcher->Dispatch(xev) : true; |
| 321 } | 315 } |
| 322 | 316 |
| 323 } // namespace base | 317 } // namespace base |
| OLD | NEW |