2 * Copyright (C) 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
15 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
18 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
24 * THE POSSIBILITY OF SUCH DAMAGE.
27 #ifndef EventSenderProxy_h
28 #define EventSenderProxy_h
32 #include <QTouchEvent>
35 #include <wtf/Vector.h>
37 #include <WebKit2/EWebKit2.h>
38 #include <wtf/Deque.h>
46 struct WTREventQueueItem;
51 class EventSenderProxy {
53 explicit EventSenderProxy(TestController*);
56 void mouseDown(unsigned button, WKEventModifiers);
57 void mouseUp(unsigned button, WKEventModifiers);
58 void mouseMoveTo(double x, double y);
59 void mouseScrollBy(int x, int y);
61 void leapForward(int milliseconds);
63 void keyDown(WKStringRef key, WKEventModifiers, unsigned location);
65 #if ENABLE(TOUCH_EVENTS)
67 void addTouchPoint(int x, int y);
68 void updateTouchPoint(int index, int x, int y);
69 void setTouchModifier(WKEventModifiers, bool enable);
70 void setTouchPointRadius(int radiusX, int radiusY);
75 void clearTouchPoints();
76 void releaseTouchPoint(int index);
77 void cancelTouchPoint(int index);
81 TestController* m_testController;
83 double currentEventTime() { return m_time; }
84 void updateClickCountForButton(int button);
86 #if PLATFORM(QT) || PLATFORM(GTK) || PLATFORM(EFL)
87 void replaySavedEvents();
91 #if ENABLE(TOUCH_EVENTS)
92 void sendTouchEvent(QEvent::Type);
94 void sendOrQueueEvent(QEvent*);
96 void sendOrQueueEvent(GdkEvent*);
97 GdkEvent* createMouseButtonEvent(GdkEventType, unsigned button, WKEventModifiers);
99 void sendOrQueueEvent(const WTREvent&);
100 void dispatchEvent(const WTREvent&);
101 #if ENABLE(TOUCH_EVENTS)
102 void sendTouchEvent(Ewk_Touch_Event_Type);
108 bool m_leftMouseButtonDown;
111 WKPoint m_clickPosition;
112 WKEventMouseButton m_clickButton;
116 Vector<WTREventQueueItem> m_eventQueue;
117 unsigned m_mouseButtonCurrentlyDown;
119 Qt::MouseButtons m_mouseButtons;
121 #if ENABLE(TOUCH_EVENTS)
122 QList<QTouchEvent::TouchPoint> m_touchPoints;
123 Qt::KeyboardModifiers m_touchModifiers;
124 QPoint m_touchPointRadius;
128 Deque<WTREvent> m_eventQueue;
129 unsigned m_mouseButton;
130 #if ENABLE(TOUCH_EVENTS)
131 Eina_List* m_touchPoints;
138 #endif // EventSenderProxy_h