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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 return; | 68 return; |
69 | 69 |
70 int event, err; | 70 int event, err; |
71 | 71 |
72 if (!XQueryExtension(display, "XInputExtension", &xiopcode, &event, &err)) { | 72 if (!XQueryExtension(display, "XInputExtension", &xiopcode, &event, &err)) { |
73 VLOG(1) << "X Input extension not available."; | 73 VLOG(1) << "X Input extension not available."; |
74 xiopcode = -1; | 74 xiopcode = -1; |
75 return; | 75 return; |
76 } | 76 } |
77 | 77 |
| 78 #if defined(USE_XI2_MT) |
| 79 // USE_XI2_MT also defines the required XI2 minor minimum version. |
| 80 int major = 2, minor = USE_XI2_MT; |
| 81 #else |
78 int major = 2, minor = 0; | 82 int major = 2, minor = 0; |
| 83 #endif |
79 if (XIQueryVersion(display, &major, &minor) == BadRequest) { | 84 if (XIQueryVersion(display, &major, &minor) == BadRequest) { |
80 VLOG(1) << "XInput2 not supported in the server."; | 85 VLOG(1) << "XInput2 not supported in the server."; |
81 xiopcode = -1; | 86 xiopcode = -1; |
82 return; | 87 return; |
83 } | 88 } |
| 89 #if defined(USE_XI2_MT) |
| 90 if (major < 2 || (major == 2 && minor < USE_XI2_MT)) { |
| 91 VLOG(1) << "XI version on server is " << major << "." << minor << ". " |
| 92 << "But 2." << USE_XI2_MT << " is required."; |
| 93 xiopcode = -1; |
| 94 return; |
| 95 } |
| 96 #endif |
84 } | 97 } |
85 | 98 |
86 } // namespace | 99 } // namespace |
87 | 100 |
88 namespace base { | 101 namespace base { |
89 | 102 |
90 MessagePumpX::MessagePumpX() : MessagePumpGlib(), | 103 MessagePumpX::MessagePumpX() : MessagePumpGlib(), |
91 #if defined(TOOLKIT_USES_GTK) | 104 #if defined(TOOLKIT_USES_GTK) |
92 gdksource_(NULL), | 105 gdksource_(NULL), |
93 dispatching_event_(false), | 106 dispatching_event_(false), |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 COMPILE_ASSERT(XLASTEvent >= LASTEvent, XLASTEvent_too_small); | 327 COMPILE_ASSERT(XLASTEvent >= LASTEvent, XLASTEvent_too_small); |
315 | 328 |
316 #endif // defined(TOOLKIT_USES_GTK) | 329 #endif // defined(TOOLKIT_USES_GTK) |
317 | 330 |
318 MessagePumpObserver::EventStatus | 331 MessagePumpObserver::EventStatus |
319 MessagePumpObserver::WillProcessXEvent(XEvent* xev) { | 332 MessagePumpObserver::WillProcessXEvent(XEvent* xev) { |
320 return EVENT_CONTINUE; | 333 return EVENT_CONTINUE; |
321 } | 334 } |
322 | 335 |
323 } // namespace base | 336 } // namespace base |
OLD | NEW |