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 lomiri::shell::application::ApplicationInfoInterface *applicationAt(
int index)
const;
170 Q_INVOKABLE
int idAt(
int index)
const;
177 Q_INVOKABLE
int indexForId(
int id)
const;
182 Q_INVOKABLE
void raiseId(
int id);
187 Q_INVOKABLE
void closeAllWindows();
192 Q_INVOKABLE
void pendingActivation();
194 void setApplicationManager(lomiri::shell::application::ApplicationManagerInterface*);
195 void setSurfaceManager(lomiri::shell::application::SurfaceManagerInterface*);
196 void setRootFocus(
bool focus);
201 void inputMethodSurfaceChanged(lomiri::shell::application::MirSurfaceInterface* inputMethodSurface);
202 void focusedWindowChanged(
Window *focusedWindow);
211 void closedAllWindows();
213 void rootFocusChanged();
216 void onSurfacesAddedToWorkspace(
const std::shared_ptr<miral::Workspace>& workspace,
217 const QVector<lomiri::shell::application::MirSurfaceInterface*> surfaces);
218 void onSurfacesRaised(
const QVector<lomiri::shell::application::MirSurfaceInterface*> &surfaces);
220 void onModificationsStarted();
221 void onModificationsEnded();
224 void doRaiseId(
int id);
226 int nextFreeId(
int candidateId,
const int latestId);
227 int nextId(
int id)
const;
229 int indexOf(lomiri::shell::application::MirSurfaceInterface *surface);
231 void setInputMethodWindow(
Window *window);
232 void setFocusedWindow(
Window *window);
233 void removeInputMethodWindow();
234 void deleteAt(
int index);
235 void removeAt(
int index);
236 void removeSurfaces(
const QVector<lomiri::shell::application::MirSurfaceInterface *> surfaces);
238 void addApplication(lomiri::shell::application::ApplicationInfoInterface *application);
239 void removeApplication(lomiri::shell::application::ApplicationInfoInterface *application);
241 void prependPlaceholder(lomiri::shell::application::ApplicationInfoInterface *application);
242 void prependSurface(lomiri::shell::application::MirSurfaceInterface *surface,
243 lomiri::shell::application::ApplicationInfoInterface *application);
244 void prependSurfaceHelper(lomiri::shell::application::MirSurfaceInterface *surface,
245 lomiri::shell::application::ApplicationInfoInterface *application);
246 void prependWindow(
Window *window, lomiri::shell::application::ApplicationInfoInterface *application);
248 void connectWindow(
Window *window);
249 void connectSurface(lomiri::shell::application::MirSurfaceInterface *surface);
251 void onSurfaceDied(lomiri::shell::application::MirSurfaceInterface *surface);
252 void onSurfaceDestroyed(lomiri::shell::application::MirSurfaceInterface *surface);
254 void move(
int from,
int to);
256 void activateEmptyWindow(
Window *window);
258 void activateTopMostWindowWithoutId(
int forbiddenId);
259 void refreshWindows();
262 Window *createWindow(lomiri::shell::application::MirSurfaceInterface *surface);
263 Window *createWindowWithId(lomiri::shell::application::MirSurfaceInterface *surface,
int id);
264 Window *createNullWindow();
268 ModelEntry(
Window *window,
269 lomiri::shell::application::ApplicationInfoInterface *application)
270 : window(window), application(application) {}
272 lomiri::shell::application::ApplicationInfoInterface *application{
nullptr};
273 bool removeOnceSurfaceDestroyed{
false};
276 QVector<ModelEntry> m_windowModel;
277 Window* m_inputMethodWindow{
nullptr};
278 Window* m_focusedWindow{
nullptr};
280 Workspace* m_workspace{
nullptr};
282 QSet<lomiri::shell::application::MirSurfaceInterface*> m_allSurfaces;
283 Window* m_previousWindow{
nullptr};
284 bool m_pendingActivation;
286 QAtomicInteger<int> m_nextId{1};
288 lomiri::shell::application::ApplicationManagerInterface* m_applicationManager{
nullptr};
289 lomiri::shell::application::SurfaceManagerInterface *m_surfaceManager{
nullptr};
290 bool m_surfaceManagerBusy;
299 ModelState m_modelState{IdleState};
302 bool m_focusedWindowCleared{
false};
304 bool m_closingAllApps{
false};