// USER int emulator::run(char const *prg_name, char const *args, int *ret_ptr, int stack_size) { DEBUG(3) dprintf("emulator::run() called. this=%p, prg_name='%s', args='%s', ret_ptr=%p, stack_size=%d\n", this, prg_name, args, ret_ptr, stack_size); int retc; context *ctx = getContext(); if(!ctx) return ENOMEM; retc = ctx->init_run(prg_name, args, stack_size); if(retc) { deleteContext(ctx); return retc; } message *msg = new message(ctx); if(!msg) { deleteContext(ctx); return ENOMEM; } msg->setCmd(message::RUN_CMD); msg->sendToEmulator(); doEvents(ctx); delete msg; retc = ctx->getRetVal(); deleteContext(ctx); return retc; }
void OpenGLComponent::updateContext() { if (needToDeleteContext) deleteContext(); if (context == nullptr) { const ScopedLock sl (contextLock); if (context == nullptr) { context = createContext(); if (context != nullptr) { #if JUCE_LINUX if (! isUsingDedicatedThread()) #endif updateContextPosition(); if (context->makeActive()) { newOpenGLContextCreated(); context->makeInactive(); } } } } }
void GraphicsContext3DInternal::reshape(int width, int height) { LOGWEBGL("reshape(%d, %d)", width, height); bool mustRestoreFBO = (m_boundFBO != (m_currentFBO ? m_currentFBO->fbo() : 0)); m_width = width > m_maxwidth ? m_maxwidth : width; m_height = height > m_maxheight ? m_maxheight : height; stopSyncThread(); makeContextCurrent(); m_proxy->setGraphicsContext(0); { MutexLocker lock(m_fboMutex); deleteContext(false); if (createContext(false)) { if (!mustRestoreFBO) { m_boundFBO = m_currentFBO->fbo(); } glBindFramebuffer(GL_FRAMEBUFFER, m_boundFBO); } } m_proxy->setGraphicsContext(this); startSyncThread(); }
bool GraphicsContext3DInternal::createContext(bool createEGLContext) { LOGWEBGL("createContext()"); if (createEGLContext) { const EGLint context_attribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE }; const EGLint surface_attribs[] = { EGL_WIDTH, 1, EGL_HEIGHT, 1, EGL_NONE }; m_surface = eglCreatePbufferSurface(m_dpy, m_config, surface_attribs); EGLContext context = EGL_NO_CONTEXT; #if USE(SHARED_TEXTURE_WEBGL) context = TilesManager::instance()->getEglContext(); #endif m_context = eglCreateContext(m_dpy, m_config, context, context_attribs); } if (m_context == EGL_NO_CONTEXT) { deleteContext(createEGLContext); return false; } makeContextCurrent(); for (int i = 0; i < NUM_BUFFERS; i++) { FBO* tmp = FBO::createFBO(m_dpy, m_width > 0 ? m_width : 1, m_height > 0 ? m_height : 1, m_attrs); if (tmp == 0) { LOGWEBGL("Failed to create FBO"); deleteContext(createEGLContext); return false; } m_fbo[i] = tmp; //[CAPPFIX_WEB_WEBGL] - Handle FBO creation failure m_nfbo++; //[CAPPFIX_WEB_WEBGL_END] m_freeBuffers.append(tmp); } m_currentFBO = dequeueBuffer(); m_boundFBO = m_currentFBO->fbo(); m_frontFBO = 0; glBindFramebuffer(GL_FRAMEBUFFER, m_boundFBO); return true; }
OpenGLComponent::~OpenGLComponent() { if (isUsingDedicatedThread()) stopBackgroundThread(); else deleteContext(); componentWatcher = nullptr; }
void Sys_KillWindow(void) { deleteContext(g_Window.glctx); g_Window.glctx = 0; DisposeWindow((WindowPtr)g_Window.window); g_Window.window = 0; if (g_Player != NULL) { free(g_Player); } }
void OpenGLComponent::stopRenderThread() { if (renderThread != nullptr) { renderThread->stopThread (5000); renderThread = nullptr; } #if ! JUCE_LINUX deleteContext(); #endif }
void GraphicsContext3DInternal::releaseSurface() { LOGWEBGL("releaseSurface(%d)", m_contextId); if (m_currentFBO == 0) // We don't have any current surface return; stopSyncThread(); m_proxy->setGraphicsContext(0); { MutexLocker lock(m_fboMutex); deleteContext(false); } makeContextCurrent(); m_proxy->setGraphicsContext(this); }
GraphicsContext3DInternal::~GraphicsContext3DInternal() { LOGWEBGL("~GraphicsContext3DInternal(), this = %p", this); stopSyncThread(); m_proxy->setGraphicsContext(0); MutexLocker lock(m_fboMutex); SkSafeUnref(m_compositingLayer); m_compositingLayer = 0; deleteContext(true); JNIEnv* env = JSC::Bindings::getJNIEnv(); env->DeleteGlobalRef(m_webView); //[CAPPFIX_WEB_WEBGL] - for WebGL Conformance Test --contextCounter; //[CAPPFIX_WEB_WEBGL_END] }
OpenGLComponent::~OpenGLComponent() { if (isUsingDedicatedThread()) { /* If you're using a background thread, then your sub-class MUST call stopRenderThread() in its destructor! Otherwise, the thread could still be running while your sub-class isbeing destroyed, and so may make a call to your subclass's renderOpenGL() method when it no longer exists! */ jassert (renderThread == nullptr); stopRenderThread(); } else { deleteContext(); } componentWatcher = nullptr; }
// Настройка возможных действий void RecordTableScreen::setupActions(void) { // Добавление записи // a->setShortcut(tr("Ctrl+X")); actionAddNewToEnd = new QAction(tr("Add note"), this); actionAddNewToEnd->setStatusTip(tr("Add a new note")); actionAddNewToEnd->setIcon(QIcon(":/resource/pic/note_add.svg")); connect(actionAddNewToEnd, SIGNAL(triggered()), recordTableController, SLOT(addNewToEndContext())); // Добавление записи до actionAddNewBefore = new QAction(tr("Add note before"), this); actionAddNewBefore->setStatusTip(tr("Add a note before selected")); connect(actionAddNewBefore, SIGNAL(triggered()), recordTableController, SLOT(addNewBeforeContext())); // Добавление записи после actionAddNewAfter = new QAction(tr("Add note after"), this); actionAddNewAfter->setStatusTip(tr("Add a note after selected")); connect(actionAddNewAfter, SIGNAL(triggered()), recordTableController, SLOT(addNewAfterContext())); // Редактирование записи actionEditField = new QAction(tr("Edit properties (name, author, tags...)"), this); actionEditField->setStatusTip(tr("Edit note properties (name, author, tags...)")); actionEditField->setIcon(QIcon(":/resource/pic/note_edit.svg")); connect(actionEditField, SIGNAL(triggered()), recordTableController, SLOT(onEditFieldContext())); // Блокировка записи actionBlock = new QAction(tr("Block/Unblock note"), this); actionBlock->setStatusTip(tr("Block or unblock change note")); actionBlock->setIcon(QIcon(":/resource/pic/note_block.svg")); connect(actionBlock, SIGNAL(triggered()), recordTableController, SLOT(onBlockContext())); // Удаление записи actionDelete = new QAction(tr("Delete note(s)"), this); actionDelete->setStatusTip(tr("Delete note(s)")); actionDelete->setIcon(QIcon(":/resource/pic/note_delete.svg")); connect(actionDelete, SIGNAL(triggered()), recordTableController, SLOT(deleteContext())); // Удаление записи с копированием в буфер обмена actionCut = new QAction(tr("&Cut note(s)"), this); actionCut->setStatusTip(tr("Cut notes(s) to clipboard")); actionCut->setIcon(QIcon(":/resource/pic/cb_cut.svg")); connect(actionCut, SIGNAL(triggered()), recordTableController, SLOT(cut())); // Копирование записи (записей) в буфер обмена actionCopy = new QAction(tr("&Copy note(s)"), this); actionCopy->setStatusTip(tr("Copy note(s) to clipboard")); actionCopy->setIcon(QIcon(":/resource/pic/cb_copy.svg")); connect(actionCopy, SIGNAL(triggered()), recordTableController, SLOT(copy())); // Вставка записи из буфера обмена actionPaste = new QAction(tr("&Paste note(s)"), this); actionPaste->setStatusTip(tr("Paste note(s) from clipboard")); actionPaste->setIcon(QIcon(":/resource/pic/cb_paste.svg")); connect(actionPaste, SIGNAL(triggered()), recordTableController, SLOT(paste())); // Настройка внешнего вида таблицы конечных записей actionSettings = new QAction(tr("&View settings"), this); actionSettings->setStatusTip(tr("Setup table view settins")); actionSettings->setIcon(QIcon(":/resource/pic/edit_settings.svg")); connect(actionSettings, SIGNAL(triggered()), recordTableController, SLOT(settings())); // Перемещение записи вверх actionMoveUp = new QAction(tr("&Move Up"), this); actionMoveUp->setStatusTip(tr("Move note up")); actionMoveUp->setIcon(QIcon(":/resource/pic/move_up.svg")); connect(actionMoveUp, SIGNAL(triggered()), recordTableController, SLOT(moveUp())); // Перемещение записи вниз actionMoveDn=new QAction(tr("&Move Down"), this); actionMoveDn->setStatusTip(tr("Move note down")); actionMoveDn->setIcon(QIcon(":/resource/pic/move_dn.svg")); connect(actionMoveDn, SIGNAL(triggered()), recordTableController, SLOT(moveDn())); // Поиск по базе (клик связывается с действием в MainWindow) actionFindInBase=new QAction(tr("Find in base"), this); actionFindInBase->setStatusTip(tr("Find in base")); actionFindInBase->setIcon(QIcon(":/resource/pic/find_in_base.svg")); // Синхронизация actionSyncro=new QAction(tr("Synchronization"), this); actionSyncro->setStatusTip(tr("Run synchronization")); actionSyncro->setIcon(QIcon(":/resource/pic/synchronization.svg")); connect(actionSyncro, SIGNAL(triggered()), this, SLOT(onSyncroClick())); // Перемещение по истории посещаемых записей назад actionWalkHistoryPrevious=new QAction(tr("Previous viewing note"), this); actionWalkHistoryPrevious->setShortcut(tr("Ctrl+<")); actionWalkHistoryPrevious->setStatusTip(tr("Previous note has been viewing")); actionWalkHistoryPrevious->setIcon(QIcon(":/resource/pic/walk_history_previous.svg")); connect(actionWalkHistoryPrevious, SIGNAL(triggered()), this, SLOT(onWalkHistoryPreviousClick())); // Перемещение по истории посещаемых записей вперед actionWalkHistoryNext=new QAction(tr("Next viewing note"), this); actionWalkHistoryNext->setShortcut(tr("Ctrl+>")); actionWalkHistoryNext->setStatusTip(tr("Next note has been viewing")); actionWalkHistoryNext->setIcon(QIcon(":/resource/pic/walk_history_next.svg")); connect(actionWalkHistoryNext, SIGNAL(triggered()), this, SLOT(onWalkHistoryNextClick())); // Кнопка Назад (Back) в мобильном интерфейсе actionBack=new QAction(tr("Back to item tree"), this); actionBack->setStatusTip(tr("Back to item tree")); actionBack->setIcon(QIcon(":/resource/pic/mobile_back.svg")); connect(actionBack, SIGNAL(triggered()), this, SLOT(onBackClick())); // Действия по сортировке actionSort = new QAction(tr("Toggle sorting"), this); actionSort->setStatusTip(tr("Enable/disable sorting by column")); actionSort->setIcon(QIcon(":/resource/pic/sort.svg")); connect(actionSort, SIGNAL(triggered()), recordTableController, SLOT(onSortClick())); // Кнопка вызова печати таблицы конечных записей actionPrint = new QAction(tr("Print table"), this); actionPrint->setStatusTip(tr("Print current notes table")); actionPrint->setIcon(QIcon(":/resource/pic/print_table.svg")); connect(actionPrint, SIGNAL(triggered()), recordTableController, SLOT(onPrintClick())); // Кнопка копирования ссылки на запись actionCopyRecordReference = new QAction(tr("Copy note reference"), this); actionCopyRecordReference->setStatusTip(tr("Copy note reference to clipboard")); actionCopyRecordReference->setIcon(QIcon(":/resource/pic/note_reference.svg")); connect(actionCopyRecordReference, SIGNAL(triggered()), this, SLOT(onCopyRecordReference())); // Кнопка переключения режима одинарного выбора и мультивыбора actionSwitchSelectionMode = new QAction(tr("Switch select/multiselect"), this); actionSwitchSelectionMode->setStatusTip(tr("Switch note selection mode (Notice: if multiselect is on, drag-and-drop is disabled)")); actionSwitchSelectionMode->setIcon(QIcon(":/resource/pic/switch_note_selection_mode.svg")); connect(actionSwitchSelectionMode, SIGNAL(triggered()), recordTableController, SLOT(onSwitchSelectionMode())); // Сразу после создания все действия запрещены disableAllActions(); }