~unity-team/qtubuntu/DPR

« back to all changes in this revision

Viewing changes to src/ubuntumirclient/window.cpp

  • Committer: Gerry Boland
  • Date: 2015-08-24 16:38:22 UTC
  • mfrom: (254.1.20 qtubuntu)
  • Revision ID: gerry.boland@canonical.com-20150824163822-y11wubu82on9z429
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
104
104
    MirConnection *connection;
105
105
    MirSurface* surface;
106
106
    QSize bufferSizePx;
107
 
    QSize targetBufferSizePx;
108
107
    QMutex mutex;
109
108
    QSharedPointer<UbuntuClipboard> clipboard;
110
109
};
329
328
    QMutexLocker(&d->mutex);
330
329
 
331
330
    // The current buffer size hasn't actually changed. so just render on it and swap
332
 
    // buffers until we render on a buffer with the target size.
333
 
    d->targetBufferSizePx.rwidth() = widthPx;
334
 
    d->targetBufferSizePx.rheight() = heightPx;
335
 
 
336
 
    if (d->bufferSizePx != d->targetBufferSizePx) {
 
331
    // buffers in the hope that the next buffer will match the surface size advertised
 
332
    // in this event.
 
333
    // But since this event is processed by a thread different from the one that swaps
 
334
    // buffers, you can never know if this information is already outdated as there's
 
335
    // no synchronicity whatsoever between the processing of resize events and the
 
336
    // consumption of buffers.
 
337
    if (d->bufferSizePx.width() != widthPx || d->bufferSizePx.height() != heightPx) {
337
338
        QWindowSystemInterface::handleExposeEvent(window(), geometry());
338
 
    } else {
339
 
        qWarning("[ubuntumirclient QPA] UbuntuWindow::handleSurfaceResize"
340
 
                 " current buffer already has the target size");
341
 
        d->targetBufferSizePx = QSize();
 
339
        QWindowSystemInterface::flushWindowSystemEvents();
342
340
    }
343
341
}
344
342
 
445
443
 
446
444
        QPlatformWindow::setGeometry(newGeometry);
447
445
        QWindowSystemInterface::handleGeometryChange(window(), newGeometry, QRect());
448
 
        QWindowSystemInterface::handleExposeEvent(window(), newGeometry);
449
 
 
450
 
    } else {
451
 
        // buffer size hasn't changed
452
 
        if (d->targetBufferSizePx.isValid()) {
453
 
            if (d->bufferSizePx != d->targetBufferSizePx) {
454
 
                // but we still didn't reach the promised buffer size from the mir resize event.
455
 
                // thus keep swapping buffers
456
 
                QWindowSystemInterface::handleExposeEvent(window(), geometry());
457
 
            } else {
458
 
                // target met. we have just provided a render with the target size and
459
 
                // can therefore finally rest.
460
 
                d->targetBufferSizePx = QSize();
461
 
            }
462
 
        }
463
446
    }
464
447
}