@@ -57,18 +57,29 @@ 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) {
61+ if (height == 0 || height == m_sizes.first()->size.rheight()) {
62+ return;
63+ }
6164 m_sizes.first()->size.rheight() = height;
6265 Q_EMIT availableModesChanged();
6366
6467 });
65− 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()) {
70+ return;
71+ }
6672 m_sizes.first()->size.rwidth() = width;
6773 Q_EMIT availableModesChanged();
6874 });
75+ connect(w, &QWindow::activeChanged, this, [w, this]() {
76+ if (w->isActive()) setActive(true);
77+ });
78+ if (w->isActive()) setActive(true);
6979
7080 m_sizes.push_front(new qtmir::ScreenMode(50, w->size()));
7181 Q_EMIT availableModesChanged();
82+
7283 }
7384 }
7485
@@ -161,6 +172,14 @@ MockScreens::MockScreens()
161172 m_mocks.append(screen);
162173
163174 lastPoint.rx() += screen->m_sizes[screen->m_currentModeIndex]->size.width();
175+
176+ connect(screen, &qtmir::Screen::activeChanged, this, [=](bool active) {
177+ Q_FOREACH(auto otherScreen, m_mocks) {
178+ if (active && otherScreen != screen) {
179+ otherScreen->setActive(false);
180+ }
181+ }
182+ });
164183 }
165184}
166185