Chromium Code Reviews| Index: views/test/test_event_utils_x.cc |
| diff --git a/views/test/test_event_utils_x.cc b/views/test/test_event_utils_x.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..908446f5a9d88064f4e1daa5a48dfa541b4b5f5f |
| --- /dev/null |
| +++ b/views/test/test_event_utils_x.cc |
| @@ -0,0 +1,34 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "views/test/test_event_utils.h" |
| + |
| +#include <X11/extensions/XInput.h> |
| +#include <X11/extensions/XInput2.h> |
|
rjkroege
2011/11/12 16:11:35
FYI: It has been the case that not all the builder
Gajen
2011/11/14 12:10:17
AFAIK, USE_XI2_MT flag switch on X2.1 and X2.0 is
|
| + |
| +#include "ui/base/x/x11_util.h" |
| + |
| +namespace views { |
| + |
| +base::NativeEvent GetNativeEventForTesting() { |
| + XEvent* event = new XEvent; |
| + memset(event, 0, sizeof(*event)); |
| + XGenericEventCookie* cookie = &(event->xcookie); |
| + cookie->type = GenericEvent; |
| + XIDeviceEvent* dev_event = new XIDeviceEvent; |
| + memset(dev_event, 0, sizeof(*dev_event)); |
| + cookie->data = dev_event; |
| + return event; |
| +} |
| + |
| +void SetNativeEventLocationForTesting(const base::NativeEvent& native_event, |
| + int x, int y) { |
| + XIDeviceEvent* xievent = |
| + static_cast<XIDeviceEvent*>(native_event->xcookie.data); |
| + xievent->event_x = x; |
| + xievent->event_y = y; |
| + return; |
| +} |
| + |
| +} // namespace views |