on xenial help sign in
merged prereq
9b92f18Nick Dedekind
plugins/WindowManager/Screen.cpp+14−10
@@ -52,12 +52,6 @@ void Screen::setCurrentWorkspace2(Workspace *workspace)
52 workspace->setCurrentOn(this);
52 workspace->setCurrentOn(this);
53}
53}
54
54
55−qtmir::OutputId Screen::outputId() const
56−{
57− if (!m_wrapped) return qtmir::OutputId(-1);
58− return m_wrapped->outputId();
59−}
60−
61bool Screen::used() const
55bool Screen::used() const
62{
56{
63 if (!m_wrapped) return false;
57 if (!m_wrapped) return false;
@@ -147,16 +141,16 @@ QScreen *Screen::qscreen() const
147 return m_wrapped->qscreen();
141 return m_wrapped->qscreen();
148}
142}
149
143
150−qtmir::ScreenConfiguration *Screen::beginConfiguration() const
144+ScreenConfig *Screen::beginConfiguration() const
151{
145{
152 if (!m_wrapped) return nullptr;
146 if (!m_wrapped) return nullptr;
153− return m_wrapped->beginConfiguration();
147+ return new ScreenConfig(m_wrapped->beginConfiguration());
154}
148}
155
149
156−bool Screen::applyConfiguration(qtmir::ScreenConfiguration *configuration)
150+bool Screen::applyConfiguration(ScreenConfig *configuration)
157{
151{
158 if (!m_wrapped) return false;
152 if (!m_wrapped) return false;
159− return m_wrapped->applyConfiguration(configuration);
153+ return m_wrapped->applyConfiguration(configuration->m_config);
160}
154}
161
155
162QString Screen::outputTypeName() const
156QString Screen::outputTypeName() const
@@ -303,3 +297,13 @@ bool ProxyScreen::isSyncing() const
303{
297{
304 return m_screens->isSyncing();
298 return m_screens->isSyncing();
305}
299}
300+
301+ScreenConfig::ScreenConfig(qtmir::ScreenConfiguration *config)
302+ : m_config(config)
303+{
304+}
305+
306+ScreenConfig::~ScreenConfig()
307+{
308+ delete m_config;
309+}
plugins/WindowManager/Screen.h+20−4
@@ -9,6 +9,7 @@
9
9
10class ProxyScreen;
10class ProxyScreen;
11class ProxyScreens;
11class ProxyScreens;
12+class ScreenConfig;
12
13
13class Screen: public QObject
14class Screen: public QObject
14{
15{
@@ -30,8 +31,6 @@ class Screen: public QObject
30 Q_PROPERTY(WorkspaceModel* workspaces READ workspaces CONSTANT)
31 Q_PROPERTY(WorkspaceModel* workspaces READ workspaces CONSTANT)
31 Q_PROPERTY(Workspace* currentWorkspace READ currentWorkspace WRITE setCurrentWorkspace2 NOTIFY currentWorkspaceChanged)
32 Q_PROPERTY(Workspace* currentWorkspace READ currentWorkspace WRITE setCurrentWorkspace2 NOTIFY currentWorkspaceChanged)
32public:
33public:
33− // From qtmir::Screen
34− qtmir::OutputId outputId() const;
35 bool used() const;
34 bool used() const;
36 QString name() const;
35 QString name() const;
37 float scale() const;
36 float scale() const;
@@ -48,8 +47,8 @@ public:
48 QScreen* qscreen() const;
47 QScreen* qscreen() const;
49 QString outputTypeName() const;
48 QString outputTypeName() const;
50
49
51− qtmir::ScreenConfiguration *beginConfiguration() const;
50+ Q_INVOKABLE ScreenConfig *beginConfiguration() const;
52− bool applyConfiguration(qtmir::ScreenConfiguration *configuration);
51+ Q_INVOKABLE bool applyConfiguration(ScreenConfig *configuration);
53
52
54 virtual WorkspaceModel* workspaces() const = 0;
53 virtual WorkspaceModel* workspaces() const = 0;
55 virtual Workspace *currentWorkspace() const = 0;
54 virtual Workspace *currentWorkspace() const = 0;
@@ -132,4 +131,21 @@ private:
132 QPointer<Workspace> m_currentWorspace;
131 QPointer<Workspace> m_currentWorspace;
133};
132};
134
133
134+class ScreenConfig: public QObject
135+{
136+ Q_OBJECT
137+ Q_PRIVATE_PROPERTY(m_config, bool valid MEMBER used CONSTANT)
138+ Q_PRIVATE_PROPERTY(m_config, bool used MEMBER used)
139+ Q_PRIVATE_PROPERTY(m_config, float scale MEMBER scale)
140+ Q_PRIVATE_PROPERTY(m_config, qtmir::FormFactor formFactor MEMBER formFactor)
141+ Q_PRIVATE_PROPERTY(m_config, uint currentModeIndex MEMBER currentModeIndex)
142+ Q_PRIVATE_PROPERTY(m_config, QPoint position MEMBER topLeft)
143+
144+public:
145+ ScreenConfig(qtmir::ScreenConfiguration*);
146+ ~ScreenConfig();
147+
148+ qtmir::ScreenConfiguration* m_config;
149+};
150+
135#endif // SCREEN_H
151#endif // SCREEN_H
plugins/WindowManager/WindowManagerPlugin.cpp+1
@@ -64,6 +64,7 @@ void WindowManagerPlugin::registerTypes(const char *uri)
64 qmlRegisterUncreatableType<WorkspaceModel>(uri, 1, 0, "WorkspaceModel", notInstantiatable);
64 qmlRegisterUncreatableType<WorkspaceModel>(uri, 1, 0, "WorkspaceModel", notInstantiatable);
65 qmlRegisterSingletonType<ConcreteScreens>(uri, 1, 0, "Screens", screensSingleton);
65 qmlRegisterSingletonType<ConcreteScreens>(uri, 1, 0, "Screens", screensSingleton);
66 qmlRegisterUncreatableType<qtmir::ScreenMode>(uri, 1, 0, "ScreenMode", notInstantiatable);
66 qmlRegisterUncreatableType<qtmir::ScreenMode>(uri, 1, 0, "ScreenMode", notInstantiatable);
67+ qmlRegisterUncreatableType<ScreenConfig>(uri, 1, 0, "ScreenConfig", notInstantiatable);
67 qmlRegisterSingletonType<WindowManagerObjects>(uri, 1, 0, "WindowManagerObjects", objectsSingleton);
68 qmlRegisterSingletonType<WindowManagerObjects>(uri, 1, 0, "WindowManagerObjects", objectsSingleton);
68
69
69 qRegisterMetaType<ConcreteScreen*>("ConcreteScreen*");
70 qRegisterMetaType<ConcreteScreen*>("ConcreteScreen*");
tests/mocks/WindowManager/MockScreens.cpp+4−4
@@ -77,7 +77,7 @@ public:
77 }
77 }
78 }
78 }
79
79
80− qtmir::OutputId outputId() const override { return m_id; }
80+ miral::DisplayId displayId() const override { return m_id; }
81 bool used() const override { return m_used; }
81 bool used() const override { return m_used; }
82 QString name() const override { return m_name; }
82 QString name() const override { return m_name; }
83 float scale() const override { return m_scale; }
83 float scale() const override { return m_scale; }
@@ -112,7 +112,7 @@ public:
112 qtmir::ScreenConfiguration *beginConfiguration() const override {
112 qtmir::ScreenConfiguration *beginConfiguration() const override {
113 auto config = new qtmir::ScreenConfiguration;
113 auto config = new qtmir::ScreenConfiguration;
114 config->valid = true;
114 config->valid = true;
115− config->id = m_id;
115+ config->id = m_id.output_id;
116 config->used = m_used;
116 config->used = m_used;
117 config->topLeft = m_position;
117 config->topLeft = m_position;
118 config->currentModeIndex = m_currentModeIndex;
118 config->currentModeIndex = m_currentModeIndex;
@@ -136,7 +136,7 @@ Q_SIGNALS:
136 void outputTypeNameChanged();
136 void outputTypeNameChanged();
137
137
138public:
138public:
139− qtmir::OutputId m_id{0};
139+ miral::DisplayId m_id;
140 bool m_active{false};
140 bool m_active{false};
141 bool m_used{true};
141 bool m_used{true};
142 QString m_name;
142 QString m_name;
@@ -162,7 +162,7 @@ MockScreens::MockScreens()
162 QPoint lastPoint(0,0);
162 QPoint lastPoint(0,0);
163 for (int i = 0; i < screenCount; ++i) {
163 for (int i = 0; i < screenCount; ++i) {
164 auto screen = new MockScreen();
164 auto screen = new MockScreen();
165− screen->m_id = qtmir::OutputId{i};
165+ screen->m_id.output_id = miral::OutputId{i};
166 screen->m_active = i == 0;
166 screen->m_active = i == 0;
167 screen->m_name = QString("Monitor %1").arg(i);
167 screen->m_name = QString("Monitor %1").arg(i);
168 screen->m_position = QPoint(lastPoint.x(), lastPoint.y());
168 screen->m_position = QPoint(lastPoint.x(), lastPoint.y());
tests/mocks/WindowManager/WindowManagerPlugin.cpp+1
@@ -61,6 +61,7 @@ void WindowManagerPlugin::registerTypes(const char *uri)
61 qmlRegisterUncreatableType<WorkspaceModel>(uri, 1, 0, "WorkspaceModel", notInstantiatable);
61 qmlRegisterUncreatableType<WorkspaceModel>(uri, 1, 0, "WorkspaceModel", notInstantiatable);
62 qmlRegisterSingletonType<ConcreteScreens>(uri, 1, 0, "Screens", screensSingleton);
62 qmlRegisterSingletonType<ConcreteScreens>(uri, 1, 0, "Screens", screensSingleton);
63 qmlRegisterUncreatableType<qtmir::ScreenMode>(uri, 1, 0, "ScreenMode", notInstantiatable);
63 qmlRegisterUncreatableType<qtmir::ScreenMode>(uri, 1, 0, "ScreenMode", notInstantiatable);
64+ qmlRegisterUncreatableType<ScreenConfig>(uri, 1, 0, "ScreenConfig", notInstantiatable);
64 qmlRegisterSingletonType<WindowManagerObjects>(uri, 1, 0, "WindowManagerObjects", objectsSingleton);
65 qmlRegisterSingletonType<WindowManagerObjects>(uri, 1, 0, "WindowManagerObjects", objectsSingleton);
65
66
66 qRegisterMetaType<ConcreteScreen*>("ConcreteScreen*");
67 qRegisterMetaType<ConcreteScreen*>("ConcreteScreen*");