[evolution/webkit] Bug 644066 - Text selection is cleared when right-clicking on a link
- From: Dan VrÃtil <dvratil src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/webkit] Bug 644066 - Text selection is cleared when right-clicking on a link
- Date: Mon, 11 Jul 2011 14:18:31 +0000 (UTC)
commit 367eef091505fca6c4fc7171014f6e1dda10801d
Author: Matthew Barnes <mbarnes redhat com>
Date: Mon Mar 7 10:41:43 2011 -0500
Bug 644066 - Text selection is cleared when right-clicking on a link
widgets/misc/e-web-view.c | 34 +++++++++++++++++++++++++++++++---
1 files changed, 31 insertions(+), 3 deletions(-)
---
diff --git a/widgets/misc/e-web-view.c b/widgets/misc/e-web-view.c
index 32389fa..220dda1 100644
--- a/widgets/misc/e-web-view.c
+++ b/widgets/misc/e-web-view.c
@@ -411,6 +411,37 @@ static GtkActionEntry standard_entries[] = {
G_CALLBACK (action_select_all_cb) }
};
+static gboolean
+web_view_button_press_event_cb (EWebView *web_view,
+ GdkEventButton *event,
+ GtkHTML *frame)
+{
+ gboolean event_handled = FALSE;
+ gchar *uri = NULL;
+
+ if (event != NULL && event->button != 3)
+ return FALSE;
+
+ /* Only extract a URI if no selection is active. Selected text
+ * implies the user is more likely to want to copy the selection
+ * to the clipboard than open a link within the selection. */
+ if (!e_web_view_is_selection_active (web_view))
+ uri = e_web_view_extract_uri (web_view, event, frame);
+
+ if (uri != NULL && g_str_has_prefix (uri, "##")) {
+ g_free (uri);
+ return FALSE;
+ }
+
+ g_signal_emit (
+ web_view, signals[POPUP_EVENT], 0,
+ event, uri, &event_handled);
+
+ g_free (uri);
+
+ return event_handled;
+}
+
static void
web_view_menu_item_select_cb (EWebView *web_view,
GtkWidget *widget)
@@ -967,9 +998,6 @@ web_view_popup_event (EWebView *web_view,
GdkEventButton *event,
const gchar *uri)
{
- if (uri != NULL)
- e_web_view_unselect_all (web_view);
-
e_web_view_set_selected_uri (web_view, uri);
e_web_view_show_popup_menu (web_view, event, NULL, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]