jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c

Print this page




 320     JNU_ThrowInternalError(env, "Can't find supported visual");
 321     XCloseDisplay(awt_display);
 322     awt_display = NULL;
 323     return NULL;
 324 }
 325 
 326 static void
 327 getAllConfigs (JNIEnv *env, int screen, AwtScreenDataPtr screenDataPtr) {
 328 
 329     int i;
 330     int n8p=0, n12p=0, n8s=0, n8gs=0, n8sg=0, n1sg=0, nTrue=0;
 331     int nConfig;
 332     XVisualInfo *pVI8p, *pVI12p, *pVI8s, *pVITrue, *pVI8gs,
 333                 *pVI8sg, *pVI1sg = NULL, viTmp;
 334     AwtGraphicsConfigDataPtr *graphicsConfigs;
 335     AwtGraphicsConfigDataPtr defaultConfig;
 336     int ind;
 337     char errmsg[128];
 338     int xinawareScreen;
 339     void* xrenderLibHandle = NULL;
 340     XRenderFindVisualFormatFunc *XRenderFindVisualFormat = NULL;
 341     int major_opcode, first_event, first_error;
 342 
 343     if (usingXinerama) {
 344         xinawareScreen = 0;
 345     }
 346     else {
 347         xinawareScreen = screen;
 348     }
 349 
 350     AWT_LOCK ();
 351 
 352     viTmp.screen = xinawareScreen;
 353 
 354     viTmp.depth = 8;
 355     viTmp.class = PseudoColor;
 356     viTmp.colormap_size = 256;
 357     pVI8p = XGetVisualInfo (awt_display,
 358                             VisualDepthMask | VisualClassMask |
 359                             VisualColormapSizeMask | VisualScreenMask,
 360                             &viTmp, &n8p);


 418     }
 419 
 420     defaultConfig = screenDataPtr->defaultConfig;
 421     graphicsConfigs[0] = defaultConfig;
 422     nConfig = 1; /* reserve index 0 for default config */
 423 
 424     // Only use the RENDER extension if it is available on the X server
 425     if (XQueryExtension(awt_display, "RENDER",
 426                         &major_opcode, &first_event, &first_error))
 427     {
 428         xrenderLibHandle = dlopen("libXrender.so.1", RTLD_LAZY | RTLD_GLOBAL);
 429 
 430 #ifndef __linux__ /* SOLARIS */
 431         if (xrenderLibHandle == NULL) {
 432             xrenderLibHandle = dlopen("/usr/sfw/lib/libXrender.so.1",
 433                                       RTLD_LAZY | RTLD_GLOBAL);
 434         }
 435 #endif
 436 
 437         if (xrenderLibHandle != NULL) {
 438             XRenderFindVisualFormat =
 439                 (XRenderFindVisualFormatFunc*)dlsym(xrenderLibHandle,
 440                                                     "XRenderFindVisualFormat");
 441         }
 442     }
 443 
 444     for (i = 0; i < nTrue; i++) {
 445         if (XVisualIDFromVisual(pVITrue[i].visual) ==
 446             XVisualIDFromVisual(defaultConfig->awt_visInfo.visual) ||
 447             pVITrue[i].depth == 12) {
 448             /* Skip the non-supported 12-bit TrueColor visual */
 449             continue;
 450         } else {
 451             ind = nConfig++;
 452         }
 453         graphicsConfigs [ind] = ZALLOC (_AwtGraphicsConfigData);
 454         graphicsConfigs [ind]->awt_depth = pVITrue [i].depth;
 455         memcpy (&graphicsConfigs [ind]->awt_visInfo, &pVITrue [i],
 456                 sizeof (XVisualInfo));
 457        if (XRenderFindVisualFormat != NULL) {
 458             XRenderPictFormat *format = XRenderFindVisualFormat (awt_display,
 459                     pVITrue [i].visual);
 460             if (format &&
 461                 format->type == PictTypeDirect &&
 462                 format->direct.alphaMask)
 463             {
 464                 graphicsConfigs [ind]->isTranslucencySupported = 1;
 465                 memcpy(&graphicsConfigs [ind]->renderPictFormat, format,
 466                         sizeof(*format));
 467             }
 468         }
 469     }
 470 
 471     if (xrenderLibHandle != NULL) {
 472         dlclose(xrenderLibHandle);
 473         xrenderLibHandle = NULL;
 474     }
 475 
 476     for (i = 0; i < n8p; i++) {
 477         if (XVisualIDFromVisual(pVI8p[i].visual) ==




 320     JNU_ThrowInternalError(env, "Can't find supported visual");
 321     XCloseDisplay(awt_display);
 322     awt_display = NULL;
 323     return NULL;
 324 }
 325 
 326 static void
 327 getAllConfigs (JNIEnv *env, int screen, AwtScreenDataPtr screenDataPtr) {
 328 
 329     int i;
 330     int n8p=0, n12p=0, n8s=0, n8gs=0, n8sg=0, n1sg=0, nTrue=0;
 331     int nConfig;
 332     XVisualInfo *pVI8p, *pVI12p, *pVI8s, *pVITrue, *pVI8gs,
 333                 *pVI8sg, *pVI1sg = NULL, viTmp;
 334     AwtGraphicsConfigDataPtr *graphicsConfigs;
 335     AwtGraphicsConfigDataPtr defaultConfig;
 336     int ind;
 337     char errmsg[128];
 338     int xinawareScreen;
 339     void* xrenderLibHandle = NULL;
 340     XRenderFindVisualFormatFunc* xrenderFindVisualFormat = NULL;
 341     int major_opcode, first_event, first_error;
 342 
 343     if (usingXinerama) {
 344         xinawareScreen = 0;
 345     }
 346     else {
 347         xinawareScreen = screen;
 348     }
 349 
 350     AWT_LOCK ();
 351 
 352     viTmp.screen = xinawareScreen;
 353 
 354     viTmp.depth = 8;
 355     viTmp.class = PseudoColor;
 356     viTmp.colormap_size = 256;
 357     pVI8p = XGetVisualInfo (awt_display,
 358                             VisualDepthMask | VisualClassMask |
 359                             VisualColormapSizeMask | VisualScreenMask,
 360                             &viTmp, &n8p);


 418     }
 419 
 420     defaultConfig = screenDataPtr->defaultConfig;
 421     graphicsConfigs[0] = defaultConfig;
 422     nConfig = 1; /* reserve index 0 for default config */
 423 
 424     // Only use the RENDER extension if it is available on the X server
 425     if (XQueryExtension(awt_display, "RENDER",
 426                         &major_opcode, &first_event, &first_error))
 427     {
 428         xrenderLibHandle = dlopen("libXrender.so.1", RTLD_LAZY | RTLD_GLOBAL);
 429 
 430 #ifndef __linux__ /* SOLARIS */
 431         if (xrenderLibHandle == NULL) {
 432             xrenderLibHandle = dlopen("/usr/sfw/lib/libXrender.so.1",
 433                                       RTLD_LAZY | RTLD_GLOBAL);
 434         }
 435 #endif
 436 
 437         if (xrenderLibHandle != NULL) {
 438             xrenderFindVisualFormat =
 439                 (XRenderFindVisualFormatFunc*)dlsym(xrenderLibHandle,
 440                                                     "XRenderFindVisualFormat");
 441         }
 442     }
 443 
 444     for (i = 0; i < nTrue; i++) {
 445         if (XVisualIDFromVisual(pVITrue[i].visual) ==
 446             XVisualIDFromVisual(defaultConfig->awt_visInfo.visual) ||
 447             pVITrue[i].depth == 12) {
 448             /* Skip the non-supported 12-bit TrueColor visual */
 449             continue;
 450         } else {
 451             ind = nConfig++;
 452         }
 453         graphicsConfigs [ind] = ZALLOC (_AwtGraphicsConfigData);
 454         graphicsConfigs [ind]->awt_depth = pVITrue [i].depth;
 455         memcpy (&graphicsConfigs [ind]->awt_visInfo, &pVITrue [i],
 456                 sizeof (XVisualInfo));
 457        if (xrenderFindVisualFormat != NULL) {
 458             XRenderPictFormat *format = XRenderFindVisualFormat (awt_display,
 459                     pVITrue [i].visual);
 460             if (format &&
 461                 format->type == PictTypeDirect &&
 462                 format->direct.alphaMask)
 463             {
 464                 graphicsConfigs [ind]->isTranslucencySupported = 1;
 465                 memcpy(&graphicsConfigs [ind]->renderPictFormat, format,
 466                         sizeof(*format));
 467             }
 468         }
 469     }
 470 
 471     if (xrenderLibHandle != NULL) {
 472         dlclose(xrenderLibHandle);
 473         xrenderLibHandle = NULL;
 474     }
 475 
 476     for (i = 0; i < n8p; i++) {
 477         if (XVisualIDFromVisual(pVI8p[i].visual) ==