From 30a97e770cce0d6529058052cd78990ff08b84ad Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 14 Feb 2008 19:50:10 +0000 Subject: Poems for AllowSetForegroundWindow (W32) --- common/sysutils.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'common/sysutils.c') 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 #endif #ifdef HAVE_W32_SYSTEM +# define WINVER 0x0500 /* Required for AllowSetForegroundWindow. */ # include #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 +} -- cgit v1.2.3