on xenial help sign in
merged pre-req
e9f4c43Nick Dedekind
tests/mocks/WindowManager/MockScreens.cpp+15−2
@@ -57,7 +57,7 @@ public:
57 m_connectedWindow = w;
57 m_connectedWindow = w;
58
58
59 if (w) {
59 if (w) {
60− connect(w, &ScreenWindow::heightChanged, this, [this](int height) {
60+ connect(w, &QWindow::heightChanged, this, [this](int height) {
61 if (height == 0 || height == m_sizes.first()->size.rheight()) {
61 if (height == 0 || height == m_sizes.first()->size.rheight()) {
62 return;
62 return;
63 }
63 }
@@ -65,15 +65,20 @@ public:
65 Q_EMIT availableModesChanged();
65 Q_EMIT availableModesChanged();
66
66
67 });
67 });
68− connect(w, &ScreenWindow::widthChanged, this, [this](int width) {
68+ connect(w, &QWindow::widthChanged, this, [this](int width) {
69 if (width == 0 || width == m_sizes.first()->size.rwidth()) {
69 if (width == 0 || width == m_sizes.first()->size.rwidth()) {
70 return;
70 return;
71 }
71 }
72 m_sizes.first()->size.rwidth() = width;
72 m_sizes.first()->size.rwidth() = width;
73 Q_EMIT availableModesChanged();
73 Q_EMIT availableModesChanged();
74 });
74 });
75+ connect(w, &QWindow::activeChanged, this, [w, this]() {
76+ if (w->isActive()) setActive(true);
77+ });
78+ if (w->isActive()) setActive(true);
75
79
76 Q_EMIT availableModesChanged();
80 Q_EMIT availableModesChanged();
81+
77 }
82 }
78 }
83 }
79
84
@@ -170,6 +175,14 @@ MockScreens::MockScreens()
170 m_mocks.append(screen);
175 m_mocks.append(screen);
171
176
172 lastPoint.rx() += screen->m_sizes[screen->m_currentModeIndex]->size.width();
177 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+ });
173 }
186 }
174}
187}
175
188