Chromium Code Reviews| 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_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" |
| 11 | 11 |
| 12 #include <iostream> | |
|
Elliot Glaysher
2012/03/28 17:49:00
This will add a static initializer to this file. A
| |
| 13 | |
| 12 namespace { | 14 namespace { |
| 13 | 15 |
| 14 gboolean XSourcePrepare(GSource* source, gint* timeout_ms) { | 16 gboolean XSourcePrepare(GSource* source, gint* timeout_ms) { |
| 15 if (XPending(base::MessagePumpX::GetDefaultXDisplay())) | 17 if (XPending(base::MessagePumpX::GetDefaultXDisplay())) |
| 16 *timeout_ms = 0; | 18 *timeout_ms = 0; |
| 17 else | 19 else |
| 18 *timeout_ms = -1; | 20 *timeout_ms = -1; |
| 19 return FALSE; | 21 return FALSE; |
| 20 } | 22 } |
| 21 | 23 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 int major = 2, minor = 0; | 69 int major = 2, minor = 0; |
| 68 #endif | 70 #endif |
| 69 if (XIQueryVersion(display, &major, &minor) == BadRequest) { | 71 if (XIQueryVersion(display, &major, &minor) == BadRequest) { |
| 70 DVLOG(1) << "XInput2 not supported in the server."; | 72 DVLOG(1) << "XInput2 not supported in the server."; |
| 71 xiopcode = -1; | 73 xiopcode = -1; |
| 72 return; | 74 return; |
| 73 } | 75 } |
| 74 #if defined(USE_XI2_MT) | 76 #if defined(USE_XI2_MT) |
| 75 if (major < 2 || (major == 2 && minor < USE_XI2_MT)) { | 77 if (major < 2 || (major == 2 && minor < USE_XI2_MT)) { |
| 76 DVLOG(1) << "XI version on server is " << major << "." << minor << ". " | 78 DVLOG(1) << "XI version on server is " << major << "." << minor << ". " |
| 77 << "But 2." << USE_XI2_MT << " is required."; | 79 << "But 2." << USE_XI2_MT << " is required."; |
| 78 xiopcode = -1; | 80 xiopcode = -1; |
| 79 return; | 81 return; |
| 80 } | 82 } |
| 81 #endif | 83 #endif |
| 82 } | 84 } |
| 83 | 85 |
| 84 } // namespace | 86 } // namespace |
| 85 | 87 |
| 86 namespace base { | 88 namespace base { |
| 87 | 89 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 190 return true; | 192 return true; |
| 191 } | 193 } |
| 192 return false; | 194 return false; |
| 193 } | 195 } |
| 194 | 196 |
| 195 void MessagePumpX::DidProcessXEvent(XEvent* xevent) { | 197 void MessagePumpX::DidProcessXEvent(XEvent* xevent) { |
| 196 FOR_EACH_OBSERVER(MessagePumpObserver, observers(), DidProcessEvent(xevent)); | 198 FOR_EACH_OBSERVER(MessagePumpObserver, observers(), DidProcessEvent(xevent)); |
| 197 } | 199 } |
| 198 | 200 |
| 199 } // namespace base | 201 } // namespace base |
| OLD | NEW |