[git] Pinentry - branch, master, updated. pinentry-0.8.4-10-g0fbc949

by Werner Koch cvs at cvs.gnupg.org
Sun Oct 26 12:26:10 CET 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The standard pinentry collection".

The branch, master has been updated
       via  0fbc949f998fa84380b66bc0f589c7fca6232d3c (commit)
       via  8943bc86d6cf8295d0ec4382480d886b1f2ec062 (commit)
       via  821dc21a241a27cc381c7d65be690e3858e2ddc6 (commit)
       via  f2ed42297528f2a126d189c6181d3105ceecca22 (commit)
       via  3803fd15942f2f25108e400be6cd6faef791c8f7 (commit)
       via  4f4af9056d1c100aa53363f019253160cd8d9ff0 (commit)
      from  2ef788fb5dce2e49fa925264802388f4c002cd31 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 0fbc949f998fa84380b66bc0f589c7fca6232d3c
Author: Werner Koch <wk at gnupg.org>
Date:   Sun Oct 26 12:26:17 2014 +0100

    Post release updates.
    
    --

diff --git a/NEWS b/NEWS
index 2a2c2c8..a69faec 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+Noteworthy changes in version 0.9.1 (unreleased)
+------------------------------------------------
+
+
 Noteworthy changes in version 0.9.0 (2014-10-26)
 ------------------------------------------------
 
diff --git a/configure.ac b/configure.ac
index 3edcc7e..c2644c9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,7 +26,7 @@ min_automake_version="1.10"
 # (git tag -s pinentry-n.m.k) and run "./autogen.sh --force".  Please
 # bump the version number immediately after the release, do another
 # commit, and a push so that the git magic is able to work.
-m4_define(mym4_version, [0.9.0])
+m4_define(mym4_version, [0.9.1])
 
 # Below is m4 magic to extract and compute the git revision number,
 # the decimalized short revision number, a beta version string and a

commit 8943bc86d6cf8295d0ec4382480d886b1f2ec062
Author: Werner Koch <wk at gnupg.org>
Date:   Sun Oct 26 12:19:05 2014 +0100

    Release 0.9.0

diff --git a/NEWS b/NEWS
index 393af88..2a2c2c8 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-Noteworthy changes in version 0.9.0 (unreleased)
+Noteworthy changes in version 0.9.0 (2014-10-26)
 ------------------------------------------------
 
  * New command SETREPEAT.  Currently only supported for Gtk+-2.
diff --git a/configure.ac b/configure.ac
index b930b84..3edcc7e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,7 +26,7 @@ min_automake_version="1.10"
 # (git tag -s pinentry-n.m.k) and run "./autogen.sh --force".  Please
 # bump the version number immediately after the release, do another
 # commit, and a push so that the git magic is able to work.
-m4_define(mym4_version, [0.8.5])
+m4_define(mym4_version, [0.9.0])
 
 # Below is m4 magic to extract and compute the git revision number,
 # the decimalized short revision number, a beta version string and a

commit 821dc21a241a27cc381c7d65be690e3858e2ddc6
Author: Werner Koch <wk at gnupg.org>
Date:   Sun Oct 26 12:18:45 2014 +0100

    gtk: Aboid segv for opaste keys.
    
    * gtk+-2/gtksecentry.c (gtk_secure_entry_class_init): Disable paste
    key bindings.

diff --git a/gtk+-2/gtksecentry.c b/gtk+-2/gtksecentry.c
index 0f10a12..824d45a 100644
--- a/gtk+-2/gtksecentry.c
+++ b/gtk+-2/gtksecentry.c
@@ -676,10 +676,12 @@ gtk_secure_entry_class_init(GtkSecureEntryClass * class)
 				 G_TYPE_INT, -1);
 
     /* Clipboard - only pasting of course.  */
-    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);
+    /* Ist does not work right now.  Depending on the GTK version we
+       see segv due to "property added after class was intialized".  */
+    /* 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); */
 
 }
 

commit f2ed42297528f2a126d189c6181d3105ceecca22
Author: Werner Koch <wk at gnupg.org>
Date:   Fri Oct 24 16:20:20 2014 +0200

    Remove support form QT3 and GTK+-1.
    
    * configure.ac: Remove old qt and gtk+-1 support.
    * Makefile.am: Ditto.

diff --git a/Makefile.am b/Makefile.am
index abc7b73..61c98e1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -41,24 +41,12 @@ else
 pinentry_tty =
 endif
 
-if BUILD_PINENTRY_GTK
-pinentry_gtk = gtk
-else
-pinentry_gtk =
-endif
-
 if BUILD_PINENTRY_GTK_2
 pinentry_gtk_2 = gtk+-2
 else
 pinentry_gtk_2 =
 endif
 
-if BUILD_PINENTRY_QT
-pinentry_qt = qt
-else
-pinentry_qt =
-endif
-
 if BUILD_PINENTRY_QT4
 pinentry_qt4 = qt4
 else
@@ -72,8 +60,7 @@ pinentry_w32 =
 endif
 
 SUBDIRS = assuan secmem pinentry ${pinentry_curses} ${pinentry_tty} \
-	${pinentry_gtk} ${pinentry_gtk_2} ${pinentry_qt} ${pinentry_qt4} \
-	${pinentry_w32} doc
+	  ${pinentry_gtk_2} ${pinentry_qt4} ${pinentry_w32} doc
 
 
 install-exec-local:
diff --git a/NEWS b/NEWS
index 6a63d58..393af88 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,14 @@
-Noteworthy changes in version 0.8.5 (unreleased)
+Noteworthy changes in version 0.9.0 (unreleased)
 ------------------------------------------------
 
+ * New command SETREPEAT.  Currently only supported for Gtk+-2.
+
+ * Gtk+-2: Pasting using the mouse is now supported.
+
+ * curses: Check that it is actually connected to a tty.
+
+ * Removed the old qt-3 and gtk+-1 pinentries.
+
 
 Noteworthy changes in version 0.8.4 (2014-09-18)
 ------------------------------------------------
diff --git a/README b/README
index 6bb0d85..47d0a04 100644
--- a/README
+++ b/README
@@ -11,11 +11,8 @@ be requested explicitely.
 
 GUI		OPTION			 DEPENDENCIES
 Curses		--enable-pinentry-curses Curses library, for example ncurses
-GTK+ V1.2	--enable-pinentry-gtk	 Gimp Toolkit Library Version 1.2
-			 		 eg. libgtk-1.2 and libglib-1.2
 GTK+ V2.0	--enable-pinentry-gtk2	 Gimp Toolkit Library, Version 2.0
 					 eg. libgtk-x11-2.0 and libglib-2.0
-Qt		--enable-pinentry-qt	 Qt, eg. libqt or libqt-mt
 Qt4		--enable-pinentry-qt4	 Qt4
 TTY		--enable-pinentry-tty	 Simple TTY version, no dependencies
 
@@ -27,13 +24,13 @@ specified.  So to disable linking to curses completely you have to
 pass --disable-fallback-curses to the configure script as well.
 
 Examples:
-* To only build the GTK+ 1.2 pinentry with curses support:
-./configure --enable-pinentry-gtk --enable-fallback-curses \
-	--disable-pinentry-curses --disable-pinentry-qt
+* To only build the GTK+ pinentry with curses support:
+./configure --enable-pinentry-gtk2 --enable-fallback-curses \
+	--disable-pinentry-curses --disable-pinentry-qt4
 
 * To build the Qt pinentry, and the other pinentries if they are
   supported:
-./configure --enable-pinentry-qt
+./configure --enable-pinentry-qt4
 
 * To build everything that is supported (complete auto-detection):
 ./configure
diff --git a/configure.ac b/configure.ac
index 0b00217..b930b84 100644
--- a/configure.ac
+++ b/configure.ac
@@ -251,55 +251,10 @@ fi
 
 
 dnl
-dnl Check for GTK+ pinentry program.
+dnl Additional checks pinentry Curses.
 dnl
-AC_ARG_ENABLE(pinentry-gtk,
-            AC_HELP_STRING([--enable-pinentry-gtk], [build GTK+ pinentry]),
-            pinentry_gtk=$enableval, pinentry_gtk=maybe)
-
-dnl
-dnl Checks for GTK+ libraries.  Deal correctly with $pinentry_gtk = maybe.
-dnl
-if test "$pinentry_gtk" != "no"; then
-AM_PATH_GLIB(1.2.0,,
-if test "$pinentry_gtk" = "yes"; then
-    AC_MSG_ERROR([[
-***
-*** GLIB 1.2.0 or newer is required. The latest version of GLIB
-*** is always available from ftp://ftp.gtk.org/.
-***]])
-else
-    pinentry_gtk=no
-fi)
-fi
-
-if test "$pinentry_gtk" != "no"; then
-AM_PATH_GTK(1.2.0,
-    AC_DEFINE(HAVE_GTK, 1, [Defined if GTK is available]),
-if test "$pinentry_gtk" = "yes"; then
-    AC_MSG_ERROR([[
-***
-*** GTK+ 1.2.0 or newer is required. The latest version of GTK+
-*** is always available form ftp://ftp.gtk.org/.
-***]])
-else
-    pinentry_gtk=no
-fi)
-fi
-
-dnl If we have come so far, GTK+ pinentry can be build.
-if test "$pinentry_gtk" != "no"; then
-    pinentry_gtk=yes
-fi
-AM_CONDITIONAL(BUILD_PINENTRY_GTK, test "$pinentry_gtk" = "yes")
-if test "$pinentry_gtk" = "yes"; then
-  AC_DEFINE(PINENTRY_GTK, 1, [The GTK+ version of Pinentry is to be build])
-fi
-
 if test "$pinentry_curses" = "yes" \
-        -o "$fallback_curses" = "yes" \
-        -o "$pinentry_gtk" = "yes"; then
-  dnl Additional checks pinentry Curses/GTK+.
+        -o "$fallback_curses" = "yes" ; then
   AM_ICONV
   if test "$am_cv_func_iconv" != "yes"; then
     AC_MSG_ERROR([[
@@ -310,10 +265,6 @@ if test "$pinentry_curses" = "yes" \
   fi
 fi
 
-dnl if test "$pinentry_gtk" = "yes"; then
-dnl Additional checks for GTK+ pinentry.
-dnl End of additional checks for GTK+ pinentry.
-dnl fi
 
 
 dnl
@@ -361,64 +312,6 @@ AM_CONDITIONAL(BUILD_PINENTRY_GTK_2, test "$pinentry_gtk_2" = "yes")
 
 
 dnl
-dnl Check for Qt pinentry program.
-dnl
-AC_ARG_ENABLE(pinentry-qt,
-            AC_HELP_STRING([--enable-pinentry-qt], [build Qt pinentry]),
-            pinentry_qt=$enableval, pinentry_qt=maybe)
-dnl
-dnl Checks for Qt libraries.  Deal correctly with $pinentry_qt = maybe.
-dnl
-if test "$pinentry_qt" != "no"; then
-QT_CHECK_COMPILERS
-QT_PATH
-if test $have_qt = "no"; then
-	if test $pinentry_qt = "yes"; then
-	  AC_MSG_ERROR([[
-***
-*** Qt ($qt_minversion) $ac_qt_notfound not found. Please check your
-*** installation!  For more details about this problem, look at the
-*** end of config.log.$missing_qt_mt
-***]])
-	else
-	  pinentry_qt="no"
-	fi
-fi
-if test $have_moc = "no"; then
-	if test $pinentry_qt = "yes"; then
-        AC_MSG_ERROR([[
-***
-*** No Qt meta object compiler (moc) found!
-*** Please check whether you installed Qt correctly.
-*** You need to have a running moc binary.
-*** configure tried to run $ac_cv_path_moc and the test didn't
-*** succeed. If configure shouldn't have tried this one, set
-*** the environment variable MOC to the right one before running
-*** configure.
-***]])
-	else
-	  pinentry_qt="no"
-	fi
-fi
-fi
-
-dnl If we have come so far, Qt pinentry can probably be build.
-if test "$pinentry_qt" != "no"; then
-    pinentry_qt=yes
-fi
-AM_CONDITIONAL(BUILD_PINENTRY_QT, test "$pinentry_qt" = "yes")
-
-if test "$pinentry_qt" = "yes"; then
-  AC_DEFINE(PINENTRY_QT, 1, [The Qt version of Pinentry is to be build])
-fi
-
-dnl if test "$pinentry_qt" = "yes"; then
-dnl dnl Additional checks for Qt pinentry.
-dnl dnl End of checks for Qt pinentry.
-dnl fi
-
-
-dnl
 dnl Check for Qt4 pinentry program.
 dnl
 AC_ARG_ENABLE(pinentry-qt4,
@@ -495,29 +388,21 @@ AM_CONDITIONAL(BUILD_PINENTRY_W32, test "$pinentry_w32" = "yes")
 # pinentry really is better (more feature-complete and more secure).
 
 if test "$pinentry_gtk_2" = "yes"; then
-   PINENTRY_DEFAULT=pinentry-gtk-2
+  PINENTRY_DEFAULT=pinentry-gtk-2
 else
-  if test "$pinentry_gtk" = "yes"; then
-    PINENTRY_DEFAULT=pinentry-gtk
+  if test "$pinentry_qt4" = "yes"; then
+    PINENTRY_DEFAULT=pinentry-qt4
   else
-    if test "$pinentry_qt" = "yes"; then
-      PINENTRY_DEFAULT=pinentry-qt
+    if test "$pinentry_curses" = "yes"; then
+      PINENTRY_DEFAULT=pinentry-curses
     else
-      if test "$pinentry_qt4" = "yes"; then
-        PINENTRY_DEFAULT=pinentry-qt4
+      if test "$pinentry_tty" = "yes"; then
+        PINENTRY_DEFAULT=pinentry-tty
       else
-        if test "$pinentry_curses" = "yes"; then
-          PINENTRY_DEFAULT=pinentry-curses
+        if test "$pinentry_w32" = "yes"; then
+          PINENTRY_DEFAULT=pinentry-w32
         else
-          if test "$pinentry_tty" = "yes"; then
-            PINENTRY_DEFAULT=pinentry-tty
-          else
-            if test "$pinentry_w32" = "yes"; then
-              PINENTRY_DEFAULT=pinentry-w32
-            else
-              AC_MSG_ERROR([[No pinentry enabled.]])
-            fi
-          fi
+          AC_MSG_ERROR([[No pinentry enabled.]])
         fi
       fi
     fi
@@ -532,9 +417,7 @@ secmem/Makefile
 pinentry/Makefile
 curses/Makefile
 tty/Makefile
-gtk/Makefile
 gtk+-2/Makefile
-qt/Makefile
 qt4/Makefile
 w32/Makefile
 doc/Makefile
@@ -552,9 +435,7 @@ AC_MSG_NOTICE([
 
 	Curses Pinentry ..: $pinentry_curses
 	TTY Pinentry .....: $pinentry_tty
-	GTK+ Pinentry ....: $pinentry_gtk
 	GTK+-2 Pinentry ..: $pinentry_gtk_2
-	Qt Pinentry ......: $pinentry_qt
 	Qt4 Pinentry .....: $pinentry_qt4 $pinentry_qt4_clip_msg
 	W32 Pinentry .....: $pinentry_w32
 

commit 3803fd15942f2f25108e400be6cd6faef791c8f7
Author: Stanislav Ochotnicky <sochotnicky at redhat.com>
Date:   Fri Feb 14 12:58:38 2014 +0100

    Check if we are on tty before initializing curses.
    
    * pinentry/pinentry-curses.c (dialog_run): Check stant stdin and stout
    are connected to ttys.
    
    --
    
    When we did not have a ttyname we just used stdin/out without checking
    if it's a proper TTY or a pipe. In some cases this can cause endless
    loop or escape seqeunces on the terminal.
    
    This commit changes behaviour so that if stdin/out is not tty and no
    ttyname is specified we error-out with errno set to ENOTTY

diff --git a/pinentry/pinentry-curses.c b/pinentry/pinentry-curses.c
index 58da255..4fc8bc4 100644
--- a/pinentry/pinentry-curses.c
+++ b/pinentry/pinentry-curses.c
@@ -752,6 +752,11 @@ dialog_run (pinentry_t pinentry, const char *tty_name, const char *tty_type)
     {
       if (!init_screen)
 	{
+          if (!(isatty(fileno(stdin)) && isatty(fileno(stdout))))
+            {
+              errno = ENOTTY;
+              return -1;
+            }
 	  init_screen = 1;
 	  initscr ();
 	}

commit 4f4af9056d1c100aa53363f019253160cd8d9ff0
Author: Werner Koch <wk at gnupg.org>
Date:   Fri Oct 24 16:20:20 2014 +0200

    gtk: Allow pasting using the mouse.
    
    * gtk+-2/gtksecentry.h (_GtkSecureEntry): Add fields insert_pos,
    real_changed, cand change_count.
    (_GtkSecureEntryClass): Add field paste_clipboard.
    * gtk+-2/gtksecentry.c (PASTE_CLIPBOARD): New.
    (gtk_secure_entry_class_init): Set paste_clipboard and create
    paste-clipboard signal.
    (gtk_secure_entry_button_press): Call gtk_secure_entry_pase.
    (begin_change, end_change, emit_changed): New.
    (gtk_secure_entry_real_insert_text): Use emit_changed.
    (gtk_secure_entry_real_delete_text): Ditto.
    (paste_received, gtk_secure_entry_paste)
    (gtk_secure_entry_paste_clipboard): New.
    --
    
    The new code as been taken from gtk 2.20.1.
    
    I have not figured out why the keybindings for C-v and s-Insert do not
    work.

diff --git a/gtk+-2/gtksecentry.c b/gtk+-2/gtksecentry.c
index cfe6aea..0f10a12 100644
--- a/gtk+-2/gtksecentry.c
+++ b/gtk+-2/gtksecentry.c
@@ -31,7 +31,7 @@
  *
  * The entry is now always invisible, uses secure memory methods to
  * allocate the text memory, and all potentially dangerous methods
- * (copy & paste, popup, etc.) have been removed.
+ * (copy, popup, etc.) have been removed.
  */
 
 #include <stdlib.h>
@@ -57,6 +57,7 @@ enum {
     MOVE_CURSOR,
     INSERT_AT_CURSOR,
     DELETE_FROM_CURSOR,
+    PASTE_CLIPBOARD,
     LAST_SIGNAL
 };
 
@@ -175,6 +176,7 @@ static void gtk_secure_entry_real_activate(GtkSecureEntry * entry);
 static void gtk_secure_entry_keymap_direction_changed(GdkKeymap * keymap,
 						      GtkSecureEntry *
 						      entry);
+
 /* IM Context Callbacks
  */
 static void gtk_secure_entry_commit_cb(GtkIMContext * context,
@@ -195,6 +197,13 @@ static gboolean gtk_secure_entry_delete_surrounding_cb(GtkIMContext *
 
 /* Internal routines
  */
+
+static void begin_change (GtkSecureEntry *entry);
+static void end_change (GtkSecureEntry *entry);
+static void emit_changed (GtkSecureEntry *entry);
+static void gtk_secure_entry_paste (GtkSecureEntry *entry, GdkAtom selection);
+static void gtk_secure_entry_paste_clipboard (GtkSecureEntry *entry);
+
 static void gtk_secure_entry_enter_text(GtkSecureEntry * entry,
 					const gchar * str);
 static void gtk_secure_entry_set_positions(GtkSecureEntry * entry,
@@ -424,6 +433,7 @@ gtk_secure_entry_class_init(GtkSecureEntryClass * class)
     class->move_cursor = gtk_secure_entry_move_cursor;
     class->insert_at_cursor = gtk_secure_entry_insert_at_cursor;
     class->delete_from_cursor = gtk_secure_entry_delete_from_cursor;
+    class->paste_clipboard = gtk_secure_entry_paste_clipboard;
     class->activate = gtk_secure_entry_real_activate;
 
     g_object_class_override_property (gobject_class,
@@ -544,6 +554,15 @@ gtk_secure_entry_class_init(GtkSecureEntryClass * class)
 		     _gtk_marshal_VOID__ENUM_INT, G_TYPE_NONE, 2,
 		     GTK_TYPE_DELETE_TYPE, G_TYPE_INT);
 
+    signals[PASTE_CLIPBOARD] =
+      g_signal_new ("paste-clipboard",
+                    G_OBJECT_CLASS_TYPE (gobject_class),
+                    G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+                    G_STRUCT_OFFSET (GtkEntryClass, paste_clipboard),
+                    NULL, NULL,
+                    _gtk_marshal_VOID__VOID,
+                    G_TYPE_NONE, 0);
+
     /*
      * Key bindings
      */
@@ -655,6 +674,13 @@ gtk_secure_entry_class_init(GtkSecureEntryClass * class)
 				 GDK_CONTROL_MASK, "delete_from_cursor", 2,
 				 G_TYPE_ENUM, GTK_DELETE_WORD_ENDS,
 				 G_TYPE_INT, -1);
+
+    /* Clipboard - only pasting of course.  */
+    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
@@ -833,13 +859,11 @@ static void
 gtk_secure_entry_realize(GtkWidget * widget)
 {
     GtkSecureEntry *entry;
-    GtkEditable *editable;
     GdkWindowAttr attributes;
     gint attributes_mask;
 
     GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
     entry = GTK_SECURE_ENTRY(widget);
-    editable = GTK_EDITABLE(widget);
 
     attributes.window_type = GDK_WINDOW_CHILD;
 
@@ -1167,6 +1191,18 @@ gtk_secure_entry_button_press(GtkWidget * widget, GdkEventButton * event)
 
 	return TRUE;
     }
+    else if (event->button == 2) {
+        switch (event->type) {
+        case GDK_BUTTON_PRESS:
+            entry->insert_pos = tmp_pos;
+            gtk_secure_entry_paste (entry, GDK_SELECTION_PRIMARY);
+            return TRUE;
+
+        default:
+            break;
+        }
+
+    }
 
     return FALSE;
 }
@@ -1647,7 +1683,7 @@ gtk_secure_entry_real_insert_text(GtkEditable * editable,
 
     gtk_secure_entry_recompute(entry);
 
-    g_signal_emit_by_name(editable, "changed");
+    emit_changed (entry);
     g_object_notify(G_OBJECT(editable), "text");
 }
 
@@ -1688,7 +1724,7 @@ gtk_secure_entry_real_delete_text(GtkEditable * editable,
 
 	gtk_secure_entry_recompute(entry);
 
-	g_signal_emit_by_name(editable, "changed");
+	emit_changed (entry);
 	g_object_notify(G_OBJECT(editable), "text");
     }
 }
@@ -1860,6 +1896,100 @@ gtk_secure_entry_delete_from_cursor(GtkSecureEntry * entry,
     gtk_secure_entry_pend_cursor_blink(entry);
 }
 
+static void
+begin_change (GtkSecureEntry *entry)
+{
+  entry->change_count++;
+}
+
+static void
+end_change (GtkSecureEntry *entry)
+{
+  GtkEditable *editable = GTK_EDITABLE (entry);
+
+  g_return_if_fail (entry->change_count > 0);
+
+  entry->change_count--;
+
+  if (entry->change_count == 0)
+    {
+       if (entry->real_changed)
+         {
+           g_signal_emit_by_name (editable, "changed");
+           entry->real_changed = FALSE;
+         }
+    }
+}
+
+static void
+emit_changed (GtkSecureEntry *entry)
+{
+  GtkEditable *editable = GTK_EDITABLE (entry);
+
+  if (entry->change_count == 0)
+    g_signal_emit_by_name (editable, "changed");
+  else
+    entry->real_changed = TRUE;
+}
+
+
+static void
+paste_received (GtkClipboard *clipboard,
+		const gchar  *text,
+		gpointer      data)
+{
+  GtkSecureEntry *entry = GTK_SECURE_ENTRY (data);
+  GtkEditable *editable = GTK_EDITABLE (entry);
+
+  if (entry->button == 2)
+    {
+      gint pos, start, end;
+
+      pos = entry->insert_pos;
+      gtk_editable_get_selection_bounds (editable, &start, &end);
+      if (!((start <= pos && pos <= end) || (end <= pos && pos <= start)))
+	gtk_editable_select_region (editable, pos, pos);
+    }
+
+  if (text)
+    {
+      gint pos, start, end;
+      gint length = -1;
+
+      begin_change (entry);
+      g_object_freeze_notify (G_OBJECT (entry));
+      if (gtk_editable_get_selection_bounds (editable, &start, &end))
+        gtk_editable_delete_text (editable, start, end);
+
+      pos = entry->current_pos;
+      gtk_editable_insert_text (editable, text, length, &pos);
+      gtk_editable_set_position (editable, pos);
+      g_object_thaw_notify (G_OBJECT (entry));
+      end_change (entry);
+    }
+
+  g_object_unref (entry);
+}
+
+
+static void
+gtk_secure_entry_paste (GtkSecureEntry *entry, GdkAtom selection)
+{
+  g_object_ref (entry);
+  gtk_clipboard_request_text (gtk_widget_get_clipboard (GTK_WIDGET (entry),
+                                                        selection),
+			      paste_received, entry);
+}
+
+
+static void
+gtk_secure_entry_paste_clipboard (GtkSecureEntry *entry)
+{
+  gtk_secure_entry_paste (entry, GDK_SELECTION_CLIPBOARD);
+}
+
+
+
 /* static void */
 /* gtk_secure_entry_delete_cb(GtkSecureEntry * entry) */
 /* { */
diff --git a/gtk+-2/gtksecentry.h b/gtk+-2/gtksecentry.h
index c0f2e5a..30cec89 100644
--- a/gtk+-2/gtksecentry.h
+++ b/gtk+-2/gtksecentry.h
@@ -72,6 +72,7 @@ struct _GtkSecureEntry {
     GtkIMContext *im_context;
 
     gint current_pos;
+    gint insert_pos;   /* Used to temporary save a position.  */
     gint selection_bound;
 
     PangoLayout *cached_layout;
@@ -94,6 +95,9 @@ struct _GtkSecureEntry {
 
     guint resolved_dir : 4; /* PangoDirection */
 
+    guint real_changed : 1;
+    guint change_count : 8;
+
     guint button;
     guint blink_timeout;
     guint recompute_idle;
@@ -124,9 +128,9 @@ struct _GtkSecureEntryClass {
     void (*insert_at_cursor) (GtkSecureEntry * entry, const gchar * str);
     void (*delete_from_cursor) (GtkSecureEntry * entry,
 				GtkDeleteType type, gint count);
+    void (*paste_clipboard) (GtkSecureEntry *entry);
 
     /* Padding for future expansion */
-    void (*_gtk_reserved1) (void);
     void (*_gtk_reserved2) (void);
     void (*_gtk_reserved3) (void);
     void (*_gtk_reserved4) (void);
diff --git a/gtk+-2/pinentry-gtk-2.c b/gtk+-2/pinentry-gtk-2.c
index 8322530..1a8c083 100644
--- a/gtk+-2/pinentry-gtk-2.c
+++ b/gtk+-2/pinentry-gtk-2.c
@@ -230,7 +230,7 @@ enter_callback (GtkWidget *widget, GtkWidget *anentry)
 static void
 confirm_button_clicked (GtkWidget *widget, gpointer data)
 {
-  confirm_value = (int) data;
+  confirm_value = (int)(long) data;
   gtk_main_quit ();
 }
 

-----------------------------------------------------------------------

Summary of changes:
 Makefile.am                |   15 +----
 NEWS                       |   14 ++++-
 README                     |   11 ++--
 configure.ac               |  145 ++++----------------------------------------
 gtk+-2/gtksecentry.c       |  142 +++++++++++++++++++++++++++++++++++++++++--
 gtk+-2/gtksecentry.h       |    6 +-
 gtk+-2/pinentry-gtk-2.c    |    2 +-
 pinentry/pinentry-curses.c |    5 ++
 8 files changed, 179 insertions(+), 161 deletions(-)


hooks/post-receive
-- 
The standard pinentry collection
http://git.gnupg.org




More information about the Gnupg-commits mailing list