Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:12.2:ARM
pinentry
pinentry-0.8.1-allow_paste_gtk2.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File pinentry-0.8.1-allow_paste_gtk2.patch of Package pinentry
Index: pinentry-0.8.1/gtk+-2/gtksecentry.c =================================================================== --- pinentry-0.8.1.orig/gtk+-2/gtksecentry.c 2010-04-19 13:25:38.000000000 +0200 +++ pinentry-0.8.1/gtk+-2/gtksecentry.c 2011-09-16 15:07:38.317559117 +0200 @@ -56,6 +56,7 @@ ACTIVATE, MOVE_CURSOR, INSERT_AT_CURSOR, + PASTE_CLIPBOARD, DELETE_FROM_CURSOR, LAST_SIGNAL }; @@ -166,6 +167,7 @@ gboolean extend_selection); static void gtk_secure_entry_insert_at_cursor(GtkSecureEntry * entry, const gchar * str); +static void gtk_secure_entry_paste_clipboard(GtkSecureEntry * entry); static void gtk_secure_entry_delete_from_cursor(GtkSecureEntry * entry, GtkDeleteType type, gint count); @@ -422,6 +424,7 @@ class->move_cursor = gtk_secure_entry_move_cursor; class->insert_at_cursor = gtk_secure_entry_insert_at_cursor; + class->paste_clipboard = gtk_secure_entry_paste_clipboard; class->delete_from_cursor = gtk_secure_entry_delete_from_cursor; class->activate = gtk_secure_entry_real_activate; @@ -530,6 +533,14 @@ _gtk_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING); + signals[PASTE_CLIPBOARD] = + g_signal_new("paste_clipboard", + G_OBJECT_CLASS_TYPE(gobject_class), + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET(GtkSecureEntryClass, paste_clipboard), + NULL, NULL, + _gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); + signals[DELETE_FROM_CURSOR] = g_signal_new("delete_from_cursor", G_OBJECT_CLASS_TYPE(gobject_class), @@ -650,6 +661,13 @@ GDK_CONTROL_MASK, "delete_from_cursor", 2, G_TYPE_ENUM, GTK_DELETE_WORD_ENDS, G_TYPE_INT, -1); + + /* activate clipboard */ + /* TODO: mouse middle button */ + gtk_binding_entry_add_signal (binding_set, GDK_v, GDK_CONTROL_MASK, + "paste_clipboard", 0); + gtk_binding_entry_add_signal (binding_set, GDK_Insert, GDK_SHIFT_MASK, + "paste_clipboard", 0); } static void @@ -1253,6 +1271,7 @@ gtk_secure_entry_key_press(GtkWidget * widget, GdkEventKey * event) { GtkSecureEntry *entry = GTK_SECURE_ENTRY(widget); + GtkEditable *editable = GTK_EDITABLE (widget); gtk_secure_entry_pend_cursor_blink(entry); @@ -1804,6 +1823,36 @@ } static void +paste_from_clipboard (GtkClipboard *clipboard, + const gchar *text, gpointer data) +{ + GtkSecureEntry *entry = GTK_SECURE_ENTRY(data); + GtkEditable *editable = GTK_EDITABLE(entry); + gint length; + + if (!text) return; + + length = strlen(text); + gint pos = entry->current_pos + length; + + gtk_secure_entry_insert_text(entry, text, length, &pos); + gtk_editable_set_position(editable, pos); +} + +/* TODO: gtk_secure_entry_copy_clipboard (editable); */ +/* TODO: gtk_secure_entry_cut_clipboard (editable); */ +static void +gtk_secure_entry_paste_clipboard(GtkSecureEntry * entry) +{ + GtkEditable *editable = GTK_EDITABLE(entry); + gtk_secure_entry_reset_im_context(entry); + + /* TODO: different clipboards */ + gtk_clipboard_request_text (gtk_widget_get_clipboard (GTK_WIDGET (entry), GDK_SELECTION_CLIPBOARD), + paste_from_clipboard, entry); +} + +static void gtk_secure_entry_delete_from_cursor(GtkSecureEntry * entry, GtkDeleteType type, gint count) { Index: pinentry-0.8.1/gtk+-2/gtksecentry.h =================================================================== --- pinentry-0.8.1.orig/gtk+-2/gtksecentry.h 2010-05-12 17:33:52.000000000 +0200 +++ pinentry-0.8.1/gtk+-2/gtksecentry.h 2011-09-15 09:50:39.717727093 +0200 @@ -121,6 +121,7 @@ GtkMovementStep step, gint count, gboolean extend_selection); void (*insert_at_cursor) (GtkSecureEntry * entry, const gchar * str); + void (*paste_clipboard) (GtkSecureEntry * entry); void (*delete_from_cursor) (GtkSecureEntry * entry, GtkDeleteType type, gint count);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor