Changeset 85856 in webkit
- Timestamp:
- May 5, 2011 9:01:55 AM (13 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r85854 r85856 1 2011-05-05 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 Reviewed by Martin Robinson. 4 5 [GTK] Make native events code more consistent 6 https://bugs.webkit.org/show_bug.cgi?id=60258 7 8 Make all other native events code follow the current keyboard 9 events approach: use a GOwnPtr for the native event, and use 10 const GdkEvent* in the API. We need to implement the copy 11 constructors for native events to copy the gdk events with 12 gdk_event_copy(). 13 14 * Shared/NativeWebMouseEvent.h: 15 (WebKit::NativeWebMouseEvent::nativeEvent): 16 * Shared/NativeWebWheelEvent.h: 17 (WebKit::NativeWebWheelEvent::nativeEvent): 18 * Shared/gtk/NativeWebKeyboardEventGtk.cpp: 19 (WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent): 20 * Shared/gtk/NativeWebMouseEventGtk.cpp: 21 (WebKit::NativeWebMouseEvent::NativeWebMouseEvent): 22 * Shared/gtk/NativeWebWheelEventGtk.cpp: 23 (WebKit::NativeWebWheelEvent::NativeWebWheelEvent): 24 * Shared/gtk/WebEventFactory.cpp: 25 (WebKit::buttonForEvent): 26 (WebKit::WebEventFactory::createWebMouseEvent): 27 (WebKit::WebEventFactory::createWebWheelEvent): 28 (WebKit::WebEventFactory::createWebKeyboardEvent): 29 * Shared/gtk/WebEventFactory.h: 30 * UIProcess/API/gtk/WebKitWebViewBase.cpp: 31 (webkitWebViewBaseScrollEvent): 32 1 33 2011-05-05 Carlos Garcia Campos <cgarcia@igalia.com> 2 34 -
trunk/Source/WebKit2/Shared/NativeWebMouseEvent.h
r84138 r85856 35 35 #include <qgraphicssceneevent.h> 36 36 #elif PLATFORM(GTK) 37 #include <GOwnPtrGtk.h> 37 38 typedef union _GdkEvent GdkEvent; 38 39 #endif … … 49 50 explicit NativeWebMouseEvent(QGraphicsSceneMouseEvent*, int); 50 51 #elif PLATFORM(GTK) 52 NativeWebMouseEvent(const NativeWebMouseEvent&); 51 53 NativeWebMouseEvent(GdkEvent*, int); 52 54 #endif … … 59 61 const QGraphicsSceneMouseEvent* nativeEvent() const { return m_nativeEvent; } 60 62 #elif PLATFORM(GTK) 61 GdkEvent* nativeEvent() const { return m_nativeEvent; }63 const GdkEvent* nativeEvent() const { return m_nativeEvent.get(); } 62 64 #endif 63 65 … … 70 72 QGraphicsSceneMouseEvent* m_nativeEvent; 71 73 #elif PLATFORM(GTK) 72 G dkEvent*m_nativeEvent;74 GOwnPtr<GdkEvent> m_nativeEvent; 73 75 #endif 74 76 }; -
trunk/Source/WebKit2/Shared/NativeWebWheelEvent.h
r85841 r85856 35 35 #include <qgraphicssceneevent.h> 36 36 #elif PLATFORM(GTK) 37 typedef struct _GdkEventScroll GdkEventScroll; 37 #include <GOwnPtrGtk.h> 38 typedef union _GdkEvent GdkEvent; 38 39 #endif 39 40 … … 49 50 explicit NativeWebWheelEvent(QGraphicsSceneWheelEvent*); 50 51 #elif PLATFORM(GTK) 51 NativeWebWheelEvent(GdkEventScroll*); 52 NativeWebWheelEvent(const NativeWebWheelEvent&); 53 NativeWebWheelEvent(GdkEvent*); 52 54 #endif 53 55 … … 59 61 const QGraphicsSceneWheelEvent* nativeEvent() const { return m_nativeEvent; } 60 62 #elif PLATFORM(GTK) 61 GdkEventScroll* nativeEvent() const { return m_nativeEvent; }63 const GdkEvent* nativeEvent() const { return m_nativeEvent.get(); } 62 64 #endif 63 65 … … 70 72 QGraphicsSceneWheelEvent* m_nativeEvent; 71 73 #elif PLATFORM(GTK) 72 G dkEventScroll*m_nativeEvent;74 GOwnPtr<GdkEvent> m_nativeEvent; 73 75 #endif 74 76 }; -
trunk/Source/WebKit2/Shared/gtk/NativeWebKeyboardEventGtk.cpp
r79711 r85856 35 35 36 36 NativeWebKeyboardEvent::NativeWebKeyboardEvent(GdkEvent* event) 37 : WebKeyboardEvent(WebEventFactory::createWebKeyboardEvent( &event->key))37 : WebKeyboardEvent(WebEventFactory::createWebKeyboardEvent(event)) 38 38 , m_nativeEvent(gdk_event_copy(event)) 39 39 { … … 41 41 42 42 NativeWebKeyboardEvent::NativeWebKeyboardEvent(const NativeWebKeyboardEvent& event) 43 : WebKeyboardEvent(WebEventFactory::createWebKeyboardEvent( &event.nativeEvent()->key))43 : WebKeyboardEvent(WebEventFactory::createWebKeyboardEvent(event.nativeEvent())) 44 44 , m_nativeEvent(gdk_event_copy(event.nativeEvent())) 45 45 { -
trunk/Source/WebKit2/Shared/gtk/NativeWebMouseEventGtk.cpp
r84138 r85856 28 28 29 29 #include "WebEventFactory.h" 30 #include <gdk/gdk.h> 30 31 31 32 namespace WebKit { … … 33 34 NativeWebMouseEvent::NativeWebMouseEvent(GdkEvent* event, int eventClickCount) 34 35 : WebMouseEvent(WebEventFactory::createWebMouseEvent(event, eventClickCount)) 35 , m_nativeEvent(event) 36 , m_nativeEvent(gdk_event_copy(event)) 37 { 38 } 39 40 NativeWebMouseEvent::NativeWebMouseEvent(const NativeWebMouseEvent& event) 41 : WebMouseEvent(WebEventFactory::createWebMouseEvent(event.nativeEvent(), event.clickCount())) 42 , m_nativeEvent(gdk_event_copy(event.nativeEvent())) 36 43 { 37 44 } -
trunk/Source/WebKit2/Shared/gtk/NativeWebWheelEventGtk.cpp
r85756 r85856 28 28 29 29 #include "WebEventFactory.h" 30 #include <gdk/gdk.h> 30 31 31 32 namespace WebKit { 32 33 33 NativeWebWheelEvent::NativeWebWheelEvent(GdkEvent Scroll* event)34 NativeWebWheelEvent::NativeWebWheelEvent(GdkEvent* event) 34 35 : WebWheelEvent(WebEventFactory::createWebWheelEvent(event)) 35 , m_nativeEvent(event) 36 , m_nativeEvent(gdk_event_copy(event)) 37 { 38 } 39 40 NativeWebWheelEvent::NativeWebWheelEvent(const NativeWebWheelEvent& event) 41 : WebWheelEvent(WebEventFactory::createWebWheelEvent(event.nativeEvent())) 42 , m_nativeEvent(gdk_event_copy(event.nativeEvent())) 36 43 { 37 44 } -
trunk/Source/WebKit2/Shared/gtk/WebEventFactory.cpp
r82318 r85856 65 65 } 66 66 67 static inline WebMouseEvent::Button buttonForEvent( GdkEvent* event)67 static inline WebMouseEvent::Button buttonForEvent(const GdkEvent* event) 68 68 { 69 69 unsigned button = 0; … … 97 97 } 98 98 99 WebMouseEvent WebEventFactory::createWebMouseEvent( GdkEvent *event, int currentClickCount)99 WebMouseEvent WebEventFactory::createWebMouseEvent(const GdkEvent* event, int currentClickCount) 100 100 { 101 101 double x, y, xRoot, yRoot; … … 132 132 } 133 133 134 WebWheelEvent WebEventFactory::createWebWheelEvent( GdkEventScroll* scrollEvent)134 WebWheelEvent WebEventFactory::createWebWheelEvent(const GdkEvent* event) 135 135 { 136 GdkEvent* event(reinterpret_cast<GdkEvent*>(scrollEvent));137 136 double x, y, xRoot, yRoot; 138 137 gdk_event_get_coords(event, &x, &y); … … 140 139 141 140 FloatSize wheelTicks; 142 switch ( scrollEvent->direction) {141 switch (event->scroll.direction) { 143 142 case GDK_SCROLL_UP: 144 143 wheelTicks = FloatSize(0, 1); … … 172 171 } 173 172 174 WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(const GdkEvent Key* event)173 WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(const GdkEvent* event) 175 174 { 176 175 return WebKeyboardEvent((event->type == GDK_KEY_RELEASE) ? WebEvent::KeyUp : WebEvent::KeyDown, 177 PlatformKeyboardEvent::singleCharacterString(event->key val),178 PlatformKeyboardEvent::singleCharacterString(event->key val),179 PlatformKeyboardEvent::keyIdentifierForGdkKeyCode(event->key val),180 PlatformKeyboardEvent::windowsKeyCodeForGdkKeyCode(event->key val),181 static_cast<int>(event->key val),176 PlatformKeyboardEvent::singleCharacterString(event->key.keyval), 177 PlatformKeyboardEvent::singleCharacterString(event->key.keyval), 178 PlatformKeyboardEvent::keyIdentifierForGdkKeyCode(event->key.keyval), 179 PlatformKeyboardEvent::windowsKeyCodeForGdkKeyCode(event->key.keyval), 180 static_cast<int>(event->key.keyval), 182 181 0 /* macCharCode */, 183 182 false /* isAutoRepeat */, 184 isGdkKeyCodeFromKeyPad(event->key val),183 isGdkKeyCodeFromKeyPad(event->key.keyval), 185 184 false /* isSystemKey */, 186 modifiersForEvent( reinterpret_cast<const GdkEvent*>(event)),187 gdk_event_get_time( reinterpret_cast<const GdkEvent*>(event)));185 modifiersForEvent(event), 186 gdk_event_get_time(event)); 188 187 } 189 188 -
trunk/Source/WebKit2/Shared/gtk/WebEventFactory.h
r79711 r85856 31 31 32 32 typedef union _GdkEvent GdkEvent; 33 typedef struct _GdkEventScroll GdkEventScroll;34 typedef struct _GdkEventKey GdkEventKey;35 33 36 34 namespace WebKit { … … 38 36 class WebEventFactory { 39 37 public: 40 static WebMouseEvent createWebMouseEvent( GdkEvent*, int);41 static WebWheelEvent createWebWheelEvent( GdkEventScroll*);42 static WebKeyboardEvent createWebKeyboardEvent(const GdkEvent Key*);38 static WebMouseEvent createWebMouseEvent(const GdkEvent*, int); 39 static WebWheelEvent createWebWheelEvent(const GdkEvent*); 40 static WebKeyboardEvent createWebKeyboardEvent(const GdkEvent*); 43 41 }; 44 42 -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp
r85841 r85856 266 266 WebKitWebViewBasePrivate* priv = webViewBase->priv; 267 267 268 priv->pageProxy->handleWheelEvent(NativeWebWheelEvent( event));268 priv->pageProxy->handleWheelEvent(NativeWebWheelEvent(reinterpret_cast<GdkEvent*>(event))); 269 269 270 270 return FALSE;
Note: See TracChangeset
for help on using the changeset viewer.