@@ -23,7 +23,6 @@ namespace qs::wayland::toplevel_management::impl {
2323
2424QString ToplevelHandle::appId () const { return this ->mAppId ; }
2525QString ToplevelHandle::title () const { return this ->mTitle ; }
26- QVector<QScreen*> ToplevelHandle::visibleScreens () const { return this ->mVisibleScreens ; }
2726ToplevelHandle* ToplevelHandle::parent () const { return this ->mParent ; }
2827bool ToplevelHandle::activated () const { return this ->mActivated ; }
2928bool ToplevelHandle::maximized () const { return this ->mMaximized ; }
@@ -181,59 +180,13 @@ void ToplevelHandle::zwlr_foreign_toplevel_handle_v1_state(wl_array* stateArray)
181180}
182181
183182void 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);
209185}
210186
211187void 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);
237190}
238191
239192void ToplevelHandle::zwlr_foreign_toplevel_handle_v1_parent (
@@ -262,26 +215,4 @@ void ToplevelHandle::onParentClosed() {
262215 emit this ->parentChanged ();
263216}
264217
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-
287218} // namespace qs::wayland::toplevel_management::impl
0 commit comments