| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "views/test/test_event_utils.h" |
| 6 |
| 7 #include <X11/extensions/XInput2.h> |
| 8 |
| 9 #include "ui/base/x/x11_util.h" |
| 10 |
| 11 namespace views { |
| 12 |
| 13 base::NativeEvent GetNativeEventForTesting() { |
| 14 XEvent* event = new XEvent; |
| 15 memset(event, 0, sizeof(*event)); |
| 16 XGenericEventCookie* cookie = &(event->xcookie); |
| 17 cookie->type = GenericEvent; |
| 18 XIDeviceEvent* dev_event = new XIDeviceEvent; |
| 19 memset(dev_event, 0, sizeof(*dev_event)); |
| 20 cookie->data = dev_event; |
| 21 return event; |
| 22 } |
| 23 |
| 24 void SetNativeEventLocationForTesting(const base::NativeEvent& native_event, |
| 25 int x, int y) { |
| 26 XIDeviceEvent* xievent = |
| 27 static_cast<XIDeviceEvent*>(native_event->xcookie.data); |
| 28 xievent->event_x = x; |
| 29 xievent->event_y = y; |
| 30 return; |
| 31 } |
| 32 |
| 33 } // namespace views |
| OLD | NEW |