[git] Pinentry - branch, master, updated. pinentry-0.9.1-14-gcbecc6d

by Werner Koch cvs at cvs.gnupg.org
Tue May 5 22:04:02 CEST 2015


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  cbecc6d38a86f8fa7c052efab7649be07b5df334 (commit)
      from  da9ec71960fe1257e67f6c282fef432352491945 (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 cbecc6d38a86f8fa7c052efab7649be07b5df334
Author: Werner Koch <wk at gnupg.org>
Date:   Tue May 5 22:02:58 2015 +0200

    w32: Minor changes to the dialog.
    
    * w32/main.c (set_bitmap): New.
    (dlg_proc): Show error prompt in red.
    * w32/pinentry-w32.rc: Add icons and chnage dialog.
    * w32/logo-128.bmp: New.
    * w32/logo-32.bmp: New.
    * w32/logo-48.bmp: New.
    * w32/logo-64.bmp: New.
    * w32/logo-96.bmp: New.
    
    --
    
    The logos need some manual tweaking.  Due to the scaling a gradient is
    used for the circle and Windows shows white ugly white spots.  This
    can be avoided by using a a palette with less colors but I found no
    easy way to do that in gimp.  When using less than 256 index the
    transparency feature does not work correctly.

diff --git a/w32/Makefile.am b/w32/Makefile.am
index f15e66c..677dd6a 100644
--- a/w32/Makefile.am
+++ b/w32/Makefile.am
@@ -19,6 +19,10 @@
 
 ## Process this file with automake to produce Makefile.in
 
+logos = logo-32.bmp logo-48.bmp logo-64.bmp logo-96.bmp logo-128.bmp
+
+EXTRA_DIST = $(logos)
+
 bin_PROGRAMS = pinentry-w32
 
 AM_CPPFLAGS = -I$(top_srcdir)/assuan -I$(top_srcdir)/secmem \
@@ -33,6 +37,6 @@ pinentry_w32_LDADD = pinentry-w32.o \
 	../pinentry/libpinentry.a ../assuan/libassuan.a ../secmem/libsecmem.a
 
 
-pinentry-w32.o: pinentry-w32.rc resource.h
+pinentry-w32.o: pinentry-w32.rc resource.h $(logos)
 	$(WINDRES) -I.. -v -o $@ $<
 
diff --git a/w32/logo-128.bmp b/w32/logo-128.bmp
new file mode 100644
index 0000000..883475b
Binary files /dev/null and b/w32/logo-128.bmp differ
diff --git a/w32/logo-32.bmp b/w32/logo-32.bmp
new file mode 100644
index 0000000..38d6018
Binary files /dev/null and b/w32/logo-32.bmp differ
diff --git a/w32/logo-48.bmp b/w32/logo-48.bmp
new file mode 100644
index 0000000..53c6274
Binary files /dev/null and b/w32/logo-48.bmp differ
diff --git a/w32/logo-64.bmp b/w32/logo-64.bmp
new file mode 100644
index 0000000..7d4ca29
Binary files /dev/null and b/w32/logo-64.bmp differ
diff --git a/w32/logo-96.bmp b/w32/logo-96.bmp
new file mode 100644
index 0000000..f0496c8
Binary files /dev/null and b/w32/logo-96.bmp differ
diff --git a/w32/main.c b/w32/main.c
index fee37c1..8c19cb2 100644
--- a/w32/main.c
+++ b/w32/main.c
@@ -19,7 +19,9 @@
 #include <config.h>
 #include <stdio.h>
 #include <stdlib.h>
-#define WINVER 0x0403  /* Required for SendInput.  */
+#if WINVER < 0x0403
+# define WINVER 0x0403  /* Required for SendInput.  */
+#endif
 #include <windows.h>
 #ifdef HAVE_W32CE_SYSTEM
 # include <winioctl.h>
@@ -370,12 +372,59 @@ set_dlg_item_text (HWND dlg, int item, const char *string)
 }
 
 
+/* Load our butmapped icon from the resource and display it.  */
+static void
+set_bitmap (HWND dlg, int item)
+{
+  HWND hwnd;
+  HBITMAP bitmap;
+  RECT rect;
+  int resid;
+
+  hwnd = GetDlgItem (dlg, item);
+  if (!hwnd)
+    return;
+
+  rect.left = 0;
+  rect.top = 0;
+  rect.right = 32;
+  rect.bottom = 32;
+  if (!MapDialogRect (dlg, &rect))
+    {
+      fprintf (stderr, "MapDialogRect failed: %s\n",  w32_strerror (-1));
+      return;
+    }
+  /* fprintf (stderr, "MapDialogRect: %d/%d\n", rect.right, rect.bottom); */
+
+  switch (rect.right)
+    {
+    case 32: resid = IDB_ICON_32; break;
+    case 48: resid = IDB_ICON_48; break;
+    case 64: resid = IDB_ICON_64; break;
+    case 96: resid = IDB_ICON_96; break;
+    default: resid = IDB_ICON_128;break;
+    }
+
+  bitmap = LoadImage (GetModuleHandle (NULL),
+                      MAKEINTRESOURCE (resid),
+                      IMAGE_BITMAP,
+                      rect.right, rect.bottom,
+                      (LR_SHARED | LR_LOADTRANSPARENT | LR_LOADMAP3DCOLORS));
+  if (!bitmap)
+    {
+      fprintf (stderr, "LoadImage failed: %s\n",  w32_strerror (-1));
+      return;
+    }
+  SendMessage(hwnd, STM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)bitmap);
+}
+
+
 /* Dialog processing loop.  */
 static BOOL CALLBACK
 dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
 {
   static pinentry_t pe;
-  static int item;
+  /* static int item; */
 
 
 /*   { */
@@ -400,6 +449,7 @@ dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
       set_dlg_item_text (dlg, IDC_PINENT_PROMPT, pe->prompt);
       set_dlg_item_text (dlg, IDC_PINENT_DESC, pe->description);
       set_dlg_item_text (dlg, IDC_PINENT_TEXT, "");
+      set_bitmap (dlg, IDC_PINENT_ICON);
       if (pe->ok)
         {
           set_dlg_item_text (dlg, IDOK, pe->ok);
@@ -419,10 +469,10 @@ dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
           SetWindowPos (GetDlgItem (dlg, IDC_PINENT_TEXT), NULL, 0, 0, 0, 0,
                         (SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_HIDEWINDOW));
 
-          item = IDOK;
+          /* item = IDOK; */
         }
-      else
-        item = IDC_PINENT_TEXT;
+      /* else */
+      /*   item = IDC_PINENT_TEXT; */
 
       center_window (dlg, HWND_TOP);
 
@@ -471,6 +521,16 @@ dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
          }
        break;
 
+    case WM_CTLCOLORSTATIC:
+      if ((HWND)lparam == GetDlgItem (dlg, IDC_PINENT_ERR))
+        {
+          /* Display the error prompt in red.  */
+          SetTextColor ((HDC)wparam, RGB (255, 0, 0));
+          SetBkMode ((HDC)wparam, TRANSPARENT);
+          return (BOOL)GetStockObject (NULL_BRUSH);
+        }
+      break;
+
     }
   return FALSE;
 }
diff --git a/w32/pinentry-w32.rc b/w32/pinentry-w32.rc
index efde843..e46ad74 100755
--- a/w32/pinentry-w32.rc
+++ b/w32/pinentry-w32.rc
@@ -45,19 +45,30 @@ END
 
 #else /* Standard Windows.  */
 
-IDD_PINENT DIALOG DISCARDABLE  0, 0, 186, 125
+IDB_ICON_32    BITMAP   DISCARDABLE   "logo-32.bmp"
+IDB_ICON_48    BITMAP   DISCARDABLE   "logo-48.bmp"
+IDB_ICON_64    BITMAP   DISCARDABLE   "logo-64.bmp"
+IDB_ICON_96    BITMAP   DISCARDABLE   "logo-96.bmp"
+IDB_ICON_128   BITMAP   DISCARDABLE   "logo-128.bmp"
+
+IDD_PINENT DIALOG DISCARDABLE  0, 0, 186, 116
 STYLE DS_MODALFRAME | DS_SYSMODAL | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Pinentry"
-FONT 8, "MS Shell Dlg"
+FONT 10, "MS Sans Serif"
 BEGIN
-    LTEXT           "", IDC_PINENT_DESC, 6, 6, 152, 40
-    EDITTEXT        IDC_PINENT_TEXT, 71, 56, 107, 12, ES_PASSWORD | ES_AUTOHSCROLL
-    DEFPUSHBUTTON   "O&K", IDOK, 77, 100, 50, 14
-    PUSHBUTTON      "&Cancel", IDCANCEL, 132, 100, 50, 14
-    LTEXT           "", IDC_PINENT_PROMPT, 6, 56, 64, 12
-    LTEXT           "", IDC_PINENT_ERR, 6, 82, 170, 9
+    CONTROL         "", IDC_PINENT_ICON,
+                    "Static", SS_BITMAP|SS_CENTERIMAGE,
+                                           4,   6,  32, 32
+    LTEXT           "", IDC_PINENT_DESC,  40,   6, 140, 50
+    RTEXT           "", IDC_PINENT_PROMPT, 6,  60,  60, 12
+    EDITTEXT        IDC_PINENT_TEXT,      70,  59, 110, 12, ES_PASSWORD | ES_AUTOHSCROLL
+    CTEXT           "", IDC_PINENT_ERR,    6,  76, 174, 12
+    DEFPUSHBUTTON   "O&K", IDOK,          74,  96,  50, 14
+    PUSHBUTTON      "&Cancel", IDCANCEL, 130,  96,  50, 14
 END
 
+
+
 #endif /* Standard Windows.  */
 
 
diff --git a/w32/resource.h b/w32/resource.h
index b5b77ae..a8a285e 100644
--- a/w32/resource.h
+++ b/w32/resource.h
@@ -1,6 +1,6 @@
-/* resource.h 
+/* resource.h
  *       Copyright 2004 g10 Code GmbH
- *              
+ *
  * This file is free software; as a special exception the author gives
  * unlimited permission to copy and/or distribute it, with or without
  * modifications, as long as this notice is preserved.
@@ -15,3 +15,10 @@
 #define IDC_PINENT_DESC                 1000
 #define IDC_PINENT_ERR                  1001
 #define IDC_PINENT_PROMPT               1002
+#define IDC_PINENT_ICON                 1003
+
+#define IDB_ICON_32                     3101
+#define IDB_ICON_48                     3102
+#define IDB_ICON_64                     3103
+#define IDB_ICON_96                     3104
+#define IDB_ICON_128                    3105

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

Summary of changes:
 w32/Makefile.am     |   6 ++++-
 w32/logo-128.bmp    | Bin 0 -> 8262 bytes
 w32/logo-32.bmp     | Bin 0 -> 582 bytes
 w32/logo-48.bmp     | Bin 0 -> 1222 bytes
 w32/logo-64.bmp     | Bin 0 -> 4738 bytes
 w32/logo-96.bmp     | Bin 0 -> 4678 bytes
 w32/main.c          |  70 ++++++++++++++++++++++++++++++++++++++++++++++++----
 w32/pinentry-w32.rc |  27 ++++++++++++++------
 w32/resource.h      |  11 +++++++--
 9 files changed, 98 insertions(+), 16 deletions(-)
 create mode 100644 w32/logo-128.bmp
 create mode 100644 w32/logo-32.bmp
 create mode 100644 w32/logo-48.bmp
 create mode 100644 w32/logo-64.bmp
 create mode 100644 w32/logo-96.bmp


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




More information about the Gnupg-commits mailing list