~mzanetti/unity8/spread-blur

« back to all changes in this revision

Viewing changes to tests/mocks/Unity/Application/MirSurfaceItem.cpp

  • Committer: Bileto Bot
  • Author(s): Michael Zanetti
  • Date: 2016-10-24 11:34:08 UTC
  • mfrom: (2400.6.204 unity8-unified-spread)
  • Revision ID: ci-train-bot@canonical.com-20161024113408-7ul8ivww68dqm74v
Merge all Stages into one single codebase. Apply new spread visuals.

This deletes PhoneStage, TabletStage and DesktopStage, and merges all of the functionality into Stage. Also the spread visuals have been updated by design to work with all usage modes. (LP: #1489517, #1603914, #1635800)

Approved by: Lukáš Tinkl

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
 
61
61
    connect(this, &QQuickItem::activeFocusChanged, this, &MirSurfaceItem::updateMirSurfaceActiveFocus);
62
62
    connect(this, &QQuickItem::visibleChanged, this, &MirSurfaceItem::updateMirSurfaceVisibility);
 
63
 
63
64
    connect(this, &MirSurfaceItem::consumesInputChanged, this, [this]() {
64
65
        updateMirSurfaceActiveFocus(hasActiveFocus());
65
66
    });
 
67
 
 
68
    // We're just clipping contents in the mock. The real QtMir would copy only relevant buffer instead
 
69
    setClip(true);
66
70
}
67
71
 
68
72
MirSurfaceItem::~MirSurfaceItem()
181
185
    m_qmlItem = qobject_cast<QQuickItem*>(m_qmlContentComponent->create());
182
186
    m_qmlItem->setParentItem(this);
183
187
 
 
188
    m_qmlItem->setWidth(m_surfaceWidth);
 
189
    m_qmlItem->setHeight(m_surfaceHeight);
 
190
 
184
191
    setImplicitWidth(m_qmlItem->implicitWidth());
185
192
    setImplicitHeight(m_qmlItem->implicitHeight());
186
193
 
350
357
 
351
358
void MirSurfaceItem::setSurfaceWidth(int value)
352
359
{
 
360
//    qDebug() << "setSurfaceWidth called" << value;
353
361
    if (value != -1 && m_surfaceWidth != value) {
354
362
        m_surfaceWidth = value;
355
363
        Q_EMIT surfaceWidthChanged(m_surfaceWidth);
375
383
{
376
384
    if (m_qmlSurface && m_surfaceWidth > 0 && m_surfaceHeight > 0) {
377
385
        m_qmlSurface->resize(m_surfaceWidth, m_surfaceHeight);
 
386
        if (m_qmlItem) {
 
387
            m_qmlItem->setWidth(m_surfaceWidth);
 
388
            m_qmlItem->setHeight(m_surfaceHeight);
 
389
        }
 
390
        setImplicitSize(m_surfaceWidth, m_surfaceHeight);
378
391
    }
379
392
}
380
393