XQuartz: Force X11Controller to reset a broken DISPLAY envvar.
This commit is contained in:
parent
b4add7826d
commit
f1a52b5b5a
|
@ -55,6 +55,8 @@
|
|||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
BOOL xquartz_resetenv_display = NO;
|
||||
|
||||
@implementation X11Controller
|
||||
|
||||
- (void) awakeFromNib
|
||||
|
@ -319,6 +321,16 @@
|
|||
int child1, child2 = 0;
|
||||
int status;
|
||||
|
||||
if(xquartz_resetenv_display) {
|
||||
char _display[32];
|
||||
size_t i;
|
||||
for(i=0; !display && i < 5; i++)
|
||||
sleep(1);
|
||||
|
||||
snprintf(_display, sizeof(_display), ":%s", display);
|
||||
setenv("DISPLAY", _display, TRUE);
|
||||
}
|
||||
|
||||
argv[0] = "/usr/bin/login";
|
||||
argv[1] = "-fp";
|
||||
argv[2] = getlogin();
|
||||
|
|
|
@ -57,6 +57,8 @@ void DarwinListenOnOpenFD(int fd);
|
|||
|
||||
extern int noPanoramiXExtension;
|
||||
|
||||
extern int xquartz_resetenv_display;
|
||||
|
||||
#define DEFAULT_CLIENT "/usr/X11/bin/xterm"
|
||||
#define DEFAULT_STARTX "/usr/X11/bin/startx"
|
||||
#define DEFAULT_SHELL "/bin/sh"
|
||||
|
@ -408,6 +410,9 @@ int startup_trigger(int argc, char **argv, char **envp) {
|
|||
if((s = getenv("DISPLAY"))) {
|
||||
fprintf(stderr, "X11.app: Could not connect to server (DISPLAY=\"%s\", unsetting). Starting X server.\n", s);
|
||||
unsetenv("DISPLAY");
|
||||
|
||||
/* This tells X11Controller to not use the environment's DISPLAY and reset it based on the server's display */
|
||||
xquartz_resetenv_display = 1;
|
||||
} else {
|
||||
fprintf(stderr, "X11.app: Could not connect to server (DISPLAY is not set). Starting X server.\n");
|
||||
}
|
||||
|
|
|
@ -76,9 +76,9 @@ BOOL xpbproxy_init (void) {
|
|||
xpbproxy_dpy = XOpenDisplay(NULL);
|
||||
|
||||
if(!xpbproxy_dpy && display) {
|
||||
char *_display = alloca(sizeof(char) * (strlen(display) + 2));
|
||||
strcpy(_display+1, display);
|
||||
*_display=':';
|
||||
char _display[32];
|
||||
snprintf(_display, sizeof(_display), ":%s", display);
|
||||
setenv("DISPLAY", _display, TRUE);
|
||||
|
||||
xpbproxy_dpy=XOpenDisplay(_display);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user