68 Q_PROPERTY(
int count READ rowCount NOTIFY countChanged)
75 Q_PROPERTY(
lomiri::shell::application::MirSurfaceInterface* inputMethodSurface READ inputMethodSurface NOTIFY inputMethodSurfaceChanged)
80 Q_PROPERTY(
Window* focusedWindow READ focusedWindow NOTIFY focusedWindowChanged)
86 Q_PROPERTY(
int nextId READ nextId)
107 Q_PROPERTY(
bool rootFocus READ rootFocus WRITE setRootFocus NOTIFY rootFocusChanged)
117 WindowRole = Qt::UserRole,
118 ApplicationRole = Qt::UserRole + 1,
125 int rowCount(
const QModelIndex &parent = QModelIndex())
const override;
126 QVariant data(
const QModelIndex& index,
int role)
const override;
127 QHash<int, QByteArray> roleNames()
const override {
128 QHash<int, QByteArray> roleNames { {WindowRole,
"window"},
129 {ApplicationRole,
"application"} };
135 lomiri::shell::application::MirSurfaceInterface* inputMethodSurface()
const;
136 Window* focusedWindow()
const;
138#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
139 int nextId()
const {
return m_nextId.loadRelaxed(); }
141 int nextId()
const {
return m_nextId.load(); }
153 Q_INVOKABLE lomiri::shell::application::MirSurfaceInterface *surfaceAt(
int index)
const;
160 Q_INVOKABLE
Window *windowAt(
int index)
const;
165 Q_INVOKABLE
void removeAt(
int index);
170 Q_INVOKABLE lomiri::shell::application::ApplicationInfoInterface *applicationAt(
int index)
const;
175 Q_INVOKABLE
int idAt(
int index)
const;
182 Q_INVOKABLE
int indexForId(
int id)
const;
187 Q_INVOKABLE
void raiseId(
int id);
192 Q_INVOKABLE
void closeAllWindows();
197 Q_INVOKABLE
void pendingActivation();
199 void setApplicationManager(lomiri::shell::application::ApplicationManagerInterface*);
200 void setSurfaceManager(lomiri::shell::application::SurfaceManagerInterface*);
201 void setRootFocus(
bool focus);
206 void inputMethodSurfaceChanged(lomiri::shell::application::MirSurfaceInterface* inputMethodSurface);
207 void focusedWindowChanged(
Window *focusedWindow);
216 void closedAllWindows();
218 void rootFocusChanged();
221 void onSurfacesAddedToWorkspace(
const std::shared_ptr<miral::Workspace>& workspace,
222 const QVector<lomiri::shell::application::MirSurfaceInterface*> surfaces);
223 void onSurfacesRaised(
const QVector<lomiri::shell::application::MirSurfaceInterface*> &surfaces);
225 void onModificationsStarted();
226 void onModificationsEnded();
229 void doRaiseId(
int id);
231 int nextFreeId(
int candidateId,
const int latestId);
232 int nextId(
int id)
const;
234 int indexOf(lomiri::shell::application::MirSurfaceInterface *surface);
236 void setInputMethodWindow(
Window *window);
237 void setFocusedWindow(
Window *window);
238 void removeInputMethodWindow();
239 void deleteAt(
int index);
240 void removeSurfaces(
const QVector<lomiri::shell::application::MirSurfaceInterface *> surfaces);
242 void addApplication(lomiri::shell::application::ApplicationInfoInterface *application);
243 void removeApplication(lomiri::shell::application::ApplicationInfoInterface *application);
245 void prependPlaceholder(lomiri::shell::application::ApplicationInfoInterface *application);
246 void prependSurface(lomiri::shell::application::MirSurfaceInterface *surface,
247 lomiri::shell::application::ApplicationInfoInterface *application);
248 void prependSurfaceHelper(lomiri::shell::application::MirSurfaceInterface *surface,
249 lomiri::shell::application::ApplicationInfoInterface *application);
250 void prependWindow(
Window *window, lomiri::shell::application::ApplicationInfoInterface *application);
252 void connectWindow(
Window *window);
253 void connectSurface(lomiri::shell::application::MirSurfaceInterface *surface);
255 void onSurfaceDied(lomiri::shell::application::MirSurfaceInterface *surface);
256 void onSurfaceDestroyed(lomiri::shell::application::MirSurfaceInterface *surface);
258 void move(
int from,
int to);
260 void activateEmptyWindow(
Window *window);
262 void activateTopMostWindowWithoutId(
int forbiddenId);
263 void refreshWindows();
266 Window *createWindow(lomiri::shell::application::MirSurfaceInterface *surface);
267 Window *createWindowWithId(lomiri::shell::application::MirSurfaceInterface *surface,
int id);
268 Window *createNullWindow();
272 ModelEntry(
Window *window,
273 lomiri::shell::application::ApplicationInfoInterface *application)
274 : window(window), application(application) {}
276 lomiri::shell::application::ApplicationInfoInterface *application{
nullptr};
277 bool removeOnceSurfaceDestroyed{
false};
280 QVector<ModelEntry> m_windowModel;
281 Window* m_inputMethodWindow{
nullptr};
282 Window* m_focusedWindow{
nullptr};
284 Workspace* m_workspace{
nullptr};
286 QSet<lomiri::shell::application::MirSurfaceInterface*> m_allSurfaces;
287 Window* m_previousWindow{
nullptr};
288 bool m_pendingActivation;
290 QAtomicInteger<int> m_nextId{1};
292 lomiri::shell::application::ApplicationManagerInterface* m_applicationManager{
nullptr};
293 lomiri::shell::application::SurfaceManagerInterface *m_surfaceManager{
nullptr};
294 bool m_surfaceManagerBusy;
303 ModelState m_modelState{IdleState};
306 bool m_focusedWindowCleared{
false};
308 bool m_closingAllApps{
false};