diff options
Diffstat (limited to 'WebKit/gtk/tests/testcopyandpaste.c')
-rw-r--r-- | WebKit/gtk/tests/testcopyandpaste.c | 26 |
1 files changed, 15 insertions, 11 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); |