a3c8fb
From 7c6c930f7fa164700d089d646dc8300340ca4600 Mon Sep 17 00:00:00 2001
a3c8fb
From: =?UTF-8?q?Nelson=20Ben=C3=ADtez=20Le=C3=B3n?= <nbenitezl@gmail.com>
a3c8fb
Date: Mon, 6 Apr 2020 14:38:53 -0400
a3c8fb
Subject: [PATCH] EvFormField: allow text entries to handle clicks
a3c8fb
a3c8fb
so the user can interact with the text entry for
a3c8fb
eg. placing text cursor in an arbitrary position
a3c8fb
a3c8fb
Fixes #1364
a3c8fb
---
a3c8fb
 libview/ev-view.c | 14 ++++++++++++++
a3c8fb
 1 file changed, 14 insertions(+)
a3c8fb
a3c8fb
diff --git a/libview/ev-view.c b/libview/ev-view.c
a3c8fb
index f73f0ce9..1ebcb584 100644
a3c8fb
--- a/libview/ev-view.c
a3c8fb
+++ b/libview/ev-view.c
a3c8fb
@@ -2497,6 +2497,14 @@ ev_view_form_field_text_focus_out (GtkWidget     *widget,
a3c8fb
 	return FALSE;
a3c8fb
 }
a3c8fb
 
a3c8fb
+static gboolean
a3c8fb
+ev_view_form_field_text_button_pressed (GtkWidget      *widget,
a3c8fb
+					GdkEventButton *event,
a3c8fb
+					gpointer        data)
a3c8fb
+{
a3c8fb
+	return GDK_EVENT_STOP;
a3c8fb
+}
a3c8fb
+
a3c8fb
 static GtkWidget *
a3c8fb
 ev_view_form_field_text_create_widget (EvView      *view,
a3c8fb
 				       EvFormField *field)
a3c8fb
@@ -2536,6 +2544,9 @@ ev_view_form_field_text_create_widget (EvView      *view,
a3c8fb
 			g_signal_connect_after (text, "activate",
a3c8fb
 						G_CALLBACK (ev_view_form_field_destroy),
a3c8fb
 						view);
a3c8fb
+			g_signal_connect_after (text, "button-press-event",
a3c8fb
+						G_CALLBACK (ev_view_form_field_text_button_pressed),
a3c8fb
+						NULL);
a3c8fb
 			break;
a3c8fb
 	        case EV_FORM_FIELD_TEXT_MULTILINE: {
a3c8fb
 			GtkTextBuffer *buffer;
a3c8fb
@@ -2554,6 +2565,9 @@ ev_view_form_field_text_create_widget (EvView      *view,
a3c8fb
 			g_signal_connect (buffer, "changed",
a3c8fb
 					  G_CALLBACK (ev_view_form_field_text_changed),
a3c8fb
 					  field);
a3c8fb
+			g_signal_connect_after (text, "button-press-event",
a3c8fb
+						G_CALLBACK (ev_view_form_field_text_button_pressed),
a3c8fb
+						NULL);
a3c8fb
 		}
a3c8fb
 			break;
a3c8fb
 	}			
a3c8fb
-- 
a3c8fb
2.31.1
a3c8fb