diff options
Diffstat (limited to 'ui/events/x/events_x_utils.h')
-rw-r--r-- | ui/events/x/events_x_utils.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/ui/events/x/events_x_utils.h b/ui/events/x/events_x_utils.h index a4cc905..c1ee0e8 100644 --- a/ui/events/x/events_x_utils.h +++ b/ui/events/x/events_x_utils.h @@ -2,9 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/memory/scoped_ptr.h" #include "ui/events/event_constants.h" #include "ui/events/events_export.h" #include "ui/events/keycodes/keyboard_codes.h" +#include "ui/events/x/device_data_manager.h" +#include "ui/gfx/point.h" #include "ui/gfx/x/x11_types.h" typedef union _XEvent XEvent; @@ -17,6 +20,38 @@ EVENTS_EXPORT void InitXKeyEventForTesting(EventType type, KeyboardCode key_code, int flags, XEvent* event); +#if defined(USE_XI2_MT) +struct Valuator { + Valuator(DeviceDataManager::DataType type, double v) + : data_type(type), value(v) {} + + DeviceDataManager::DataType data_type; + double value; +}; + +class EVENTS_EXPORT XScopedTouchEvent { + public: + explicit XScopedTouchEvent(XEvent* event); + ~XScopedTouchEvent(); + + operator XEvent*() { return event_.get(); } + + private: + scoped_ptr<XEvent> event_; + + DISALLOW_COPY_AND_ASSIGN(XScopedTouchEvent); +}; + +EVENTS_EXPORT XEvent* CreateTouchEvent(int deviceid, + int evtype, + int tracking_id, + const gfx::Point& location, + const std::vector<Valuator>& valuators); + +EVENTS_EXPORT void SetupTouchDevicesForTest( + const std::vector<unsigned int>& devices); + +#endif // defined(USE_XI2_MT) // Initializes a XEvent that holds XButtonEvent for testing. Note that ui::EF_ // flags should be passed as |flags|, not the native ones in <X11/X.h>. |