Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void MWindow::paintEvent(QPaintEvent *event)
- {
- Q_D(MWindow);
- #ifdef M_USE_OPENGL
- if (!MApplication::softwareRendering()) {
- MGLES2Renderer::activate(d->glContext);
- }
- #endif // M_USE_OPENGL
- if (d->beforeFirstPaintEvent) {
- d->beforeFirstPaintEvent = false;
- d->disableAutomaticBackgroundRepainting();
- }
- // FIXME: disabled for the meego graphicssystem right now until we have a solution for NB#205680
- if (!isOnDisplay() && !MGraphicsSystemHelper::isRunningMeeGoGraphicsSystem()) {
- // we allow some paint events when we are not visible as we might have a race between
- // the visibility information and the paint events
- if (d->invisiblePaintCounter < d->allowedPaintEventsWhenInvisible) {
- mDebug("MWindow::paintEvent") << "Application is not visible. Paint event allowed nevertheless.";
- ++d->invisiblePaintCounter;
- } else {
- mWarning("MWindow::paintEvent") << "Application is not visible. Paint event discarded. Make sure the application does not paint in the first place.";
- event->accept();
- d->discardedPaintEvent = true;
- return;
- }
- }
- if (isInSwitcher()) {
- if (!d->timeSinceLastPaintInSwitcher.isValid()) {
- d->timeSinceLastPaintInSwitcher.start();
- d->updateIsPending = false;
- } else {
- const int maxFpsInSwitcher = 5;
- const int minDelay = 1000. / maxFpsInSwitcher;
- qint64 msSinceLastPaint = d->timeSinceLastPaintInSwitcher.elapsed();
- if (msSinceLastPaint < minDelay) {
- event->accept();
- if (!d->updateIsPending) {
- // trigger a new paint event as otherwise the screen may not be up to date
- QTimer::singleShot(minDelay, viewport(), SLOT(update()));
- d->updateIsPending = true;
- }
- return;
- } else {
- d->timeSinceLastPaintInSwitcher.restart();
- d->updateIsPending = false;
- }
- }
- }
- QGraphicsView::paintEvent(event);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement