<AWT Dev> status of 6532373 (xcb_xlib.c:50: xcb_xlib_unlock: Assertion 'c->xlib.lock' failed.)
Oleg Sukhodolsky
Oleg.Sukhodolsky at Sun.COM
Fri Sep 28 00:36:31 PDT 2007
Hi,
JFYI, I have developed preliminary version of the fix (some lines may be
changed in final version because of possible conflicts with removing
Motif-based AWT implementation)
But anyone who suffer from the problem can already use these changes.
Regards, Oleg.
+++ Makefile 2007-09-25 13:03:02.000000000 +0400
@@ -47,11 +47,10 @@
AUTO_JAVA_PRUNE = WrapperGenerator.java
LDFLAGS += -L$(OPENWIN_LIB)
ifeq ($(PLATFORM), linux)
-FILES_c += Xinerama.c
LDFLAGS += -lpthread
dummy := $(shell $(MKDIR) -p $(LIB_LOCATION))
endif
# Since this library will be living in a subdirectory below the other
libraries
@@ -249,12 +248,10 @@
fi
@if [ "$(DOCOMPARE)$(suffix $@)" = "true.64" ]; then \
$(ECHO) COMPARING $@ and
$(STORED_SIZES_TMPL_$(PLATFORM)_$(LIBARCH)); \
$(DIFF) $@ $(STORED_SIZES_TMPL_$(PLATFORM)_$(LIBARCH)); \
fi
-
-
$(TEMPDIR)/.gen.wrappers: $(SIZES) $(WRAPPER_GENERATOR_CLASS) $(XLIBTYPES)
$(BOOT_JAVA_CMD) -cp $(WRAPPER_GENERATOR_TEMPDIR)
WrapperGenerator \
$(GEN_DIR) $(XLIBTYPES) "gen" $(WRAPPER_GENERATOR_DIR)/sizes
+++ mawt.gmk 2007-09-25 13:03:02.000000000 +0400
@@ -55,13 +55,10 @@
FILES_c = $(FILES_MOTIF_c) $(FILES_NO_MOTIF_c)
ifeq ($(MOTIF_VERSION), 2)
FILES_c += awt_motif21.c
FILES_c += awt_Choice21.c
- ifeq ($(PLATFORM), linux)
- FILES_c += Xinerama.c
- endif
endif
endif
ifeq ($(PLATFORM), solaris)
+++ awt_GraphicsEnv.c 2007-09-25 13:06:28.000000000 +0400
@@ -30,10 +30,11 @@
#include <sun_awt_X11GraphicsEnvironment.h>
#include <sun_awt_X11GraphicsDevice.h>
#include <sun_awt_X11GraphicsConfig.h>
#ifndef HEADLESS
#include <X11/extensions/Xdbe.h>
+#include <X11/XKBlib.h>
#include "Xrandr.h"
#include "GLXGraphicsConfig.h"
#endif /* !HEADLESS */
#include <jni.h>
@@ -56,11 +57,10 @@
#endif
#ifndef HEADLESS
#ifdef __linux__
#include <X11/XKBlib.h>
-#include "Xinerama.h"
#endif
int awt_numScreens; /* Xinerama-aware number of screens */
AwtScreenDataPtr x11Screens;
@@ -123,11 +123,22 @@
* operation on both OSes. Until then, some of the Xinerama-related code
* is ifdef'd appropriately. -bchristi, 7/12/01
*/
#define MAXFRAMEBUFFERS 16
-#ifndef __linux__ /* SOLARIS */
+#ifdef __linux__
+typedef struct {
+ int screen_number;
+ short x_org;
+ short y_org;
+ short width;
+ short height;
+} XineramaScreenInfo;
+
+typedef XineramaScreenInfo* XineramaQueryScreensFunc(Display*, int*);
+
+#else /* SOLARIS */
typedef Status XineramaGetInfoFunc(Display* display, int screen_number,
XRectangle* framebuffer_rects, unsigned char* framebuffer_hints,
int* num_framebuffers);
typedef Status XineramaGetCenterHintFunc(Display* display, int
screen_number,
int* x, int* y);
@@ -615,113 +626,128 @@
if (largestAmtScr != wdata->screenNum) {
wdata->screenNum = largestAmtScr;
/* update peer, target Comp */
(*env)->CallVoidMethod(env, peer,
mWindowPeerIDs.draggedToScreenMID,
largestAmtScr);
-
}
#endif /* XAWT */
}
#endif /* HEADLESS */
-/*
- * Do Xinerama-related initialization such as
- * - check if Xinerama is running
- * - if so, load and run Xinerama query functions from the appropriate
library
- */
#ifndef HEADLESS
-void xineramaInit(void) {
#ifdef __linux__
- char* XinExtName = "XINERAMA";
- int32_t major_opcode, first_event, first_error;
- Bool gotXinExt = False;
- unsigned char fbhints[MAXFRAMEBUFFERS];
+static void xinerama_init_linux()
+{
+ void* libHandle = 0;
+ char* XineramaLibName= "libXinerama.so";
int32_t locNumScr = 0;
- int32_t idx;
-
XineramaScreenInfo *xinInfo;
+ char* XineramaQueryScreensName = "XineramaQueryScreens";
+ XineramaQueryScreensFunc* XineramaQueryScreens = NULL;
- gotXinExt = XQueryExtension(awt_display, XinExtName, &major_opcode,
- &first_event, &first_error);
-
- if (gotXinExt) {
- DTRACE_PRINTLN("Xinerama extension available");
- DTRACE_PRINTLN("calling XineramaGetInfo func on
Linux");
- xinInfo = XineramaQueryScreens(awt_display,
&locNumScr);
- if (xinInfo != NULL) {
- DTRACE_PRINTLN("Enabling Xinerama support");
- usingXinerama = True;
- /* set global number of screens */
- DTRACE_PRINTLN1(" num screens = %i\n", locNumScr);
- awt_numScreens = locNumScr;
-
- /* stuff values into fbrects */
- for (idx = 0; idx < awt_numScreens; idx++) {
- DASSERT(xinInfo[idx].screen_number == idx);
-
- fbrects[idx].width = xinInfo[idx].width;
- fbrects[idx].height = xinInfo[idx].height;
- fbrects[idx].x = xinInfo[idx].x_org;
- fbrects[idx].y = xinInfo[idx].y_org;
- }
- } else {
- DTRACE_PRINTLN("calling XineramaQueryScreens
didn't work");
- }
+ /* load library */
+ libHandle = dlopen(XineramaLibName, RTLD_LAZY | RTLD_GLOBAL);
+ if (libHandle != 0) {
+ XineramaQueryScreens = (XineramaQueryScreensFunc*)
+ dlsym(libHandle, XineramaQueryScreensName);
+
+ if (XineramaQueryScreens != NULL) {
+ DTRACE_PRINTLN("calling XineramaGetInfo func on Linux");
+ xinInfo = (*XineramaQueryScreens)(awt_display, &locNumScr);
+ if (xinInfo != NULL) {
+ int32_t idx;
+ DTRACE_PRINTLN("Enabling Xinerama support");
+ usingXinerama = True;
+ /* set global number of screens */
+ DTRACE_PRINTLN1(" num screens = %i\n", locNumScr);
+ awt_numScreens = locNumScr;
+
+ /* stuff values into fbrects */
+ for (idx = 0; idx < awt_numScreens; idx++) {
+ DASSERT(xinInfo[idx].screen_number == idx);
+
+ fbrects[idx].width = xinInfo[idx].width;
+ fbrects[idx].height = xinInfo[idx].height;
+ fbrects[idx].x = xinInfo[idx].x_org;
+ fbrects[idx].y = xinInfo[idx].y_org;
+ }
+ } else {
+ DTRACE_PRINTLN("calling XineramaQueryScreens didn't work");
+ }
+ } else {
+ DTRACE_PRINTLN("couldn't load XineramaQueryScreens symbol");
+ }
+ dlclose(libHandle);
} else {
- DTRACE_PRINTLN("Xinerama not available");
+ DTRACE_PRINTLN1("\ncouldn't open shared library: %s\n", dlerror());
}
-
-#else /* Solaris */
-
- char* XinExtName = "XINERAMA";
- int32_t major_opcode, first_event, first_error;
- Bool gotXinExt = False;
+}
+#endif
+#ifndef __linux__ /* Solaris */
+static void xinerama_init_solaris()
+{
void* libHandle = 0;
- unsigned char fbhints[MAXFRAMEBUFFERS];
- int locNumScr = 0;
-
char* XineramaLibName= "libXext.so";
+ unsigned char fbhints[MAXFRAMEBUFFERS];
+ int32_t locNumScr = 0;
+ /* load and run XineramaGetInfo */
char* XineramaGetInfoName = "XineramaGetInfo";
char* XineramaGetCenterHintName = "XineramaGetCenterHint";
XineramaGetInfoFunc* XineramaSolarisFunc = NULL;
- gotXinExt = XQueryExtension(awt_display, XinExtName, &major_opcode,
- &first_event, &first_error);
-
- if (gotXinExt) {
- DTRACE_PRINTLN("Xinerama extension available");
-
- /* load library, load and run XineramaGetInfo */
- libHandle = dlopen(XineramaLibName, RTLD_LAZY | RTLD_GLOBAL);
- if (libHandle != 0) {
- XineramaSolarisFunc =
(XineramaGetInfoFunc*)dlsym(libHandle, XineramaGetInfoName);
- XineramaSolarisCenterFunc =
- (XineramaGetCenterHintFunc*)dlsym(libHandle,
- XineramaGetCenterHintName);
- if (XineramaSolarisFunc != NULL) {
- DTRACE_PRINTLN("calling XineramaGetInfo func on Solaris");
- if ((*XineramaSolarisFunc)(awt_display, 0, &fbrects[0],
- &fbhints[0], &locNumScr) != 0) {
-
- DTRACE_PRINTLN("Enabling Xinerama support");
- usingXinerama = True;
- /* set global number of screens */
- DTRACE_PRINTLN1(" num screens = %i\n", locNumScr);
- awt_numScreens = locNumScr;
- } else {
- DTRACE_PRINTLN("calling XineramaGetInfo didn't work");
- }
+ /* load library */
+ libHandle = dlopen(XineramaLibName, RTLD_LAZY | RTLD_GLOBAL);
+ if (libHandle != 0) {
+ XineramaSolarisFunc = (XineramaGetInfoFunc*)dlsym(libHandle,
XineramaGetInfoName);
+ XineramaSolarisCenterFunc =
+ (XineramaGetCenterHintFunc*)dlsym(libHandle,
XineramaGetCenterHintName);
+
+ if (XineramaSolarisFunc != NULL) {
+ DTRACE_PRINTLN("calling XineramaGetInfo func on Solaris");
+ if ((*XineramaSolarisFunc)(awt_display, 0, &fbrects[0],
+ &fbhints[0], &locNumScr) != 0)
+ {
+ DTRACE_PRINTLN("Enabling Xinerama support");
+ usingXinerama = True;
+ /* set global number of screens */
+ DTRACE_PRINTLN1(" num screens = %i\n", locNumScr);
+ awt_numScreens = locNumScr;
} else {
- DTRACE_PRINTLN("couldn't load XineramaGetInfo symbol");
+ DTRACE_PRINTLN("calling XineramaGetInfo didn't work");
}
- dlclose(libHandle);
} else {
- DTRACE_PRINTLN1("\ncouldn't open shared library: %s\n",
dlerror());
+ DTRACE_PRINTLN("couldn't load XineramaGetInfo symbol");
}
+ dlclose(libHandle);
} else {
- DTRACE_PRINTLN("Xinerama not available");
+ DTRACE_PRINTLN1("\ncouldn't open shared library: %s\n", dlerror());
}
+}
+#endif
+
+/*
+ * Checks is Xinerama is running and perform Xinerama-related
+ * platform dependent initialization.
+ */
+static void xineramaInit(void) {
+ char* XinExtName = "XINERAMA";
+ int32_t major_opcode, first_event, first_error;
+ Bool gotXinExt = False;
+
+ gotXinExt = XQueryExtension(awt_display, XinExtName, &major_opcode,
+ &first_event, &first_error);
+
+ if (!gotXinExt) {
+ DTRACE_PRINTLN("Xinerama is not available");
+ return;
+ }
+
+ DTRACE_PRINTLN("Xinerama extension is available");
+#ifdef __linux__
+ xinerama_init_linux();
+#else /* Solaris */
+ xinerama_init_solaris();
#endif /* __linux__ */
}
#endif /* HEADLESS */
Display *
@@ -920,11 +946,11 @@
Java_sun_awt_X11GraphicsDevice_getDisplay(JNIEnv *env, jobject this)
{
#ifdef HEADLESS
return NULL;
#else
- return (jlong) awt_display;
+ return ptr_to_jlong(awt_display);
#endif /* !HEADLESS */
}
#ifdef MITSHM
More information about the awt-dev
mailing list