/pidgin/main: 84e141f1bfed: Add some context when using the keyb...

Elliott Sales de Andrade qulogic at pidgin.im
Tue Aug 14 04:03:26 EDT 2012


Changeset: 84e141f1bfed56175784152dcf1f090267df6171
Author:	 Elliott Sales de Andrade <qulogic at pidgin.im>
Date:	 2012-08-12 04:01 -0400
Branch:	 default
URL: http://hg.pidgin.im/pidgin/main/rev/84e141f1bfed

Description:

Add some context when using the keyboard to open a popup.

diffstat:

 pidgin/gtkwebview.c |  26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)

diffs (37 lines):

diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c
--- a/pidgin/gtkwebview.c
+++ b/pidgin/gtkwebview.c
@@ -419,9 +419,31 @@ do_popup_menu(WebKitWebView *webview, in
 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;
 }
 



More information about the Commits mailing list