~alan-griffiths/miral/fix-1621917

« back to all changes in this revision

Viewing changes to miral-qt/src/modules/Unity/Application/windowmodel.cpp

  • Committer: Alan Griffiths
  • Date: 2016-09-09 13:28:01 UTC
  • mfrom: (320.2.3 miral)
  • Revision ID: alam@octopull.co.uk-20160909132801-1rmrc2tl74qrhhkl
mergeĀ :parent

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
using namespace qtmir;
31
31
 
32
32
WindowModel::WindowModel()
33
 
    : m_focusedWindow(nullptr)
34
33
{
35
34
    auto nativeInterface = dynamic_cast<NativeInterface*>(QGuiApplication::platformNativeInterface());
36
35
 
60
59
    connect(notifier, &WindowModelNotifierInterface::windowFocused,     this, &WindowModel::onWindowFocused,     Qt::QueuedConnection);
61
60
    connect(notifier, &WindowModelNotifierInterface::windowInfoChanged, this, &WindowModel::onWindowInfoChanged, Qt::QueuedConnection);
62
61
    connect(notifier, &WindowModelNotifierInterface::windowsRaised,     this, &WindowModel::onWindowsRaised,     Qt::QueuedConnection);
 
62
    connect(notifier, &WindowModelNotifierInterface::inputMethodWindowAdded,
 
63
            this, &WindowModel::onInputMethodWindowAdded,     Qt::QueuedConnection);
 
64
    connect(notifier, &WindowModelNotifierInterface::inputMethodWindowRemoved,
 
65
            this, &WindowModel::onInputMethodWindowRemoved,   Qt::QueuedConnection);
63
66
}
64
67
 
65
68
QHash<int, QByteArray> WindowModel::roleNames() const
120
123
    Q_EMIT dataChanged(row, row, QVector<int>() << SurfaceRole);
121
124
}
122
125
 
 
126
void WindowModel::onInputMethodWindowAdded(const NewWindow windowInfo)
 
127
{
 
128
    if (m_inputMethodSurface) {
 
129
        qDebug("Multiple Input Method Surfaces created, removing the old one!");
 
130
        delete m_inputMethodSurface;
 
131
    }
 
132
    m_inputMethodSurface = new MirSurface(windowInfo, m_windowController);
 
133
    Q_EMIT inputMethodSurfaceChanged(m_inputMethodSurface);
 
134
}
 
135
 
 
136
void WindowModel::onInputMethodWindowRemoved()
 
137
{
 
138
    if (m_inputMethodSurface) {
 
139
        delete m_inputMethodSurface;
 
140
        m_inputMethodSurface = nullptr;
 
141
        Q_EMIT inputMethodSurfaceChanged(m_inputMethodSurface);
 
142
    }
 
143
}
 
144
 
123
145
void WindowModel::onWindowsRaised(QVector<int> indices)
124
146
{
125
147
    const int modelCount = m_windowModel.count();