From f689df14d5d72511e7abd8a36c42ce666aea36c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 22 Nov 2012 13:33:23 +0100 Subject: [PATCH] Remove Placement wrappers from Workspace The two methods: * place * placeSmart have only forwarded the call to the Placement object. Now that Placement is a singleton there is no need to have them. Every user can call them directly without going over Workspace. --- geometry.cpp | 8 ++++---- manage.cpp | 2 +- placement.cpp | 13 ------------- workspace.h | 3 --- 4 files changed, 5 insertions(+), 21 deletions(-) diff --git a/geometry.cpp b/geometry.cpp index fb02564b97..6a7ded4cc2 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -2195,7 +2195,7 @@ void Client::changeMaximize(bool vertical, bool horizontal, bool adjust) if (geom_restore.width() == 0 || !clientArea.contains(geom_restore.center())) { // needs placement plainResize(adjustedSize(QSize(width() * 2 / 3, clientArea.height()), SizemodeFixedH), geom_mode); - workspace()->placeSmart(this, clientArea); + Placement::self()->placeSmart(this, clientArea); } else { setGeometry(QRect(QPoint(geom_restore.x(), clientArea.top()), adjustedSize(QSize(geom_restore.width(), clientArea.height()), SizemodeFixedH)), geom_mode); @@ -2213,7 +2213,7 @@ void Client::changeMaximize(bool vertical, bool horizontal, bool adjust) if (geom_restore.height() == 0 || !clientArea.contains(geom_restore.center())) { // needs placement plainResize(adjustedSize(QSize(clientArea.width(), height() * 2 / 3), SizemodeFixedW), geom_mode); - workspace()->placeSmart(this, clientArea); + Placement::self()->placeSmart(this, clientArea); } else { setGeometry(QRect(QPoint(clientArea.left(), geom_restore.y()), adjustedSize(QSize(clientArea.width(), geom_restore.height()), SizemodeFixedW)), geom_mode); @@ -2244,7 +2244,7 @@ void Client::changeMaximize(bool vertical, bool horizontal, bool adjust) if (geom_restore.height() > 0) s.setHeight(geom_restore.height()); plainResize(adjustedSize(s)); - workspace()->placeSmart(this, clientArea); + Placement::self()->placeSmart(this, clientArea); restore = geometry(); if (geom_restore.width() > 0) restore.moveLeft(geom_restore.x()); @@ -2254,7 +2254,7 @@ void Client::changeMaximize(bool vertical, bool horizontal, bool adjust) } setGeometry(restore, geom_mode); if (!clientArea.contains(geom_restore.center())) // Not restoring to the same screen - workspace()->place(this, clientArea); + Placement::self()->place(this, clientArea); info->setState(0, NET::Max); break; } diff --git a/manage.cpp b/manage.cpp index 43df1b9e78..8d562c6c2e 100644 --- a/manage.cpp +++ b/manage.cpp @@ -367,7 +367,7 @@ bool Client::manage(Window w, bool isMapped) } if (!placementDone) { // Placement needs to be after setting size - workspace()->place(this, area); + Placement::self()->place(this, area); placementDone = true; } diff --git a/placement.cpp b/placement.cpp index cc25e8607f..ff75e6cc1c 100644 --- a/placement.cpp +++ b/placement.cpp @@ -885,19 +885,6 @@ int Workspace::packPositionDown(const Client* cl, int oldy, bool bottom_edge) co return newy; } -/*! - Asks the internal positioning object to place a client -*/ -void Workspace::place(Client* c, QRect& area) -{ - initPositioning->place(c, area); -} - -void Workspace::placeSmart(Client* c, const QRect& area) -{ - initPositioning->placeSmart(c, area); -} - #endif } // namespace diff --git a/workspace.h b/workspace.h index c0f4c541e0..13783f55df 100644 --- a/workspace.h +++ b/workspace.h @@ -158,9 +158,6 @@ public: */ void setClientIsMoving(Client* c); - void place(Client* c, QRect& area); - void placeSmart(Client* c, const QRect& area); - QPoint adjustClientPosition(Client* c, QPoint pos, bool unrestricted, double snapAdjust = 1.0); QRect adjustClientSize(Client* c, QRect moveResizeGeom, int mode); void raiseClient(Client* c, bool nogroup = false);