コード例 #1
0
ファイル: Dock.c プロジェクト: do4u-chenyu/jdic
/*
 * Class:     org_jdesktop_jdic_dock_internal_impl_UnixDockService
 * Method:    locateDock
 * Signature: ()Z
 */
JNIEXPORT jboolean JNICALL Java_org_jdesktop_jdic_dock_internal_impl_UnixDockService_locateDock(JNIEnv *env, jclass klass, jstring javaHome)
{
    if (javaHomeStr == NULL) {
	/* there is only one of these, it is ok to not free it for now */
        javaHomeStr = (*env)->GetStringUTFChars(env, javaHome, NULL);
    }

    if (initialized_lock == 0) {
        getAwtLockFunctions(&LockIt, &UnLockIt, &NoFlushUnlockIt, NULL);
        initialized_lock = 1 ;
    }

    (*LockIt)(env);

    /*  Connect to X server  */
    if ( (display = XOpenDisplay(NULL)) == NULL ) {
        fprintf(stderr, "Couldn't connect to X server !\n");
        return JNI_FALSE;
    }

    /*  Get screen number from display structure macro  */
    screen_num     = DefaultScreen(display);

    _NET_WM_STRUT = XInternAtom(display,"_NET_WM_STRUT",False);
    _NET_WM_STRUT_PARTIAL = XInternAtom(display,"_NET_WM_STRUT_PARTIAL",False);

    (*UnLockIt)(env);

    return JNI_TRUE;
}
コード例 #2
0
void PlugletViewMotif::Initialize() {
    PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
	   ("PlugletViewMotif.Initialize\n"));
    JNIEnv *env = PlugletEngine::GetJNIEnv();
    clazz = env->FindClass("sun/awt/motif/MEmbeddedFrame");
    if (!clazz) {
        env->ExceptionDescribe(); 
        return;
    }
    initMID = env->GetMethodID(clazz, "<init>", "(J)V");
    if (!initMID) {
        env->ExceptionDescribe();
        clazz = NULL;
        return;
    }
    getAwtData(&awt_depth, &awt_cmap, &awt_visual, 
               &awt_num_colors, NULL);
    getAwtLockFunctions((void*)&AwtLock, (void*)&AwtUnLock, 
			(void*)&AwtNoFlushUnLock,NULL);
}