From d951db1e8a9f4ad154055a2534c1e965df6a44b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Mon, 25 Mar 2019 19:26:44 +0100 Subject: [PATCH] On Windows, raise the main window only when needed for IPC calls We need to explicitly raise the main window on IPC commands only when opening files and similar. For query commands like "doclist" the focus should stay on the remote instance. --- src/socket.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/socket.c b/src/socket.c index 5a2b809e..b9db75d1 100644 --- a/src/socket.c +++ b/src/socket.c @@ -326,15 +326,16 @@ gint socket_init(gint argc, gchar **argv) /* remote command mode, here we have another running instance and want to use it */ -#ifdef G_OS_WIN32 - /* first we send a request to retrieve the window handle and focus the window */ - socket_fd_write_all(sock, "window\n", 7); - if (socket_fd_read(sock, (gchar *)&hwnd, sizeof(hwnd)) == sizeof(hwnd)) - SetForegroundWindow(hwnd); -#endif /* now we send the command line args */ if (argc > 1) { +#ifdef G_OS_WIN32 + /* first we send a request to retrieve the window handle and focus the window */ + socket_fd_write_all(sock, "window\n", 7); + if (socket_fd_read(sock, (gchar *)&hwnd, sizeof(hwnd)) == sizeof(hwnd)) + SetForegroundWindow(hwnd); +#endif + send_open_command(sock, argc, argv); }