mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-01 11:32:48 -05:00
X forwarding changes:
- new function platform_get_x_display() to find a sensible local display. On Unix, the Gtk apps weren't taking account of --display when determining where to send forwarded X traffic. - explicitly document that leaving X display location blank in config tries to do something sensible (and that it's now blank by default) - don't override X11Display setting in plink, since that's more properly done later [originally from svn r4604]
This commit is contained in:
25
x11fwd.c
25
x11fwd.c
@ -1,3 +1,7 @@
|
||||
/*
|
||||
* Platform-independent bits of X11 forwarding.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
@ -228,14 +232,21 @@ int x11_get_screen_number(char *display)
|
||||
|
||||
/* Find the right display, returns an allocated string */
|
||||
char *x11_display(const char *display) {
|
||||
if(!display || !*display)
|
||||
if(!(display = getenv("DISPLAY")))
|
||||
display = ":0";
|
||||
if(display[0] == ':') {
|
||||
/* no transport specified, use whatever we think is best */
|
||||
return dupcat(platform_x11_best_transport, display, (char *)0);
|
||||
char *ret;
|
||||
if(!display || !*display) {
|
||||
/* try to find platform-specific local display */
|
||||
if(!(ret = platform_get_x_display()))
|
||||
/* plausible default for all platforms */
|
||||
ret = dupstr(":0");
|
||||
} else
|
||||
return dupstr(display);
|
||||
ret = dupstr(display);
|
||||
if(ret[0] == ':') {
|
||||
/* no transport specified, use whatever we think is best */
|
||||
char *s = dupcat(platform_x11_best_transport, display, (char *)0);
|
||||
sfree(ret);
|
||||
return s;
|
||||
} else
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user