@@ -23,7 +23,6 @@ namespace qs::wayland::toplevel_management::impl {
23
23
24
24
QString ToplevelHandle::appId () const { return this ->mAppId ; }
25
25
QString ToplevelHandle::title () const { return this ->mTitle ; }
26
- QVector<QScreen*> ToplevelHandle::visibleScreens () const { return this ->mVisibleScreens ; }
27
26
ToplevelHandle* ToplevelHandle::parent () const { return this ->mParent ; }
28
27
bool ToplevelHandle::activated () const { return this ->mActivated ; }
29
28
bool ToplevelHandle::maximized () const { return this ->mMaximized ; }
@@ -181,59 +180,13 @@ void ToplevelHandle::zwlr_foreign_toplevel_handle_v1_state(wl_array* stateArray)
181
180
}
182
181
183
182
void ToplevelHandle::zwlr_foreign_toplevel_handle_v1_output_enter (wl_output* output) {
184
- auto * display = QtWaylandClient::QWaylandIntegration::instance ()->display ();
185
-
186
- auto * platformScreen = display->screenForOutput (output);
187
- if (!platformScreen) {
188
- qCDebug (logToplevelManagement) << this << " got pending output enter" << output;
189
-
190
- if (this ->mPendingVisibleScreens .isEmpty ()) {
191
- QObject::connect (
192
- static_cast <QGuiApplication*>(QGuiApplication::instance ()), // NOLINT
193
- &QGuiApplication::screenAdded,
194
- this ,
195
- &ToplevelHandle::onScreenAdded
196
- );
197
- }
198
-
199
- this ->mPendingVisibleScreens .append (output);
200
- return ;
201
- }
202
-
203
- auto * screen = platformScreen->screen ();
204
-
205
- qCDebug (logToplevelManagement) << this << " got output enter" << screen;
206
-
207
- this ->mVisibleScreens .append (screen);
208
- emit this ->visibleScreenAdded (screen);
183
+ qCDebug (logToplevelManagement) << this << " got output enter" << output;
184
+ this ->visibleScreens .addOutput (output);
209
185
}
210
186
211
187
void ToplevelHandle::zwlr_foreign_toplevel_handle_v1_output_leave (wl_output* output) {
212
- auto * display = QtWaylandClient::QWaylandIntegration::instance ()->display ();
213
- auto * platformScreen = display->screenForOutput (output);
214
-
215
- if (!this ->mPendingVisibleScreens .isEmpty ()) {
216
- this ->mPendingVisibleScreens .removeOne (output);
217
-
218
- if (this ->mPendingVisibleScreens .isEmpty ()) {
219
- qCDebug (logToplevelManagement) << this << " got pending output leave" << output;
220
-
221
- QObject::disconnect (
222
- static_cast <QGuiApplication*>(QGuiApplication::instance ()), // NOLINT
223
- nullptr ,
224
- this ,
225
- nullptr
226
- );
227
- }
228
- }
229
-
230
- if (!platformScreen) return ;
231
- auto * screen = platformScreen->screen ();
232
-
233
- qCDebug (logToplevelManagement) << this << " got output leave" << screen;
234
-
235
- this ->mVisibleScreens .removeOne (screen);
236
- emit this ->visibleScreenRemoved (screen);
188
+ qCDebug (logToplevelManagement) << this << " got output leave" << output;
189
+ this ->visibleScreens .removeOutput (output);
237
190
}
238
191
239
192
void ToplevelHandle::zwlr_foreign_toplevel_handle_v1_parent (
@@ -262,26 +215,4 @@ void ToplevelHandle::onParentClosed() {
262
215
emit this ->parentChanged ();
263
216
}
264
217
265
- void ToplevelHandle::onScreenAdded (QScreen* screen) {
266
- auto * waylandScreen = dynamic_cast <QtWaylandClient::QWaylandScreen*>(screen->handle ());
267
- if (!waylandScreen) return ;
268
-
269
- auto * output = waylandScreen->output ();
270
-
271
- if (this ->mPendingVisibleScreens .removeOne (output)) {
272
- qCDebug (logToplevelManagement) << this << " got pending entered output init" << screen;
273
- this ->mVisibleScreens .append (screen);
274
- emit this ->visibleScreenAdded (screen);
275
- }
276
-
277
- if (this ->mPendingVisibleScreens .isEmpty ()) {
278
- QObject::disconnect (
279
- static_cast <QGuiApplication*>(QGuiApplication::instance ()), // NOLINT
280
- nullptr ,
281
- this ,
282
- nullptr
283
- );
284
- }
285
- }
286
-
287
218
} // namespace qs::wayland::toplevel_management::impl
0 commit comments