Subject: Re: bug#7658: 24.0.50; emacsclient not raising frame

From: Juanma Barranquero <[email-masked]>
Date: Mon, 4 Jul 2011 13:28:59 +0200

On Thu, Dec 16, 2010 at 23:23,  <[email-masked]> wrote:

> From the command line I can see:
>
> emacs-24.0.50\bin\emacsclient.exe: connected to remote socket at
> xxx.xx.x.xxx
>
> So I can see that it made the connection (I removed the real IP adress)
> but the frame is not raised.

IIUC, the connection is remote, i.e., you're invoking emacsclient in
one computer, and emacs is running in another one (both Windows, I
suppose).

In that case, there's nothing we can do. The trend on newer Windows is
to give the user, not the programs, the control of the focus, so
programs requesting it do not normally get it.

However, a program that already has the focus can pass the privilege,
so to speak, to another one. When you run emacsclient, it has the
focus. So, it tries to detect a running Emacs in the same computer
with the right pid, and if it finds it, it calls a Windows API,
AllowSetForegroundWindow, to pass it the focus. But obviously this
does not work for a program in a remote computer; not even if one of
the computers is just a virtual machine running in the other one.

    Juanma