pidgin/android/android

84e141f1bfed
Parents 92a0135ceb96
Children 887606eec74b
Add some context when using the keyboard to open a popup.
--- a/pidgin/gtkwebview.c Sun Aug 12 04:00:19 2012 -0400
+++ b/pidgin/gtkwebview.c Sun Aug 12 04:01:47 2012 -0400
@@ -419,9 +419,31 @@
static gboolean
webview_popup_menu(WebKitWebView *webview)
{
+ WebKitDOMDocument *doc;
+ WebKitDOMElement *active;
+ WebKitDOMElement *link;
+ int context;
+ char *uri;
+
+ context = WEBKIT_HIT_TEST_RESULT_CONTEXT_DOCUMENT;
+ uri = NULL;
+
+ doc = webkit_web_view_get_dom_document(webview);
+ active = webkit_dom_html_document_get_active_element(WEBKIT_DOM_HTML_DOCUMENT(doc));
+
+ link = active;
+ while (link && !WEBKIT_DOM_IS_HTML_ANCHOR_ELEMENT(link))
+ link = webkit_dom_node_get_parent_element(WEBKIT_DOM_NODE(link));
+ if (WEBKIT_DOM_IS_HTML_ANCHOR_ELEMENT(link)) {
+ context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK;
+ uri = webkit_dom_html_anchor_element_get_href(WEBKIT_DOM_HTML_ANCHOR_ELEMENT(link));
+ }
+
do_popup_menu(webview, 0, gtk_get_current_event_time(),
- WEBKIT_HIT_TEST_RESULT_CONTEXT_DOCUMENT,
- NULL, NULL);
+ context, WEBKIT_DOM_NODE(active), uri);
+
+ g_free(uri);
+
return TRUE;
}