コード例 #1
0
ファイル: qopenkodewindow.cpp プロジェクト: sicily/qt4.8.4
QOpenKODEWindow::~QOpenKODEWindow()
{
    if (m_platformGlContext != static_cast<QOpenKODEIntegration *>(QApplicationPrivate::platformIntegration())) {
        delete m_platformGlContext;
    }
    if (m_kdWindow)
        kdDestroyWindow(m_kdWindow);
}
コード例 #2
0
ファイル: KDWindow.c プロジェクト: 465060874/jogl
JNIEXPORT jint JNICALL Java_jogamp_newt_driver_kd_WindowDriver_CloseWindow
  (JNIEnv *env, jobject obj, jlong window, jlong juserData)
{
    KDWindow *w = (KDWindow*) (intptr_t) window;
    JOGLKDUserdata * userData = (JOGLKDUserdata*) (intptr_t) juserData;
    int res = kdDestroyWindow(w);
    (*env)->DeleteGlobalRef(env, userData->javaWindow);
    kdFree(userData);

    DBG_PRINT( "[CloseWindow] res: %d\n", res);
    return res;
}
コード例 #3
0
ファイル: WinSystemEGL.cpp プロジェクト: Kr0nZ/boxee
bool CWinSystemEGL::DestroyWindow()
{
  EGLBoolean eglStatus;
  if (m_context != EGL_NO_CONTEXT)
  {
    eglStatus = eglDestroyContext(m_display, m_context);
    if (!eglStatus)
      CLog::Log(LOGERROR, "Error destroying EGL context");
    m_context = EGL_NO_CONTEXT;
  }

  if (m_surface != EGL_NO_SURFACE)
  {
    eglStatus = eglDestroySurface(m_display, m_surface);
    if (!eglStatus)
      CLog::Log(LOGERROR, "Error destroying EGL surface");
    m_surface = EGL_NO_SURFACE;
  }

  if (m_display != EGL_NO_DISPLAY)
  {
    eglStatus = eglTerminate(m_display);
    if (!eglStatus)
      CLog::Log(LOGERROR, "Error terminating EGL");
    m_display = EGL_NO_DISPLAY;
  }

#ifdef HAS_OPENKODE
  if (m_kdWindow)
  {
    if (kdDestroyWindow(m_kdWindow))
      CLog::Log(LOGERROR, "Error destroying native window");

    m_kdWindow = KD_NULL;
    m_nativeWindow = (NativeWindowType)0;
  }

  // Release display
  if (m_kdDisplay)
  {
    if (kdReleaseDisplayNV(m_kdDisplay))
      CLog::Log(LOGERROR, "Error destroying native display");
    m_kdDisplay = KD_NULL;
  }
#endif

  return true;
}
コード例 #4
0
ファイル: qopenkodewindow.cpp プロジェクト: sicily/qt4.8.4
QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw)
    : QPlatformWindow(tlw), isFullScreen(false)
{
    if (tlw->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenVG) {
        m_eglApi = EGL_OPENVG_API;
    } else {
        m_eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION);
        m_eglContextAttrs.append(2);

        m_eglApi = EGL_OPENGL_ES_API;
    }
    eglBindAPI(m_eglApi);

    m_eglContextAttrs.append(EGL_NONE);
    m_eglWindowAttrs.append(EGL_NONE);

    QList<QPlatformScreen *> screens = QApplicationPrivate::platformIntegration()->screens();
    //XXXX: jl figure out how to pick the correct screen.
//    Q_ASSERT(screens.size() > tlw->d_func()->screenNumber);
//    QOpenKODEScreen *screen = qobject_cast<QOpenKODEScreen *>(screens.at(tlw->d_func()->screenNumber));
    QOpenKODEScreen *screen = qobject_cast<QOpenKODEScreen *>(screens.at(0));
    if (!screen) {
        qErrnoWarning("Could not make QOpenKODEWindow without a screen");
    }

    QPlatformWindowFormat format = tlw->platformWindowFormat();
    format.setRedBufferSize(5);
    format.setGreenBufferSize(6);
    format.setBlueBufferSize(5);

    m_eglConfig = q_configFromQPlatformWindowFormat(screen->eglDisplay(),format);

    m_kdWindow = kdCreateWindow(screen->eglDisplay(),
                              m_eglConfig,
                              this);
    kdInstallCallback(kdProcessMouseEvents,KD_EVENT_INPUT_POINTER,this);
#ifdef KD_ATX_keyboard
    kdInstallCallback(kdProcessKeyEvents, KD_EVENT_INPUT_KEY_ATX,this);
#endif //KD_ATX_keyboard

    if (!m_kdWindow) {
        qErrnoWarning(kdGetError(), "Error creating native window");
        return;
    }

    KDboolean exclusive(false);
    if (kdSetWindowPropertybv(m_kdWindow,KD_WINDOWPROPERTY_DESKTOP_EXCLUSIVE_NV, &exclusive)) {
        isFullScreen = true;
    }

    if (isFullScreen) {
        tlw->setGeometry(screen->geometry());
        screen->setFullScreen(isFullScreen);
    }else {
        const KDint windowSize[2]  = { tlw->width(), tlw->height() };
        if (kdSetWindowPropertyiv(m_kdWindow, KD_WINDOWPROPERTY_SIZE, windowSize)) {
            qErrnoWarning(kdGetError(), "Could not set native window size");
        }
        KDboolean visibillity(false);
        if (kdSetWindowPropertybv(m_kdWindow, KD_WINDOWPROPERTY_VISIBILITY, &visibillity)) {
            qErrnoWarning(kdGetError(), "Could not set visibillity to false");
        }

        const KDint windowPos[2] = { tlw->x(), tlw->y() };
        if (kdSetWindowPropertyiv(m_kdWindow, KD_WINDOWPROPERTY_DESKTOP_OFFSET_NV, windowPos)) {
            qErrnoWarning(kdGetError(), "Could not set native window position");
            return;
        }
    }


    QOpenKODEIntegration *integration = static_cast<QOpenKODEIntegration *>(QApplicationPrivate::platformIntegration());

    if (!isFullScreen || (isFullScreen && !integration->mainGLContext())) {
        if (kdRealizeWindow(m_kdWindow, &m_eglWindow)) {
            qErrnoWarning(kdGetError(), "Could not realize native window");
            return;
        }

        EGLSurface surface = eglCreateWindowSurface(screen->eglDisplay(),m_eglConfig,m_eglWindow,m_eglWindowAttrs.constData());
        m_platformGlContext = new QEGLPlatformContext(screen->eglDisplay(), m_eglConfig,
                                                      m_eglContextAttrs.data(), surface, m_eglApi);
        integration->setMainGLContext(m_platformGLContext);
    } else {
        m_platformGlContext = integration->mainGLContext();
        kdDestroyWindow(m_kdWindow);
        m_kdWindow = 0;
    }
}