X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fxwt%2Fplat%2FX11.cc;h=876c9a8be4cf5f1110f530a532b37afac5d21b07;hb=315e4f3422651f74f312e38493b58896306de2a8;hp=684f3bb363821dffdd779c13db4428bbc7e83ea4;hpb=be2d711e27133f883605d804cf23cf83bd258370;p=org.ibex.core.git diff --git a/src/org/xwt/plat/X11.cc b/src/org/xwt/plat/X11.cc index 684f3bb..876c9a8 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 @@ -35,15 +29,13 @@ #include #include -#include "POSIX.cc" - // static (per-xserver) data static Visual* visual; 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; @@ -585,8 +577,8 @@ void org::xwt::plat::X11$X11Surface::dispatchEvent(gnu::gcj::RawData* ev) { int x_out, y_out; XConfigureEvent* xce = (XConfigureEvent*)(e); XTranslateCoordinates(display, (*((Window*)window)), RootWindow(display, screen_num), 0, 0, &x_out, &y_out, &child); - if (xce->width != width || xce->height != height) SizeChange(xce->width, xce->height); - if (x_out != root->abs(0) || y_out != root->abs(1)) PosChange(x_out, y_out); + if (xce->width != root->width || xce->height != root->height) SizeChange(xce->width, xce->height); + if (x_out != root->x || y_out != root->y) PosChange(x_out, y_out); } } @@ -708,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;