[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lib-src/emacsclient.c,v
From: |
Juanma Barranquero |
Subject: |
[Emacs-diffs] Changes to emacs/lib-src/emacsclient.c,v |
Date: |
Tue, 07 Nov 2006 10:43:45 +0000 |
CVSROOT: /cvsroot/emacs
Module name: emacs
Changes by: Juanma Barranquero <lektu> 06/11/07 10:43:45
Index: emacsclient.c
===================================================================
RCS file: /cvsroot/emacs/emacs/lib-src/emacsclient.c,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -b -r1.85 -r1.86
--- emacsclient.c 6 Nov 2006 12:37:46 -0000 1.85
+++ emacsclient.c 7 Nov 2006 10:43:45 -0000 1.86
@@ -432,7 +432,7 @@
/*
* Read the information needed to set up a TCP comm channel with
- * the Emacs server: host, port and authentication string.
+ * the Emacs server: host, port, pid and authentication string.
*/
int
get_server_config (server, authentication)
@@ -441,6 +441,7 @@
{
char dotted[32];
char *port;
+ char *pid;
FILE *config = NULL;
if (file_name_absolute_p (server_file))
@@ -464,9 +465,11 @@
return FALSE;
if (fgets (dotted, sizeof dotted, config)
- && (port = strchr (dotted, ':')))
+ && (port = strchr (dotted, ':'))
+ && (pid = strchr (port, ' ')))
{
*port++ = '\0';
+ *pid++ = '\0';
}
else
{
@@ -486,6 +489,30 @@
fclose (config);
+#ifdef WINDOWSNT
+ /*
+ Modern Windows restrict which processes can set the foreground window.
+ So, for emacsclient to be able to force Emacs into the foreground, we
+ have to call AllowSetForegroundWindow(). Unfortunately, older Windows
+ (W95, W98 and NT) don't have this function, so we have to check first.
+
+ We're doing this here because it has to be done before sending info
+ to Emacs, and otherwise we'll need a global variable just to pass around
+ the pid, which is also inelegant.
+ */
+ {
+ HMODULE hUser32;
+
+ if (hUser32 = LoadLibrary ("user32.dll"))
+ {
+ void (*set_fg)(DWORD);
+ if (set_fg = GetProcAddress (hUser32, "AllowSetForegroundWindow"))
+ set_fg (atoi (pid));
+ FreeLibrary (hUser32);
+ }
+ }
+#endif
+
return TRUE;
}
- [Emacs-diffs] Changes to emacs/lib-src/emacsclient.c,v, Juanma Barranquero, 2006/11/01
- [Emacs-diffs] Changes to emacs/lib-src/emacsclient.c,v, Juanma Barranquero, 2006/11/02
- [Emacs-diffs] Changes to emacs/lib-src/emacsclient.c,v, Juanma Barranquero, 2006/11/03
- [Emacs-diffs] Changes to emacs/lib-src/emacsclient.c,v, Juanma Barranquero, 2006/11/06
- [Emacs-diffs] Changes to emacs/lib-src/emacsclient.c,v,
Juanma Barranquero <=
- [Emacs-diffs] Changes to emacs/lib-src/emacsclient.c,v, Juanma Barranquero, 2006/11/07
- [Emacs-diffs] Changes to emacs/lib-src/emacsclient.c,v, Juanma Barranquero, 2006/11/07
- [Emacs-diffs] Changes to emacs/lib-src/emacsclient.c,v, Juanma Barranquero, 2006/11/10
- [Emacs-diffs] Changes to emacs/lib-src/emacsclient.c,v, Juanma Barranquero, 2006/11/22
- [Emacs-diffs] Changes to emacs/lib-src/emacsclient.c,v, Juanma Barranquero, 2006/11/22
- [Emacs-diffs] Changes to emacs/lib-src/emacsclient.c,v, Juanma Barranquero, 2006/11/24
- [Emacs-diffs] Changes to emacs/lib-src/emacsclient.c,v, Eli Zaretskii, 2006/11/24
- [Emacs-diffs] Changes to emacs/lib-src/emacsclient.c,v, Jason Rumney, 2006/11/25
- [Emacs-diffs] Changes to emacs/lib-src/emacsclient.c,v, Juanma Barranquero, 2006/11/30
- [Emacs-diffs] Changes to emacs/lib-src/emacsclient.c,v, Juanma Barranquero, 2006/11/30