diff options
Diffstat (limited to 'WebKit/gtk/tests')
-rw-r--r-- | WebKit/gtk/tests/testcopyandpaste.c | 26 | ||||
-rw-r--r-- | WebKit/gtk/tests/testhittestresult.c | 10 |
2 files changed, 20 insertions, 16 deletions
diff --git a/WebKit/gtk/tests/testcopyandpaste.c b/WebKit/gtk/tests/testcopyandpaste.c index 0ef91d1..58fb764 100644 --- a/WebKit/gtk/tests/testcopyandpaste.c +++ b/WebKit/gtk/tests/testcopyandpaste.c @@ -128,21 +128,25 @@ static CopyAndPasteFixture* currentFixture; static JSValueRef runPasteTestCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { // Simulate a paste keyboard sequence. - GdkEvent event; - memset(&event, 0, sizeof(event)); - event.key.keyval = gdk_unicode_to_keyval('v'); - event.key.state = GDK_CONTROL_MASK; - event.key.window = gtk_widget_get_window(GTK_WIDGET(currentFixture->webView)); + GdkEvent* event = gdk_event_new(GDK_KEY_PRESS); + event->key.keyval = gdk_unicode_to_keyval('v'); + event->key.state = GDK_CONTROL_MASK; + event->key.window = gtk_widget_get_window(GTK_WIDGET(currentFixture->webView)); + g_object_ref(event->key.window); +#ifndef GTK_API_VERSION_2 + gdk_event_set_device(event, gdk_device_get_associated_device(gdk_display_get_core_pointer(gdk_drawable_get_display(event->key.window)))); +#endif GdkKeymapKey* keys; gint n_keys; - if (gdk_keymap_get_entries_for_keyval(gdk_keymap_get_default(), event.key.keyval, &keys, &n_keys)) { - event.key.hardware_keycode = keys[0].keycode; + if (gdk_keymap_get_entries_for_keyval(gdk_keymap_get_default(), event->key.keyval, &keys, &n_keys)) { + event->key.hardware_keycode = keys[0].keycode; g_free(keys); } - event.key.type = GDK_KEY_PRESS; - gtk_main_do_event(&event); - event.key.type = GDK_KEY_RELEASE; - gtk_main_do_event(&event); + + gtk_main_do_event(event); + event->key.type = GDK_KEY_RELEASE; + gtk_main_do_event(event); + gdk_event_free(event); JSStringRef scriptString = JSStringCreateWithUTF8CString("document.body.innerHTML;"); JSValueRef value = JSEvaluateScript(context, scriptString, 0, 0, 0, 0); diff --git a/WebKit/gtk/tests/testhittestresult.c b/WebKit/gtk/tests/testhittestresult.c index 89fe95c..0d7fb05 100644 --- a/WebKit/gtk/tests/testhittestresult.c +++ b/WebKit/gtk/tests/testhittestresult.c @@ -81,15 +81,15 @@ load_status_cb(WebKitWebView* webView, if (status == WEBKIT_LOAD_FINISHED) { WebKitHitTestResult* result; guint context; - GdkEventButton event; + GdkEvent* event = gdk_event_new(GDK_BUTTON_PRESS); WebKitDOMNode* node; - event.type = GDK_BUTTON_PRESS; /* Close enough to 0,0 */ - event.x = 5; - event.y = 5; + event->button.x = 5; + event->button.y = 5; - result = webkit_web_view_get_hit_test_result(webView, &event); + result = webkit_web_view_get_hit_test_result(webView, (GdkEventButton*) event); + gdk_event_free(event); g_assert(result); g_object_get(result, "context", &context, NULL); |