Port some of kwin to Workspace::geometry()

This commit is contained in:
Vlad Zahorodnii 2021-08-30 10:52:27 +03:00
parent 71aeb5528a
commit 9dfccfc95c
5 changed files with 10 additions and 10 deletions

View file

@ -974,7 +974,7 @@ class InternalWindowEventFilter : public InputEventFilter {
if (!w->isVisible()) { if (!w->isVisible()) {
continue; continue;
} }
if (!screens()->geometry().contains(w->geometry())) { if (!workspace()->geometry().contains(w->geometry())) {
continue; continue;
} }
if (w->property("_q_showWithoutActivating").toBool()) { if (w->property("_q_showWithoutActivating").toBool()) {

View file

@ -157,7 +157,7 @@ void PointerInputRedirection::init()
connect(workspace(), &Workspace::clientAdded, this, setupMoveResizeConnection); connect(workspace(), &Workspace::clientAdded, this, setupMoveResizeConnection);
// warp the cursor to center of screen // warp the cursor to center of screen
warp(screens()->geometry().center()); warp(workspace()->geometry().center());
updateAfterScreenChange(); updateAfterScreenChange();
} }
@ -811,7 +811,7 @@ void PointerInputRedirection::updatePosition(const QPointF &pos)
// verify that at least one screen contains the pointer position // verify that at least one screen contains the pointer position
QPointF p = pos; QPointF p = pos;
if (!screenContainsPos(p)) { if (!screenContainsPos(p)) {
const QRectF unitedScreensGeometry = screens()->geometry(); const QRectF unitedScreensGeometry = workspace()->geometry();
p = confineToBoundingBox(p, unitedScreensGeometry); p = confineToBoundingBox(p, unitedScreensGeometry);
if (!screenContainsPos(p)) { if (!screenContainsPos(p)) {
const AbstractOutput *currentOutput = kwinApp()->platform()->outputAt(m_pos.toPoint()); const AbstractOutput *currentOutput = kwinApp()->platform()->outputAt(m_pos.toPoint());

View file

@ -237,7 +237,7 @@ QSize WorkspaceWrapper::workspaceSize() const
QSize WorkspaceWrapper::displaySize() const QSize WorkspaceWrapper::displaySize() const
{ {
return screens()->displaySize(); return workspace()->geometry().size();
} }
int WorkspaceWrapper::displayWidth() const int WorkspaceWrapper::displayWidth() const
@ -368,12 +368,12 @@ int WorkspaceWrapper::activeScreen() const
QRect WorkspaceWrapper::virtualScreenGeometry() const QRect WorkspaceWrapper::virtualScreenGeometry() const
{ {
return screens()->geometry(); return workspace()->geometry();
} }
QSize WorkspaceWrapper::virtualScreenSize() const QSize WorkspaceWrapper::virtualScreenSize() const
{ {
return screens()->size(); return workspace()->geometry().size();
} }
void WorkspaceWrapper::sendClientToScreen(AbstractClient *client, int screen) void WorkspaceWrapper::sendClientToScreen(AbstractClient *client, int screen)

View file

@ -1607,13 +1607,13 @@ void Workspace::switchWindow(Direction direction)
auto opposite = [&] { auto opposite = [&] {
switch(direction) { switch(direction) {
case DirectionNorth: case DirectionNorth:
return QPoint(curPos.x(), screens()->geometry().height()); return QPoint(curPos.x(), geometry().height());
case DirectionSouth: case DirectionSouth:
return QPoint(curPos.x(), 0); return QPoint(curPos.x(), 0);
case DirectionEast: case DirectionEast:
return QPoint(0, curPos.y()); return QPoint(0, curPos.y());
case DirectionWest: case DirectionWest:
return QPoint(screens()->geometry().width(), curPos.y()); return QPoint(geometry().width(), curPos.y());
default: default:
Q_UNREACHABLE(); Q_UNREACHABLE();
} }

View file

@ -4617,7 +4617,7 @@ NETExtendedStrut X11Client::strut() const
{ {
NETExtendedStrut ext = info->extendedStrut(); NETExtendedStrut ext = info->extendedStrut();
NETStrut str = info->strut(); NETStrut str = info->strut();
const QSize displaySize = screens()->displaySize(); const QSize displaySize = workspace()->geometry().size();
if (ext.left_width == 0 && ext.right_width == 0 && ext.top_width == 0 && ext.bottom_width == 0 if (ext.left_width == 0 && ext.right_width == 0 && ext.top_width == 0 && ext.bottom_width == 0
&& (str.left != 0 || str.right != 0 || str.top != 0 || str.bottom != 0)) { && (str.left != 0 || str.right != 0 || str.top != 0 || str.bottom != 0)) {
// build extended from simple // build extended from simple
@ -4648,7 +4648,7 @@ NETExtendedStrut X11Client::strut() const
StrutRect X11Client::strutRect(StrutArea area) const StrutRect X11Client::strutRect(StrutArea area) const
{ {
Q_ASSERT(area != StrutAreaAll); // Not valid Q_ASSERT(area != StrutAreaAll); // Not valid
const QSize displaySize = screens()->displaySize(); const QSize displaySize = workspace()->geometry().size();
NETExtendedStrut strutArea = strut(); NETExtendedStrut strutArea = strut();
switch(area) { switch(area) {
case StrutAreaTop: case StrutAreaTop: