[gnome-shell] st-entry: Implement middle click paste
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] st-entry: Implement middle click paste
- Date: Thu, 7 Feb 2013 09:51:56 +0000 (UTC)
commit eaf184b5852825d49c85c683bd7bde96df02baf2
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Wed Nov 9 11:40:13 2011 -0500
st-entry: Implement middle click paste
https://bugzilla.gnome.org/show_bug.cgi?id=645019
src/st/st-entry.c | 35 +++++++++++++++++++++++++++++++++++
1 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/src/st/st-entry.c b/src/st/st-entry.c
index 000c8ac..4d0e024 100644
--- a/src/st/st-entry.c
+++ b/src/st/st-entry.c
@@ -542,6 +542,38 @@ st_entry_clipboard_callback (StClipboard *clipboard,
}
static gboolean
+clutter_text_button_press_event (ClutterActor *actor,
+ ClutterButtonEvent *event,
+ gpointer user_data)
+{
+ GtkSettings *settings = gtk_settings_get_default ();
+ gboolean primary_paste_enabled;
+
+ g_object_get (settings,
+ "gtk-enable-primary-paste", &primary_paste_enabled,
+ NULL);
+
+ if (primary_paste_enabled && event->button == 2)
+ {
+ StClipboard *clipboard;
+
+ clipboard = st_clipboard_get_default ();
+
+ /* By the time the clipboard callback is called,
+ * the rest of the signal handlers will have
+ * run, making the text cursor to be in the correct
+ * place.
+ */
+ st_clipboard_get_text (clipboard,
+ ST_CLIPBOARD_TYPE_PRIMARY,
+ st_entry_clipboard_callback,
+ user_data);
+ }
+
+ return FALSE;
+}
+
+static gboolean
st_entry_key_press_event (ClutterActor *actor,
ClutterKeyEvent *event)
{
@@ -755,6 +787,9 @@ st_entry_init (StEntry *entry)
g_signal_connect (priv->entry, "notify::password-char",
G_CALLBACK (clutter_text_password_char_cb), entry);
+ g_signal_connect (priv->entry, "button-press-event",
+ G_CALLBACK (clutter_text_button_press_event), entry);
+
priv->spacing = 6.0f;
clutter_actor_add_child (CLUTTER_ACTOR (entry), priv->entry);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]