summaryrefslogtreecommitdiff
path: root/src/w32-glib-io.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2009-06-12 16:58:45 +0000
committerWerner Koch <wk@gnupg.org>2009-06-12 16:58:45 +0000
commit148f51bb3e6e592333250ef73f2b801a10734083 (patch)
tree08ea4fe8f7b9009372821e9b28e41df294b248d8 /src/w32-glib-io.c
parentf4e35be32534c99e0168dfd6620565cfa387957e (diff)
downloadgpgme-148f51bb3e6e592333250ef73f2b801a10734083.tar.gz
Improved W32 SetForegroundWindow hacks.
Diffstat (limited to 'src/w32-glib-io.c')
-rw-r--r--src/w32-glib-io.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/w32-glib-io.c b/src/w32-glib-io.c
index 5f8c8867..c1542cc0 100644
--- a/src/w32-glib-io.c
+++ b/src/w32-glib-io.c
@@ -584,7 +584,7 @@ build_commandline (char **argv)
int
-_gpgme_io_spawn (const char *path, char * const argv[],
+_gpgme_io_spawn (const char *path, char * const argv[], unsigned int flags,
struct spawn_fd_item_s *fd_list, pid_t *r_pid)
{
SECURITY_ATTRIBUTES sec_attr;
@@ -596,8 +596,8 @@ _gpgme_io_spawn (const char *path, char * const argv[],
0 /* returns tid */
};
STARTUPINFO si;
- int cr_flags = CREATE_DEFAULT_ERROR_MODE
- | GetPriorityClass (GetCurrentProcess ());
+ int cr_flags = (CREATE_DEFAULT_ERROR_MODE
+ | GetPriorityClass (GetCurrentProcess ()));
int i;
char **args;
char *arg_string;
@@ -679,6 +679,9 @@ _gpgme_io_spawn (const char *path, char * const argv[],
free (arg_string);
+ if (flags & IOSPAWN_FLAG_ALLOW_SET_FG)
+ _gpgme_allow_set_foreground_window ((pid_t)pi.dwProcessId);
+
/* Insert the inherited handles. */
for (i = 0; fd_list[i].fd != -1; i++)
{
@@ -721,8 +724,10 @@ _gpgme_io_spawn (const char *path, char * const argv[],
int written;
size_t len;
- line[0] = '\n';
- line[1] = '\0';
+ if ((flags & IOSPAWN_FLAG_ALLOW_SET_FG))
+ strcpy (line, "~1 \n");
+ else
+ strcpy (line, "\n");
for (i = 0; fd_list[i].fd != -1; i++)
{
/* Strip the newline. */