diff --git a/make/sun/xawt/mapfile-vers b/make/sun/xawt/mapfile-vers index 096bfe553264856292e9587fc67e9bb6b81f6398..8a12b69c31494a3c55a960a83f52e49c5371ab16 100644 --- a/make/sun/xawt/mapfile-vers +++ b/make/sun/xawt/mapfile-vers @@ -158,7 +158,6 @@ SUNWprivate_1.1 { Java_sun_awt_X11_XRobotPeer_mouseReleaseImpl; Java_sun_awt_X11_XRobotPeer_mouseWheelImpl; Java_sun_awt_X11_XRobotPeer_setup; - Java_sun_awt_X11_XRobotPeer__1dispose; Java_sun_awt_X11_XToolkit_getNumberOfButtonsImpl; Java_java_awt_Component_initIDs; Java_java_awt_Container_initIDs; diff --git a/src/solaris/classes/sun/awt/X11/XRobotPeer.java b/src/solaris/classes/sun/awt/X11/XRobotPeer.java index 1463f283f0bd33b06551bf3d0ae687bd51a96803..a6acd8eb5f58241958e601b14a5fd3710838b222 100644 --- a/src/solaris/classes/sun/awt/X11/XRobotPeer.java +++ b/src/solaris/classes/sun/awt/X11/XRobotPeer.java @@ -48,7 +48,7 @@ class XRobotPeer implements RobotPeer { } public void dispose() { - _dispose(); + // does nothing } public void mouseMove(int x, int y) { @@ -88,7 +88,6 @@ class XRobotPeer implements RobotPeer { } private static native synchronized void setup(int numberOfButtons, int[] buttonDownMasks); - private static native synchronized void _dispose(); private static native synchronized void mouseMoveImpl(X11GraphicsConfig xgc, int x, int y); private static native synchronized void mousePressImpl(int buttons); diff --git a/src/solaris/native/sun/awt/awt_Robot.c b/src/solaris/native/sun/awt/awt_Robot.c index 38ad27863667f4e7fe49f8f702470dc36500f4ff..c3384b2eb1a3a5461bac73c2cebd1f84c3105e39 100644 --- a/src/solaris/native/sun/awt/awt_Robot.c +++ b/src/solaris/native/sun/awt/awt_Robot.c @@ -48,28 +48,12 @@ #ifdef __linux__ #include #endif -#include extern struct X11GraphicsConfigIDs x11GraphicsConfigIDs; static jint * masks; static jint num_buttons; -static unsigned int s_robotInstanceCounter = 0; - -static void* xcompositeLibHandle = NULL; -static Bool xcompositeExtAvailable = False; -static Bool xcompositeExtTested = False; - -typedef Status (*T_XCompositeQueryVersion)(Display *dpy, int *major_versionp, int *minor_versionp); -typedef Window (*T_XCompositeGetOverlayWindow)(Display *dpy, Window window); -typedef void (*T_XCompositeReleaseOverlayWindow)(Display *dpy, Window window); - -static T_XCompositeQueryVersion XCompositeQueryVersion = NULL; -static T_XCompositeGetOverlayWindow XCompositeGetOverlayWindow = NULL; -static T_XCompositeReleaseOverlayWindow XCompositeReleaseOverlayWindow = NULL; - - static int32_t isXTestAvailable() { int32_t major_opcode, first_event, first_error; int32_t event_basep, error_basep, majorp, minorp; @@ -210,80 +194,8 @@ Java_sun_awt_X11_XRobotPeer_setup (JNIEnv * env, jclass cls, jint numberOfButton } AWT_UNLOCK(); - - s_robotInstanceCounter++; } -JNIEXPORT void JNICALL -Java_sun_awt_X11_XRobotPeer__1dispose (JNIEnv * env, jclass cls) -{ - if (--s_robotInstanceCounter) { - return; - } - - // This is the last instance of the XRobotPeer being released - - if (xcompositeExtTested && xcompositeExtAvailable && xcompositeLibHandle) { - // The lib is loaded in IsXCompositeAvailable(). Unload under AWT_LOCK - // so that the shutdown function of the lib behaves correctly. - AWT_LOCK(); - dlclose(xcompositeLibHandle); - AWT_UNLOCK(); - } - - xcompositeExtTested = False; - xcompositeExtAvailable = False; - xcompositeLibHandle = NULL; -} - -/* - * Returns True only if XCOMPOSITE is of version 0.3 or higher. - * The functions that we need are available since that version. - * - * Must be invoked under AWT_LOCK. - * - * Leaves the library loaded if the version is correct. - */ -static Bool IsXCompositeAvailable() -{ - if (!xcompositeExtTested) { - int opcode, eventb, errorb; - - if (XQueryExtension(awt_display, "Composite", &opcode, &eventb, &errorb)) { - xcompositeLibHandle = dlopen("libXcomposite.so.1", RTLD_LAZY | RTLD_GLOBAL); -#ifndef __linux__ /* SOLARIS */ - if (xcompositeLibHandle == NULL) { - xcompositeLibHandle = dlopen("/usr/sfw/lib/libXcomposite.so.1", - RTLD_LAZY | RTLD_GLOBAL); - } -#endif - - if (xcompositeLibHandle) { - int major, minor; - XCompositeQueryVersion = (T_XCompositeQueryVersion)dlsym(xcompositeLibHandle, "XCompositeQueryVersion"); - - if (XCompositeQueryVersion && XCompositeQueryVersion(awt_display, &major, &minor)) { - if (major >= 0 && minor >= 3) { - XCompositeGetOverlayWindow = (T_XCompositeGetOverlayWindow)dlsym(xcompositeLibHandle, "XCompositeGetOverlayWindow"); - XCompositeReleaseOverlayWindow = (T_XCompositeReleaseOverlayWindow)dlsym(xcompositeLibHandle, "XCompositeReleaseOverlayWindow"); - - if (XCompositeGetOverlayWindow && XCompositeReleaseOverlayWindow) { - xcompositeExtAvailable = True; - } - } - } - - if (!xcompositeExtAvailable) { - dlclose(xcompositeLibHandle); - } /* else the lib is unloaded in _dispose() */ - } - } - - xcompositeExtTested = True; - } - - return xcompositeExtAvailable; -} JNIEXPORT void JNICALL Java_sun_awt_X11_XRobotPeer_getRGBPixelsImpl( JNIEnv *env, @@ -299,7 +211,7 @@ Java_sun_awt_X11_XRobotPeer_getRGBPixelsImpl( JNIEnv *env, jint *ary; /* Array of jints for sending pixel values back * to parent process. */ - Window window; + Window rootWindow; AwtGraphicsConfigDataPtr adata; DTRACE_PRINTLN6("RobotPeer: getRGBPixelsImpl(%lx, %d, %d, %d, %d, %x)", xgc, x, y, width, height, pixelArray); @@ -316,24 +228,14 @@ Java_sun_awt_X11_XRobotPeer_getRGBPixelsImpl( JNIEnv *env, adata = (AwtGraphicsConfigDataPtr) JNU_GetLongFieldAsPtr(env, xgc, x11GraphicsConfigIDs.aData); DASSERT(adata != NULL); - window = XRootWindow(awt_display, adata->awt_visInfo.screen); - - if (IsXCompositeAvailable()) { - // Use 'composite overlay window' instead of the root window. - // See 6903034 for details. - window = XCompositeGetOverlayWindow(awt_display, window); - } - - image = getWindowImage(awt_display, window, x, y, width, height); + rootWindow = XRootWindow(awt_display, adata->awt_visInfo.screen); + image = getWindowImage(awt_display, rootWindow, x, y, width, height); /* Array to use to crunch around the pixel values */ ary = (jint *) malloc(width * height * sizeof (jint)); if (ary == NULL) { JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError"); XDestroyImage(image); - if (IsXCompositeAvailable()) { - XCompositeReleaseOverlayWindow(awt_display, window); - } AWT_UNLOCK(); return; } @@ -354,9 +256,6 @@ Java_sun_awt_X11_XRobotPeer_getRGBPixelsImpl( JNIEnv *env, free(ary); XDestroyImage(image); - if (IsXCompositeAvailable()) { - XCompositeReleaseOverlayWindow(awt_display, window); - } AWT_UNLOCK(); }