on xenial help sign in
fix screen sizes in mocks
83d36b3Michael Zanetti
qml/Stage/Spread/WorkspacePreview.qml+2
@@ -12,6 +12,8 @@ Item {
12 property string background
12 property string background
13 property int screenHeight
13 property int screenHeight
14
14
15+ onScreenHeightChanged: print("screen height changed", screenHeight)
16+
15 property real previewScale: previewSpace.height / previewSpace.screenHeight
17 property real previewScale: previewSpace.height / previewSpace.screenHeight
16
18
17 property bool containsDragLeft: false
19 property bool containsDragLeft: false
qml/Stage/Spread/Workspaces.qml+5−3
@@ -104,8 +104,9 @@ Item {
104 leftMargin: itemWidth
104 leftMargin: itemWidth
105 rightMargin: itemWidth
105 rightMargin: itemWidth
106
106
107− property var screenSize: screen.availableModes[screen.currentModeIndex].size
107+ property int screenWidth: screen.availableModes[screen.currentModeIndex].size.width
108+ property int screenHeight: screen.availableModes[screen.currentModeIndex].size.height
108− property int itemWidth: height * screenSize.width / screenSize.height
109+ property int itemWidth: height * screenWidth / screenHeight
109 property int foldingAreaWidth: itemWidth / 2
110 property int foldingAreaWidth: itemWidth / 2
110 property int maxAngle: 40
111 property int maxAngle: 40
111
112
@@ -234,10 +235,11 @@ Item {
234 ]
235 ]
235
236
236 WorkspacePreview {
237 WorkspacePreview {
238+ id: workspacePreview
237 height: listView.height
239 height: listView.height
238 width: listView.itemWidth
240 width: listView.itemWidth
239 background: root.background
241 background: root.background
240− screenHeight: screen.availableModes[screen.currentModeIndex].size.height
242+ screenHeight: listView.screenHeight
241 containsDragLeft: listView.hoveredWorkspaceIndex == index && listView.hoveredHalf == "left"
243 containsDragLeft: listView.hoveredWorkspaceIndex == index && listView.hoveredHalf == "left"
242 containsDragRight: listView.hoveredWorkspaceIndex == index && listView.hoveredHalf == "right"
244 containsDragRight: listView.hoveredWorkspaceIndex == index && listView.hoveredHalf == "right"
243 isActive: model.workspace.active
245 isActive: model.workspace.active
tests/mocks/WindowManager/MockScreens.cpp+7−2
@@ -52,18 +52,23 @@ public:
52
52
53 if (m_connectedWindow) {
53 if (m_connectedWindow) {
54 disconnect(m_connectedWindow.data());
54 disconnect(m_connectedWindow.data());
55− m_sizes.takeFirst()->deleteLater();
56 }
55 }
57
56
58 m_connectedWindow = w;
57 m_connectedWindow = w;
59
58
60 if (w) {
59 if (w) {
61 connect(w, &ScreenWindow::heightChanged, this, [this](int height) {
60 connect(w, &ScreenWindow::heightChanged, this, [this](int height) {
61+ if (height == 0 || height == m_sizes.first()->size.rheight()) {
62+ return;
63+ }
62 m_sizes.first()->size.rheight() = height;
64 m_sizes.first()->size.rheight() = height;
63 Q_EMIT availableModesChanged();
65 Q_EMIT availableModesChanged();
64
66
65 });
67 });
66 connect(w, &ScreenWindow::widthChanged, this, [this](int width) {
68 connect(w, &ScreenWindow::widthChanged, this, [this](int width) {
69+ if (width == 0 || width == m_sizes.first()->size.rwidth()) {
70+ return;
71+ }
67 m_sizes.first()->size.rwidth() = width;
72 m_sizes.first()->size.rwidth() = width;
68 Q_EMIT availableModesChanged();
73 Q_EMIT availableModesChanged();
69 });
74 });
@@ -162,7 +167,7 @@ MockScreens::MockScreens()
162 screen->m_active = i == 0;
167 screen->m_active = i == 0;
163 screen->m_name = QString("Monitor %1").arg(i);
168 screen->m_name = QString("Monitor %1").arg(i);
164 screen->m_position = QPoint(lastPoint.x(), lastPoint.y());
169 screen->m_position = QPoint(lastPoint.x(), lastPoint.y());
165− screen->m_currentModeIndex = 3;
170+ screen->m_currentModeIndex = 0;
166 m_mocks.append(screen);
171 m_mocks.append(screen);
167
172
168 lastPoint.rx() += screen->m_sizes[screen->m_currentModeIndex]->size.width();
173 lastPoint.rx() += screen->m_sizes[screen->m_currentModeIndex]->size.width();