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.
This commit is contained in:
Enrico Tröger 2019-03-25 19:26:44 +01:00
parent bd938af032
commit d951db1e8a

View File

@ -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);
}