src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c
changeset 53675 58ec9ada9234
parent 53673 e04d39094915
child 53678 9b93a6b30cbe
equal deleted inserted replaced
53674:1e1b4f09b869 53675:58ec9ada9234
   135 
   135 
   136 #else /* SOLARIS */
   136 #else /* SOLARIS */
   137 typedef Status XineramaGetInfoFunc(Display* display, int screen_number,
   137 typedef Status XineramaGetInfoFunc(Display* display, int screen_number,
   138          XRectangle* framebuffer_rects, unsigned char* framebuffer_hints,
   138          XRectangle* framebuffer_rects, unsigned char* framebuffer_hints,
   139          int* num_framebuffers);
   139          int* num_framebuffers);
   140 typedef Status XineramaGetCenterHintFunc(Display* display, int screen_number,
       
   141                                          int* x, int* y);
       
   142 
       
   143 XineramaGetCenterHintFunc* XineramaSolarisCenterFunc = NULL;
       
   144 #endif
   140 #endif
   145 
   141 
   146 Bool usingXinerama = False;
   142 Bool usingXinerama = False;
   147 XRectangle fbrects[MAXFRAMEBUFFERS];
   143 XRectangle fbrects[MAXFRAMEBUFFERS];
   148 
   144 
   630     void* libHandle = NULL;
   626     void* libHandle = NULL;
   631     unsigned char fbhints[MAXFRAMEBUFFERS];
   627     unsigned char fbhints[MAXFRAMEBUFFERS];
   632     int32_t locNumScr = 0;
   628     int32_t locNumScr = 0;
   633     /* load and run XineramaGetInfo */
   629     /* load and run XineramaGetInfo */
   634     char* XineramaGetInfoName = "XineramaGetInfo";
   630     char* XineramaGetInfoName = "XineramaGetInfo";
   635     char* XineramaGetCenterHintName = "XineramaGetCenterHint";
       
   636     XineramaGetInfoFunc* XineramaSolarisFunc = NULL;
   631     XineramaGetInfoFunc* XineramaSolarisFunc = NULL;
   637 
   632 
   638     /* load library */
   633     /* load library */
   639     libHandle = dlopen(JNI_LIB_NAME("Xext"), RTLD_LAZY | RTLD_GLOBAL);
   634     libHandle = dlopen(JNI_LIB_NAME("Xext"), RTLD_LAZY | RTLD_GLOBAL);
   640     if (libHandle != NULL) {
   635     if (libHandle != NULL) {
   641         XineramaSolarisFunc = (XineramaGetInfoFunc*)dlsym(libHandle, XineramaGetInfoName);
   636         XineramaSolarisFunc = (XineramaGetInfoFunc*)dlsym(libHandle, XineramaGetInfoName);
   642         XineramaSolarisCenterFunc =
       
   643             (XineramaGetCenterHintFunc*)dlsym(libHandle, XineramaGetCenterHintName);
       
   644 
       
   645         if (XineramaSolarisFunc != NULL) {
   637         if (XineramaSolarisFunc != NULL) {
   646             DTRACE_PRINTLN("calling XineramaGetInfo func on Solaris");
   638             DTRACE_PRINTLN("calling XineramaGetInfo func on Solaris");
   647             if ((*XineramaSolarisFunc)(awt_display, 0, &fbrects[0],
   639             if ((*XineramaSolarisFunc)(awt_display, 0, &fbrects[0],
   648                                        &fbhints[0], &locNumScr) != 0 &&
   640                                        &fbhints[0], &locNumScr) != 0 &&
   649                 locNumScr > XScreenCount(awt_display))
   641                 locNumScr > XScreenCount(awt_display))
  1573     return JNI_FALSE;
  1565     return JNI_FALSE;
  1574 #else
  1566 #else
  1575     return usingXinerama ? JNI_TRUE : JNI_FALSE;
  1567     return usingXinerama ? JNI_TRUE : JNI_FALSE;
  1576 #endif /* HEADLESS */
  1568 #endif /* HEADLESS */
  1577 }
  1569 }
  1578 
       
  1579 /*
       
  1580  * Can return NULL.
       
  1581  *
       
  1582  * Class:     sun_awt_X11GraphicsEnvironment
       
  1583  * Method:    getXineramaCenterPoint
       
  1584  * Signature: ()Ljava/awt/Point
       
  1585  */
       
  1586 JNIEXPORT jobject JNICALL
       
  1587 Java_sun_awt_X11GraphicsEnvironment_getXineramaCenterPoint(JNIEnv *env,
       
  1588     jobject this)
       
  1589 {
       
  1590     jobject point = NULL;
       
  1591 #ifndef HEADLESS    /* return NULL in HEADLESS, Linux */
       
  1592 #if !defined(__linux__) && !defined(MACOSX)
       
  1593     int x,y;
       
  1594 
       
  1595     AWT_LOCK();
       
  1596     DASSERT(usingXinerama);
       
  1597     if (XineramaSolarisCenterFunc != NULL) {
       
  1598         (XineramaSolarisCenterFunc)(awt_display, 0, &x, &y);
       
  1599         point = JNU_NewObjectByName(env, "java/awt/Point","(II)V", x, y);
       
  1600         DASSERT(point);
       
  1601     } else {
       
  1602         DTRACE_PRINTLN("unable to call XineramaSolarisCenterFunc: symbol is null");
       
  1603     }
       
  1604     AWT_FLUSH_UNLOCK();
       
  1605 #endif /* __linux __ || MACOSX */
       
  1606 #endif /* HEADLESS */
       
  1607     return point;
       
  1608 }
       
  1609 
       
  1610 
  1570 
  1611 /**
  1571 /**
  1612  * Begin DisplayMode/FullScreen support
  1572  * Begin DisplayMode/FullScreen support
  1613  */
  1573  */
  1614 
  1574