Index: daemon/display.c
===================================================================
--- daemon/display.c	(révision 4965)
+++ daemon/display.c	(copie de travail)
@@ -81,6 +81,7 @@
     d->greetpid = 0;
     d->name = g_strdup_printf (":%d", id);
     d->hostname = g_strdup (hostname);
+    d->windowpath = NULL;
     /* Not really used for not XDMCP */
     memset (&(d->addr), 0, sizeof (d->addr));
     d->dispnum = id;
@@ -546,6 +547,9 @@
     g_free (d->hostname);
     d->hostname = NULL;
 
+    g_free (d->windowpath);
+    d->windowpath = NULL;
+
     g_free (d->addrs);
     d->addrs = NULL;
     d->addr_count = 0;
@@ -583,6 +587,9 @@
     g_free (d->userauth);
     d->userauth = NULL;
 
+    g_free (d->windowpath);
+    d->windowpath = NULL;
+
     g_free (d->command);
     d->command = NULL;
 
Index: daemon/display.h
===================================================================
--- daemon/display.h	(révision 4965)
+++ daemon/display.h	(copie de travail)
@@ -73,6 +73,8 @@
 	gchar *name;     /* value of DISPLAY */
 	gchar *hostname; /* remote hostname */
 
+	char *windowpath; /* path to server "window" */
+
 	guint8 dispstat;
 	guint16 dispnum;
 
Index: daemon/gdm-xdmcp-manager.c
===================================================================
--- daemon/gdm-xdmcp-manager.c	(révision 4965)
+++ daemon/gdm-xdmcp-manager.c	(copie de travail)
@@ -1736,6 +1736,7 @@
 
 	gdm_hostent_free (he);
 
+	d->windowpath            = NULL.
 	d->slave_notify_fd       = -1;
 	d->master_notify_fd      = -1;
 	d->xsession_errors_bytes = 0;
Index: daemon/slave.c
===================================================================
--- daemon/slave.c	(révision 4965)
+++ daemon/slave.c	(copie de travail)
@@ -1084,6 +1084,77 @@
 }
 
 static void
+gdm_window_path (GdmDisplay *d)
+{
+	/* setting WINDOWPATH for clients */
+	Atom prop;
+	Atom actualtype;
+	int actualformat;
+	unsigned long nitems;
+	unsigned long bytes_after;
+	unsigned char *buf;
+	const char *windowpath;
+	char *newwindowpath;
+	unsigned long num;
+	char nums[10];
+	int numn;
+
+	prop = XInternAtom (d->dsp, "XFree86_VT", False);
+	if (prop == None) {
+		gdm_debug ("no XFree86_VT atom\n");
+		return;
+	}
+	if (XGetWindowProperty (d->dsp, DefaultRootWindow (d->dsp), prop, 0, 1, 
+		False, AnyPropertyType, &actualtype, &actualformat, 
+		&nitems, &bytes_after, &buf)) {
+		gdm_debug ("no XFree86_VT property\n");
+		return;
+	}
+	if (nitems != 1) {
+		gdm_debug ("%lu items in XFree86_VT property!\n", nitems);
+		XFree (buf);
+		return;
+	}
+	switch (actualtype) {
+	case XA_CARDINAL:
+	case XA_INTEGER:
+	case XA_WINDOW:
+		switch (actualformat) {
+		case  8:
+			num = (*(uint8_t  *)(void *)buf);
+			break;
+		case 16:
+			num = (*(uint16_t *)(void *)buf);
+			break;
+		case 32:
+			num = (*(uint32_t *)(void *)buf);
+			break;
+		default:
+			gdm_debug ("format %d in XFree86_VT property!\n", actualformat);
+			XFree (buf);
+			return;
+		}
+		break;
+	default:
+		gdm_debug ("type %lx in XFree86_VT property!\n", actualtype);
+		XFree (buf);
+		return;
+	}
+	XFree (buf);
+	windowpath = getenv("WINDOWPATH");
+	numn = snprintf (nums, sizeof (nums), "%lu", num);
+	if (!windowpath) {
+		newwindowpath = malloc (numn + 1);
+		sprintf (newwindowpath, "%s", nums);
+	} else {
+		newwindowpath = malloc (strlen (windowpath) + 1 + numn + 1);
+		sprintf (newwindowpath, "%s:%s", windowpath, nums);
+	}
+	free (d->windowpath);
+	d->windowpath = newwindowpath;
+}
+
+static void
 gdm_slave_whack_greeter (void)
 {
 	GdmWaitPid *wp;
@@ -1397,6 +1468,8 @@
 	 * since the lookup was done in server start */
 
 	g_setenv ("DISPLAY", d->name, TRUE);
+	if (d->windowpath)
+		g_setenv ("WINDOWPATH", d->windowpath, TRUE);
 	g_unsetenv ("XAUTHORITY"); /* just in case it's set */
 
 	gdm_auth_set_local_auth (d);
@@ -1517,6 +1590,9 @@
 		gdm_tsol_init (d);
 #endif
 
+    /* checkout window number */
+    gdm_window_path (d);
+
 	/* check log stuff for the server, this is done here
 	 * because it's really a race */
 	if (SERVER_IS_LOCAL (d))
@@ -1826,6 +1902,8 @@
 		/* root here */
 		g_setenv ("XAUTHORITY", GDM_AUTHFILE (display), TRUE);
 		g_setenv ("DISPLAY", display->name, TRUE);
+		if (d->windowpath)
+			g_setenv ("WINDOWPATH", d->windowpath, TRUE);
 		g_setenv ("LOGNAME", pwent->pw_name, TRUE);
 		g_setenv ("USER", pwent->pw_name, TRUE);
 		g_setenv ("USERNAME", pwent->pw_name, TRUE);
@@ -2612,6 +2690,8 @@
 
 		g_setenv ("XAUTHORITY", GDM_AUTHFILE (d), TRUE);
 		g_setenv ("DISPLAY", d->name, TRUE);
+		if (d->windowpath)
+			g_setenv ("WINDOWPATH", d->windowpath, TRUE);
 
 		/* hackish ain't it */
 		set_xnest_parent_stuff ();
@@ -3097,6 +3177,8 @@
 
 		g_setenv ("XAUTHORITY", GDM_AUTHFILE (d), TRUE);
 		g_setenv ("DISPLAY", d->name, TRUE);
+		if (d->windowpath)
+			g_setenv ("WINDOWPATH", d->windowpath, TRUE);
 
 		g_setenv ("LOGNAME", gdmuser, TRUE);
 		g_setenv ("USER", gdmuser, TRUE);
@@ -3556,6 +3638,8 @@
 	/* Prepare user session */
 	g_setenv ("XAUTHORITY", d->userauth, TRUE);
 	g_setenv ("DISPLAY", d->name, TRUE);
+	if (d->windowpath)
+		g_setenv ("WINDOWPATH", d->windowpath, TRUE);
 	g_setenv ("LOGNAME", pwent->pw_name, TRUE);
 	g_setenv ("USER", pwent->pw_name, TRUE);
 	g_setenv ("USERNAME", pwent->pw_name, TRUE);
@@ -5452,6 +5536,8 @@
 		else
 			g_unsetenv ("XAUTHORITY");
 		g_setenv ("DISPLAY", d->name, TRUE);
+		if (d->windowpath)
+			g_setenv ("WINDOWPATH", d->windowpath, TRUE);
 		g_setenv ("PATH", gdm_daemon_config_get_value_string (GDM_KEY_ROOT_PATH), TRUE);
 		g_setenv ("RUNNING_UNDER_GDM", "true", TRUE);
 		if ( ! ve_string_empty (d->theme_name))
@@ -5600,6 +5686,8 @@
 				else
 					g_unsetenv ("XAUTHORITY");
 				g_setenv ("DISPLAY", display->name, TRUE);
+				if (d->windowpath)
+					g_setenv ("WINDOWPATH", d->windowpath, TRUE);
 				if (SERVER_IS_XDMCP (display))
 					g_setenv ("REMOTE_HOST", display->hostname, TRUE);
 				g_setenv ("PATH", gdm_daemon_config_get_value_string (GDM_KEY_ROOT_PATH), TRUE);
