summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2008-02-14 20:50:10 +0100
committerWerner Koch <wk@gnupg.org>2008-02-14 20:50:10 +0100
commit30a97e770cce0d6529058052cd78990ff08b84ad (patch)
tree626d2942172a8387a1cc00a1a9bce1e5bba1ad52 /common
parentAlways search missing certifcates using a running Dirmngr's cache. (diff)
downloadgnupg2-30a97e770cce0d6529058052cd78990ff08b84ad.tar.xz
gnupg2-30a97e770cce0d6529058052cd78990ff08b84ad.zip
Poems for AllowSetForegroundWindow (W32)
Diffstat (limited to 'common')
-rw-r--r--common/ChangeLog5
-rw-r--r--common/sysutils.c17
-rw-r--r--common/sysutils.h1
3 files changed, 22 insertions, 1 deletions
diff --git a/common/ChangeLog b/common/ChangeLog
index f8b2858e5..d509cd4a7 100644
--- a/common/ChangeLog
+++ b/common/ChangeLog
@@ -1,3 +1,8 @@
+2008-02-14 Werner Koch <wk@g10code.com>
+
+ * sysutils.c (gnupg_allow_set_foregound_window): New.
+ (WINVER) [W32]: Define.
+
2008-01-31 Werner Koch <wk@g10code.com>
* audit.c (audit_print_result): Make sure that the output is
diff --git a/common/sysutils.c b/common/sysutils.c
index 869dc2a10..5e550b43a 100644
--- a/common/sysutils.c
+++ b/common/sysutils.c
@@ -1,6 +1,6 @@
/* sysutils.c - system helpers
* Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004,
- * 2007 Free Software Foundation, Inc.
+ * 2007, 2008 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -43,6 +43,7 @@
# include <sys/resource.h>
#endif
#ifdef HAVE_W32_SYSTEM
+# define WINVER 0x0500 /* Required for AllowSetForegroundWindow. */
# include <windows.h>
#endif
#ifdef HAVE_PTH
@@ -471,3 +472,17 @@ gnupg_reopen_std (const char *pgmname)
#endif /* HAVE_STAT && !HAVE_W32_SYSTEM */
}
+
+/* Hack required for Windows. */
+void
+gnupg_allow_set_foregound_window (pid_t pid)
+{
+ if (!pid || pid == (pid_t)(-1))
+ log_info ("%s called with invalid pid %lu\n",
+ "gnupg_allow_set_foregound_window", (unsigned long)pid);
+#ifdef HAVE_W32_SYSTEM
+ else if (!AllowSetForegroundWindow (pid))
+ log_info ("AllowSetForegroundWindow(%lu) failed: %s\n",
+ (unsigned long)pid, w32_strerror (-1));
+#endif
+}
diff --git a/common/sysutils.h b/common/sysutils.h
index 44f7ca68c..de1e3bb1e 100644
--- a/common/sysutils.h
+++ b/common/sysutils.h
@@ -47,6 +47,7 @@ int translate_sys2libc_fd (gnupg_fd_t fd, int for_write);
int translate_sys2libc_fd_int (int fd, int for_write);
FILE *gnupg_tmpfile (void);
void gnupg_reopen_std (const char *pgmname);
+void gnupg_allow_set_foregound_window (pid_t pid);
#ifdef HAVE_W32_SYSTEM