@@ -88,10 +88,13 @@ void XPanelWindow::connectWindow() {
8888
8989 this ->window ->installEventFilter (&this ->eventFilter );
9090 this ->connectScreen ();
91- // clang-format off
92- QObject::connect (this ->window , &QQuickWindow::screenChanged, this , &XPanelWindow::connectScreen);
93- QObject::connect (this ->window , &QQuickWindow::visibleChanged, this , &XPanelWindow::updatePanelStack);
94- // clang-format on
91+
92+ QObject::connect (
93+ this ->window ,
94+ &QQuickWindow::visibleChanged,
95+ this ,
96+ &XPanelWindow::updatePanelStack
97+ );
9598
9699 // qt overwrites _NET_WM_STATE, so we have to use the qt api
97100 // QXcbWindow::WindowType::Dock in qplatformwindow_p.h
@@ -129,6 +132,11 @@ void XPanelWindow::setHeight(qint32 height) {
129132 }
130133}
131134
135+ void XPanelWindow::setScreen (QuickshellScreenInfo* screen) {
136+ this ->ProxyWindowBase ::setScreen (screen);
137+ this ->connectScreen ();
138+ }
139+
132140Anchors XPanelWindow::anchors () const { return this ->mAnchors ; }
133141
134142void XPanelWindow::setAnchors (Anchors anchors) {
@@ -194,14 +202,14 @@ void XPanelWindow::xInit() {
194202 // Stick to every workspace
195203 auto desktop = 0xffffffff ;
196204 xcb_change_property (
197- conn,
198- XCB_PROP_MODE_REPLACE,
199- this ->window ->winId (),
200- XAtom::_NET_WM_DESKTOP.atom (),
201- XCB_ATOM_CARDINAL,
202- 32 ,
203- 1 ,
204- &desktop
205+ conn,
206+ XCB_PROP_MODE_REPLACE,
207+ this ->window ->winId (),
208+ XAtom::_NET_WM_DESKTOP.atom (),
209+ XCB_ATOM_CARDINAL,
210+ 32 ,
211+ 1 ,
212+ &desktop
205213 );
206214}
207215
@@ -210,7 +218,7 @@ void XPanelWindow::connectScreen() {
210218 QObject::disconnect (this ->mTrackedScreen , nullptr , this , nullptr );
211219 }
212220
213- this ->mTrackedScreen = this ->window -> screen () ;
221+ this ->mTrackedScreen = this ->mScreen ;
214222
215223 if (this ->mTrackedScreen != nullptr ) {
216224 QObject::connect (
@@ -220,12 +228,15 @@ void XPanelWindow::connectScreen() {
220228 &XPanelWindow::updateDimensions
221229 );
222230 }
231+
232+ this ->updateDimensions ();
223233}
224234
225235void XPanelWindow::updateDimensions () {
226- if (this ->window == nullptr || this ->window ->handle () == nullptr ) return ;
236+ if (this ->window == nullptr || this ->window ->handle () == nullptr || this ->mScreen == nullptr )
237+ return ;
227238
228- auto screenGeometry = this ->window -> screen ()-> virtualGeometry ();
239+ auto screenGeometry = this ->mScreen -> geometry ();
229240
230241 if (this ->mExclusionMode != ExclusionMode::Ignore) {
231242 for (auto * panel: XPanelStack::instance ()->panels (this )) {
@@ -235,6 +246,8 @@ void XPanelWindow::updateDimensions() {
235246 // we only care about windows in the same layer
236247 if (panel->mAboveWindows != this ->mAboveWindows ) continue ;
237248
249+ if (panel->mScreen != this ->mScreen ) continue ;
250+
238251 int side = -1 ;
239252 quint32 exclusiveZone = 0 ;
240253 panel->getExclusion (side, exclusiveZone);
0 commit comments