X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fxwt%2Fplat%2FX11.cc;h=73d1541dd7de357dae33dc8efdc9449508e635ee;hb=2ecea0c2856332ce907f16b4e2a233ff1428e4d6;hp=9fd2ac32e4826e513731760297097f38add67521;hpb=fa437b8b1bdf01b3bbdabec990b60833cd6c68f0;p=org.ibex.core.git diff --git a/src/org/xwt/plat/X11.cc b/src/org/xwt/plat/X11.cc index 9fd2ac3..73d1541 100644 --- a/src/org/xwt/plat/X11.cc +++ b/src/org/xwt/plat/X11.cc @@ -1,8 +1,8 @@ // Copyright 2002 Adam Megacz, see the COPYING file for licensing [LGPL] // see below for copyright information on the second portion of this file -#include -#include +#include "POSIX.cc" + #include #include #include @@ -11,12 +11,6 @@ #include #include #include -#include -#include -#include -#include -#include -#include #include #include @@ -41,7 +35,7 @@ static Colormap s_colormap; static XStandardColormap* colormap_info; static XShmSegmentInfo shm_info; static Window selectionWindow; -static int shm_supported; +static int shm_supported = 0; static int shm_pixmaps_supported; static int screen_num; static int colorDepth = 0; @@ -706,12 +700,19 @@ void org::xwt::plat::X11::natInit() { if (!XInitThreads()) org::xwt::Platform::criticalAbort(JvNewStringLatin1("Your X11 libraries do not support multithreaded programs")); - display = XOpenDisplay(NULL); + char* DISPLAY = getenv("DISPLAY"); + if (DISPLAY == NULL || strlen(DISPLAY) == 0) DISPLAY = ":0.0"; + display = XOpenDisplay(DISPLAY); + + if (display == 0) + org::xwt::Platform::criticalAbort(JvNewStringLatin1("Unable to connect to X11 display server")); + screen_num = XDefaultScreen(display); colorDepth = (jint)(DefaultDepth(((Display*)display), 0)); shm_info.shmaddr = NULL; - shm_supported = (XShmQueryExtension(display) == True); + // FIXME: SHM doesn't work on Darwin + //shm_supported = (XShmQueryExtension(display) == True); if (shm_supported) { X11ErrorHandler* oldHandler = XSetErrorHandler(errorHandler); XShmSegmentInfo sinfo;