Port X11Client::fullscreenMonitorsArea() to AbstractOutput

icc-effect-5.26.4
Vlad Zahorodnii 2021-09-01 12:27:37 +03:00
parent 26e470b7ff
commit cdd3f96fe1
1 changed files with 18 additions and 15 deletions

View File

@ -26,7 +26,6 @@
#include "netinfo.h" #include "netinfo.h"
#include "platform.h" #include "platform.h"
#include "screenedge.h" #include "screenedge.h"
#include "screens.h"
#include "shadow.h" #include "shadow.h"
#include "surfaceitem_x11.h" #include "surfaceitem_x11.h"
#include "virtualdesktops.h" #include "virtualdesktops.h"
@ -4458,16 +4457,16 @@ void X11Client::setFullScreen(bool set, bool user)
void X11Client::updateFullscreenMonitors(NETFullscreenMonitors topology) void X11Client::updateFullscreenMonitors(NETFullscreenMonitors topology)
{ {
int nscreens = screens()->count(); const int outputCount = kwinApp()->platform()->enabledOutputs().count();
// qDebug() << "incoming request with top: " << topology.top << " bottom: " << topology.bottom // qDebug() << "incoming request with top: " << topology.top << " bottom: " << topology.bottom
// << " left: " << topology.left << " right: " << topology.right // << " left: " << topology.left << " right: " << topology.right
// << ", we have: " << nscreens << " screens."; // << ", we have: " << nscreens << " screens.";
if (topology.top >= nscreens || if (topology.top >= outputCount ||
topology.bottom >= nscreens || topology.bottom >= outputCount ||
topology.left >= nscreens || topology.left >= outputCount ||
topology.right >= nscreens) { topology.right >= outputCount) {
qCWarning(KWIN_CORE) << "fullscreenMonitors update failed. request higher than number of screens."; qCWarning(KWIN_CORE) << "fullscreenMonitors update failed. request higher than number of screens.";
return; return;
} }
@ -4483,17 +4482,21 @@ void X11Client::updateFullscreenMonitors(NETFullscreenMonitors topology)
*/ */
QRect X11Client::fullscreenMonitorsArea(NETFullscreenMonitors requestedTopology) const QRect X11Client::fullscreenMonitorsArea(NETFullscreenMonitors requestedTopology) const
{ {
QRect top, bottom, left, right, total; QRect total;
top = screens()->geometry(requestedTopology.top); if (auto output = kwinApp()->platform()->findOutput(requestedTopology.top)) {
bottom = screens()->geometry(requestedTopology.bottom); total = total.united(output->geometry());
left = screens()->geometry(requestedTopology.left); }
right = screens()->geometry(requestedTopology.right); if (auto output = kwinApp()->platform()->findOutput(requestedTopology.bottom)) {
total = top.united(bottom.united(left.united(right))); total = total.united(output->geometry());
}
if (auto output = kwinApp()->platform()->findOutput(requestedTopology.left)) {
total = total.united(output->geometry());
}
if (auto output = kwinApp()->platform()->findOutput(requestedTopology.right)) {
total = total.united(output->geometry());
}
// qDebug() << "top: " << top << " bottom: " << bottom
// << " left: " << left << " right: " << right;
// qDebug() << "returning rect: " << total;
return total; return total;
} }