void Workspace::lowerClient( Client* c, bool nogroup ) { if ( !c ) return; if( c->isTopMenu()) return; c->cancelAutoRaise(); StackingUpdatesBlocker blocker( this ); unconstrained_stacking_order.removeAll( c ); unconstrained_stacking_order.prepend( c ); if( !nogroup && c->isTransient() ) { // lower also all windows in the group, in their reversed stacking order ClientList wins = ensureStackingOrder( c->group()->members()); for( int i = wins.size() - 1; i >= 0; --i ) { if( wins[ i ] != c ) lowerClient( wins[ i ], true ); } } if ( c == most_recently_raised ) most_recently_raised = 0; }
void NaviHeightmap::update(const vector<IBox> &walkable, const vector<IBox> &blockers) { m_level_count = 0; m_data.clear(); PodArray<IBox> bboxes(walkable.size()); for(int n = 0; n < bboxes.size(); n++) { IBox bbox = walkable[n]; bboxes[n] = { vmax(bbox.min(), int3(0, 0, 0)), vmin(bbox.max(), int3(m_size.x, 255, m_size.y))}; } std::sort(bboxes.data(), bboxes.end(), [](const IBox &a, const IBox &b) { return a.y() == b.y()? a.x() == b.x()? a.z() < b.z() : a.x() < b.x() : a.y() < b.y(); } ); for(int n = 0; n < bboxes.size(); n++) { const IBox &bbox = bboxes[n]; int min_y = bbox.y(), max_y = bbox.ey(); for(int z = 0; z < bbox.depth(); z++) for(int x = 0; x < bbox.width(); x++) { int level = 0; int px = x + bbox.x(); int pz = z + bbox.z(); while(level < m_level_count) { int value = m_data[index(px, pz, level)]; if(value == invalid_value || value >= min_y - 4) break; level++; } if(level == m_level_count) { if(level == max_levels) continue; addLevel(); } m_data[index(px, pz, level)] = max_y; } } for(int n = 0; n < (int)blockers.size(); n++) { IBox blocker( vmax(blockers[n].min(), int3(0, 0, 0)), vmin(blockers[n].max(), int3(m_size.x, 255, m_size.y))); u8 min_y = max(0, blocker.y() - 4), max_y = blocker.ey(); for(int z = 0; z < blocker.depth(); z++) for(int x = 0; x < blocker.width(); x++) { int level = 0; int px = x + blocker.x(); int pz = z + blocker.z(); while(level < m_level_count) { u8 &value = m_data[index(px, pz, level++)]; if(value >= min_y && value <= max_y) value = invalid_value; } } } }
void Workspace::lowerClientWithinApplication( Client* c ) { if ( !c ) return; if( c->isTopMenu()) return; c->cancelAutoRaise(); StackingUpdatesBlocker blocker( this ); unconstrained_stacking_order.removeAll( c ); bool lowered = false; // first try to put it below the bottom-most window of the application for( ClientList::Iterator it = unconstrained_stacking_order.begin(); it != unconstrained_stacking_order.end(); ++it ) if( Client::belongToSameApplication( *it, c )) { unconstrained_stacking_order.insert( it, c ); lowered = true; break; } if( !lowered ) unconstrained_stacking_order.prepend( c ); // ignore mainwindows }
JSObject* EvalExecutable::compileInternal(ExecState* exec, ScopeChainNode* scopeChainNode, JITCode::JITType jitType) { SamplingRegion samplingRegion(jitType == JITCode::BaselineJIT ? "Baseline Compilation (TOTAL)" : "DFG Compilation (TOTAL)"); #if !ENABLE(JIT) UNUSED_PARAM(jitType); #endif JSObject* exception = 0; JSGlobalData* globalData = &exec->globalData(); JSGlobalObject* lexicalGlobalObject = exec->lexicalGlobalObject(); if (!!m_evalCodeBlock && m_evalCodeBlock->canProduceCopyWithBytecode()) { BytecodeDestructionBlocker blocker(m_evalCodeBlock.get()); OwnPtr<EvalCodeBlock> newCodeBlock = adoptPtr(new EvalCodeBlock(CodeBlock::CopyParsedBlock, *m_evalCodeBlock)); newCodeBlock->setAlternative(static_pointer_cast<CodeBlock>(m_evalCodeBlock.release())); m_evalCodeBlock = newCodeBlock.release(); } else { if (!lexicalGlobalObject->evalEnabled()) return throwError(exec, createEvalError(exec, "Eval is disabled")); RefPtr<EvalNode> evalNode = parse<EvalNode>(globalData, lexicalGlobalObject, m_source, 0, isStrictMode() ? JSParseStrict : JSParseNormal, EvalNode::isFunctionNode ? JSParseFunctionCode : JSParseProgramCode, lexicalGlobalObject->debugger(), exec, &exception); if (!evalNode) { ASSERT(exception); return exception; } recordParse(evalNode->features(), evalNode->hasCapturedVariables(), evalNode->lineNo(), evalNode->lastLine()); JSGlobalObject* globalObject = scopeChainNode->globalObject.get(); OwnPtr<CodeBlock> previousCodeBlock = m_evalCodeBlock.release(); ASSERT((jitType == JITCode::bottomTierJIT()) == !previousCodeBlock); m_evalCodeBlock = adoptPtr(new EvalCodeBlock(this, globalObject, source().provider(), scopeChainNode->localDepth(), previousCodeBlock.release())); OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(evalNode.get(), scopeChainNode, m_evalCodeBlock->symbolTable(), m_evalCodeBlock.get(), !!m_evalCodeBlock->alternative() ? OptimizingCompilation : FirstCompilation))); if ((exception = generator->generate())) { m_evalCodeBlock = static_pointer_cast<EvalCodeBlock>(m_evalCodeBlock->releaseAlternative()); evalNode->destroyData(); return exception; } evalNode->destroyData(); m_evalCodeBlock->copyPostParseDataFromAlternative(); } #if ENABLE(JIT) if (!jitCompileIfAppropriate(*globalData, m_evalCodeBlock, m_jitCodeForCall, jitType)) return 0; #endif #if ENABLE(JIT) #if ENABLE(INTERPRETER) if (!m_jitCodeForCall) Heap::heap(this)->reportExtraMemoryCost(sizeof(*m_evalCodeBlock)); else #endif Heap::heap(this)->reportExtraMemoryCost(sizeof(*m_evalCodeBlock) + m_jitCodeForCall.size()); #else Heap::heap(this)->reportExtraMemoryCost(sizeof(*m_evalCodeBlock)); #endif return 0; }
void MainWindow::changeFilterSelectorsOrder(QList<std::tuple<int, int> > filtersInfo) { QSignalBlocker blocker(draggableBehaviour); auto boxlayout = static_cast<QHBoxLayout*> (ui->horizontalLayout); QList<QLayoutItem*> items; for(std::tuple<int, int> groupAndType : filtersInfo) { int group = std::get<0>(groupAndType); int type = std::get<1>(groupAndType); auto rowsCount = boxlayout->count(); for(auto row = 0; row < rowsCount; ++row) { auto checkboxItem = boxlayout->itemAt(row); if(checkboxItem->widget()->property("group") == group && checkboxItem->widget()->property("type") == type) { items.append(boxlayout->takeAt(row)); break; } } }; for(auto item : items) { boxlayout->addItem(item); } }
void FindToolBar::updateFromFindClipboard() { if (QApplication::clipboard()->supportsFindBuffer()) { QSignalBlocker blocker(m_ui.findEdit); setFindText(QApplication::clipboard()->text(QClipboard::FindBuffer)); } }
PassRefPtr<SVGPropertyBase> SVGAnimatedTypeAnimator::startAnimValAnimation(const WillBeHeapVector<RawPtrWillBeMember<SVGElement> >& list) { ASSERT(isAnimatingSVGDom()); SVGElement::InstanceUpdateBlocker blocker(m_contextElement); return resetAnimation(list); }
void VideoDisplay::UpdateSize() { auto provider = con->project->VideoProvider(); if (!provider || !IsShownOnScreen()) return; videoSize.Set(provider->GetWidth(), provider->GetHeight()); videoSize *= zoomValue; if (con->videoController->GetAspectRatioType() != AspectRatio::Default) videoSize.SetWidth(videoSize.GetHeight() * con->videoController->GetAspectRatioValue()); wxEventBlocker blocker(this); if (freeSize) { wxWindow *top = GetParent(); while (!top->IsTopLevel()) top = top->GetParent(); wxSize cs = GetClientSize(); wxSize oldSize = top->GetSize(); top->SetSize(top->GetSize() + videoSize / scale_factor - cs); SetClientSize(cs + top->GetSize() - oldSize); } else { SetMinClientSize(videoSize / scale_factor); SetMaxClientSize(videoSize / scale_factor); GetGrandParent()->Layout(); } PositionVideo(); }
void BackGroundPropertyGridWidget::OpenSpriteDialog() { // Pack all available sprites each time user open sprite dialog ResourcePacker *resPacker = new ResourcePacker(); resPacker->PackResources(ResourcesManageHelper::GetSpritesDatasourceDirectory().toStdString(), ResourcesManageHelper::GetSpritesDirectory().toStdString()); // Get sprites directory to open QString currentSpriteDir = ResourcesManageHelper::GetDefaultSpritesPath(this->ui->spriteLineEdit->text()); // Get sprite path from file dialog QString spriteName = QFileDialog::getOpenFileName( this, tr( "Choose a sprite file" ), currentSpriteDir, tr( "Sprites (*.txt)" ) ); if(!spriteName.isNull() && !spriteName.isEmpty()) { // Convert file path into Unix-style path spriteName = ResourcesManageHelper::ConvertPathToUnixStyle(spriteName); if (ResourcesManageHelper::ValidateResourcePath(spriteName)) { WidgetSignalsBlocker blocker(ui->spriteLineEdit); // Sprite name should be pre-processed to use relative path. ui->spriteLineEdit->setText(PreprocessSpriteName(spriteName)); HandleLineEditEditingFinished(ui->spriteLineEdit); } else { ResourcesManageHelper::ShowErrorMessage(spriteName); } } SafeDelete(resPacker); }
// This takes care of relading the entityDefs and refreshing the scenegraph void ReloadDefs(const cmd::ArgumentList& args) { // Disable screen updates for the scope of this function ui::ScreenUpdateBlocker blocker(_("Processing..."), _("Reloading Defs")); GlobalEntityClassManager().reloadDefs(); }
void BackGroundPropertyGridWidget::OpenSpriteDialog() { // Get sprites directory to open QString currentSpriteDir = ResourcesManageHelper::GetDefaultSpritesPath(this->ui->spriteLineEdit->text()); // Get sprite path from file dialog QString spriteName = QFileDialog::getOpenFileName( this, tr( "Choose a sprite file" ), currentSpriteDir, tr( "Sprites (*.txt)" ) ); if(!spriteName.isNull() && !spriteName.isEmpty()) { // Convert file path into Unix-style path spriteName = ResourcesManageHelper::ConvertPathToUnixStyle(spriteName); if (ResourcesManageHelper::ValidateResourcePath(spriteName)) { WidgetSignalsBlocker blocker(ui->spriteLineEdit); // Sprite name should be pre-processed to use relative path. ui->spriteLineEdit->setText(PreprocessSpriteName(spriteName)); HandleLineEditEditingFinished(ui->spriteLineEdit); // Update max-min values SetStretchCapMaxValues(); } else { ResourcesManageHelper::ShowErrorMessage(spriteName); } } }
void SComm::EndLoading() { is_connected = FALSE; NormalCallCount blocker(this); if(parent) parent->EndLoading(); }
void Map::onResourceRealise() { if (m_resource == NULL) { return; } if (isUnnamed() || !m_resource->load()) { // Map is unnamed or load failed, reset map resource node to empty m_resource->setNode(NewMapRoot("")); MapFilePtr map = Node_getMapFile(m_resource->getNode()); if (map != NULL) { map->save(); } // Rename the map to "unnamed" in any case to avoid overwriting the failed map setMapName(_(MAP_UNNAMED_STRING)); } // Take the new node and insert it as map root GlobalSceneGraph().setRoot(m_resource->getNode()); // Associate the Scenegaph with the global RenderSystem // This usually takes a while since all editor textures are loaded - display a dialog to inform the user { ui::ScreenUpdateBlocker blocker(_("Processing..."), _("Loading textures..."), true); // force display GlobalSceneGraph().root()->setRenderSystem(boost::dynamic_pointer_cast<RenderSystem>( module::GlobalModuleRegistry().getModule(MODULE_RENDERSYSTEM))); } AutoSaver().clearChanges(); setValid(true); }
void VideoDisplay::UpdateSize() { if (!con->videoController->IsLoaded() || !IsShownOnScreen()) return; videoSize.Set(con->videoController->GetWidth(), con->videoController->GetHeight()); videoSize *= zoomValue; if (con->videoController->GetAspectRatioType() != 0) videoSize.SetWidth(videoSize.GetHeight() * con->videoController->GetAspectRatioValue()); wxEventBlocker blocker(this); if (freeSize) { wxWindow *top = GetParent(); while (!top->IsTopLevel()) top = top->GetParent(); wxSize cs = GetClientSize(); wxSize oldSize = top->GetSize(); top->SetSize(top->GetSize() + videoSize - cs); SetClientSize(cs + top->GetSize() - oldSize); } else { SetMinClientSize(videoSize); SetMaxClientSize(videoSize); GetGrandParent()->Layout(); } PositionVideo(); }
void NetPlaySetupDialog::PopulateGameList() { QSignalBlocker blocker(m_host_games); m_host_games->clear(); for (int i = 0; i < m_game_list_model->rowCount(QModelIndex()); i++) { auto title = m_game_list_model->GetUniqueIdentifier(i); auto path = m_game_list_model->GetPath(i); auto* item = new QListWidgetItem(title); item->setData(Qt::UserRole, path); m_host_games->addItem(item); } m_host_games->sortItems(); QString selected_game = Settings::GetQSettings() .value(QStringLiteral("netplay/hostgame"), QStringLiteral("")) .toString(); auto find_list = m_host_games->findItems(selected_game, Qt::MatchFlag::MatchExactly); if (find_list.count() > 0) m_host_games->setCurrentItem(find_list[0]); }
PassOwnPtr<FunctionCodeBlock> FunctionExecutable::produceCodeBlockFor(ScopeChainNode* scopeChainNode, CompilationKind compilationKind, CodeSpecializationKind specializationKind, JSObject*& exception) { if (!!codeBlockFor(specializationKind) && codeBlockFor(specializationKind)->canProduceCopyWithBytecode()) { BytecodeDestructionBlocker blocker(codeBlockFor(specializationKind).get()); return adoptPtr(new FunctionCodeBlock(CodeBlock::CopyParsedBlock, *codeBlockFor(specializationKind))); } exception = 0; JSGlobalData* globalData = scopeChainNode->globalData; JSGlobalObject* globalObject = scopeChainNode->globalObject.get(); RefPtr<FunctionBodyNode> body = parse<FunctionBodyNode>(globalData, globalObject, m_source, m_parameters.get(), isStrictMode() ? JSParseStrict : JSParseNormal, FunctionBodyNode::isFunctionNode ? JSParseFunctionCode : JSParseProgramCode, 0, 0, &exception); if (!body) { ASSERT(exception); return nullptr; } if (m_forceUsesArguments) body->setUsesArguments(); body->finishParsing(m_parameters, m_name); recordParse(body->features(), body->hasCapturedVariables(), body->lineNo(), body->lastLine()); OwnPtr<FunctionCodeBlock> result; ASSERT((compilationKind == FirstCompilation) == !codeBlockFor(specializationKind)); result = adoptPtr(new FunctionCodeBlock(this, FunctionCode, globalObject, source().provider(), source().startOffset(), specializationKind == CodeForConstruct)); OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(body.get(), scopeChainNode, result->symbolTable(), result.get(), compilationKind))); exception = generator->generate(); body->destroyData(); if (exception) return nullptr; result->copyPostParseDataFrom(codeBlockFor(specializationKind).get()); return result.release(); }
void SComm::RequestMoreData() { NormalCallCount blocker(this); if (parent) parent->RequestMoreData(); }
virtual ~wxPyInputStream() { wxPyThreadBlocker blocker(m_block); Py_XDECREF(m_read); Py_XDECREF(m_seek); Py_XDECREF(m_tell); }
void ModelCache::refreshSelectedModels(const cmd::ArgumentList& args) { // Disable screen updates for the scope of this function ui::ScreenUpdateBlocker blocker(_("Processing..."), _("Reloading Models")); // Find all models in the current selection ModelFinder walker; GlobalSelectionSystem().foreachSelected(walker); // Remove the selected models from the cache ModelFinder::ModelPaths models = walker.getModelPaths(); for (ModelFinder::ModelPaths::const_iterator i = models.begin(); i != models.end(); ++i) { ModelMap::iterator found = _modelMap.find(*i); if (found != _modelMap.end()) { _modelMap.erase(found); } } // Traverse the entities and submit a refresh call ModelFinder::Entities entities = walker.getEntities(); for (ModelFinder::Entities::const_iterator i = entities.begin(); i != entities.end(); ++i) { (*i)->refreshModel(); } }
/*! Sets the client's active state to \a act. This function does only change the visual appearance of the client, it does not change the focus setting. Use Workspace::activateClient() or Workspace::requestFocus() instead. If a client receives or looses the focus, it calls setActive() on its own. */ void Client::setActive(bool act) { if (active == act) return; active = act; const int ruledOpacity = active ? rules()->checkOpacityActive(qRound(opacity() * 100.0)) : rules()->checkOpacityInactive(qRound(opacity() * 100.0)); setOpacity(ruledOpacity / 100.0); workspace()->setActiveClient(act ? this : NULL, Allowed); if (active) Notify::raise(Notify::Activate); if (!active) cancelAutoRaise(); if (!active && shade_mode == ShadeActivated) setShade(ShadeNormal); StackingUpdatesBlocker blocker(workspace()); workspace()->updateClientLayer(this); // active windows may get different layer ClientList mainclients = mainClients(); for (ClientList::ConstIterator it = mainclients.constBegin(); it != mainclients.constEnd(); ++it) if ((*it)->isFullScreen()) // fullscreens go high even if their transient is active workspace()->updateClientLayer(*it); if (decoration != NULL) decoration->activeChange(); emit activeChanged(); updateMouseGrab(); updateUrgency(); // demand attention again if it's still urgent workspace()->checkUnredirect(); }
// Find the WM frame surrounding WINDOW. Window frame(Display *display, Window window) { // The idea is that the WM frame surrounding WINDOW is a child of // root. So we simply return the child of root that has WINDOW as // a child. Window root = 0; XWindowAttributes root_attr; bool have_root_attr = false; XErrorBlocker blocker(display); Window w = window; for (;;) { Window parent; Window *children = 0; unsigned int nchildren; Status ok = XQueryTree(display, w, &root, &parent, &children, &nchildren); XFree(children); if (!ok) break; // Not found if (parent == root) return w; // Got it // TVTWM (and other window managers?) cover the root window // entirely with a single (virtual) window. Check for this. if (!have_root_attr) { XGetWindowAttributes(display, root, &root_attr); have_root_attr = true; } XWindowAttributes parent_attr; XGetWindowAttributes(display, parent, &parent_attr); if (parent_attr.width >= root_attr.width && parent_attr.height >= root_attr.height) { // PARENT covers ROOT entirely -- is PARENT the child of ROOT? Window grandparent; Window *uncles = 0; unsigned int nuncles; Status ok = XQueryTree(display, parent, &root, &grandparent, &uncles, &nuncles); XFree(uncles); if (ok && grandparent == root) return w; // Got it } w = parent; } return window; // Not found }
void Tuning::sessionModeChange() { if (!dataModel()) return; QSignalBlocker blocker(this); if (windowState_ == NO_DISPLAY) { setGroup("Minimized"); return; } if (windowState_ == DISPLAY_ONLY) { setGroup("PreviewOnly"); return; } auto _mode = dataModel()->mode(); // Show close button only in screen- and projection setup titleBar_->setCloseButtonVisible( _mode == Session::Mode::SCREENSETUP || _mode == Session::Mode::ARRANGE); switch (_mode) { case Session::Mode::SCREENSETUP: setGroup("FOVSliders"); break; case Session::Mode::ARRANGE: if (windowState_ == ADJUSTMENT_SLIDERS) setGroup( tuning()->projector().setup() == Projector::FREE ? "FreeSetup" : "PeripheralSetup"); if (windowState_ == FOV_SLIDERS) setGroup("FOVSliders"); break; case Session::Mode::BLEND: case Session::Mode::WARP: case Session::Mode::COLORCORRECTION: case Session::Mode::EXPORT: setGroup("PreviewOnly"); break; case Session::Mode::LIVE: /// Generate calibration data for visualizer when switching to live // mode tuning()->visualizer()->generateCalibrationData(); setGroup("PreviewOnly"); break; default: break; } }
void TabSettingsWidget::setTabSettings(const TextEditor::TabSettings& s) { QSignalBlocker blocker(this); ui->tabPolicy->setCurrentIndex(s.m_tabPolicy); ui->tabSize->setValue(s.m_tabSize); ui->indentSize->setValue(s.m_indentSize); ui->continuationAlignBehavior->setCurrentIndex(s.m_continuationAlignBehavior); }
void SComm::SetProgressInformation(ProgressState progress_level, unsigned long progress_info1, const void *progress_info2) { NormalCallCount blocker(this); if(parent) parent->SetProgressInformation(progress_level,progress_info1,progress_info2); }
void Image_controls::on_modulate_spin_box__valueChanged(double value) { int slider_value = static_cast<int>(value * 100.0); Signal_blocker blocker(ui->modulate_spin_box_); ui->modulate_slider_->setValue(slider_value); update_image(); }
void IndirectFitPlotPresenter::updateDataSelection() { MantidQt::API::SignalBlocker<QObject> blocker(m_view); m_view->clearDataSelection(); for (auto i = 0u; i < m_model->numberOfWorkspaces(); ++i) m_view->appendToDataSelection(m_model->getFitDataName(i)); setActiveIndex(0); updateAvailableSpectra(); emitSelectedFitDataChanged(); }
wxPyInputStream(PyObject* fileObj, bool block=true) { m_block = block; wxPyThreadBlocker blocker(m_block); m_read = wxPyGetMethod(fileObj, "read"); m_seek = wxPyGetMethod(fileObj, "seek"); m_tell = wxPyGetMethod(fileObj, "tell"); }
void Image_controls::on_modulate_slider__valueChanged(int value) { double spin_box_value = static_cast<double>(value) / 100.0; Signal_blocker blocker(ui->modulate_slider_); ui->modulate_spin_box_->setValue(spin_box_value); update_image(); }
void Rotation::setRotation(EulerAngles const& _angles) { { QSignalBlocker blocker(this); x_->setValue(_angles.roll().degrees()); y_->setValue(_angles.pitch().degrees()); z_->setValue(_angles.yaw().degrees()); } emit rotationChanged(); }
void BackGroundPropertyGridWidget::RemoveSprite() { //When we pass empty spriteLineEdit to command - this will cause removal of sprite if (!ui->spriteLineEdit->text().isEmpty()) { WidgetSignalsBlocker blocker(ui->spriteLineEdit); ui->spriteLineEdit->setText(""); HandleLineEditEditingFinished(ui->spriteLineEdit); } }