on xenial help sign in
merged pre-req
commite9f4c43f5c16cfc13500b546b416e6a6a67cccd4 authorNick Dedekind <nick.dedekind@canonical.com> dateTue 4 Apr 2017, 21:12 (10 years ago) parenta81362c2adba16
1 file changed+15−2
tests/mocks/WindowManager/MockScreens.cpp+15−2
tests/mocks/WindowManager/MockScreens.cpp+15−2
@@ -57,7 +57,7 @@ public:
5757 m_connectedWindow = w;
5858
5959 if (w) {
60− connect(w, &ScreenWindow::heightChanged, this, [this](int height) {
60+ connect(w, &QWindow::heightChanged, this, [this](int height) {
6161 if (height == 0 || height == m_sizes.first()->size.rheight()) {
6262 return;
6363 }
@@ -65,15 +65,20 @@ public:
6565 Q_EMIT availableModesChanged();
6666
6767 });
68− connect(w, &ScreenWindow::widthChanged, this, [this](int width) {
68+ connect(w, &QWindow::widthChanged, this, [this](int width) {
6969 if (width == 0 || width == m_sizes.first()->size.rwidth()) {
7070 return;
7171 }
7272 m_sizes.first()->size.rwidth() = width;
7373 Q_EMIT availableModesChanged();
7474 });
75+ connect(w, &QWindow::activeChanged, this, [w, this]() {
76+ if (w->isActive()) setActive(true);
77+ });
78+ if (w->isActive()) setActive(true);
7579
7680 Q_EMIT availableModesChanged();
81+
7782 }
7883 }
7984
@@ -170,6 +175,14 @@ MockScreens::MockScreens()
170175 m_mocks.append(screen);
171176
172177 lastPoint.rx() += screen->m_sizes[screen->m_currentModeIndex]->size.width();
178+
179+ connect(screen, &qtmir::Screen::activeChanged, this, [=](bool active) {
180+ Q_FOREACH(auto otherScreen, m_mocks) {
181+ if (active && otherScreen != screen) {
182+ otherScreen->setActive(false);
183+ }
184+ }
185+ });
173186 }
174187}
175188