[kwin] Remove TemporaryAssign from utils.h

Only used in geometry.cpp for MaximizationState and that's no
longer needed.

REVIEW: 116902
This commit is contained in:
Martin Gräßlin 2014-03-19 15:01:56 +01:00
parent 1bc624f9f7
commit d6b346df92
2 changed files with 4 additions and 35 deletions

View file

@ -1863,13 +1863,8 @@ bool Client::isResizable() const
*/
bool Client::isMaximizable() const
{
{
// isMovable() and isResizable() may be false for maximized windows
// with moving/resizing maximized windows disabled
TemporaryAssign< MaximizeMode > tmp(max_mode, MaximizeRestore);
if (!isResizable() || isToolbar()) // SELI isToolbar() ?
return false;
}
if (!isResizable() || isToolbar()) // SELI isToolbar() ?
return false;
if (rules()->checkMaximize(MaximizeRestore) == MaximizeRestore && rules()->checkMaximize(MaximizeFull) != MaximizeRestore)
return true;
return false;
@ -2161,14 +2156,8 @@ void Client::changeMaximize(bool vertical, bool horizontal, bool adjust)
if (changeMaximizeRecursion)
return;
// sic! codeblock for TemporaryAssign
{
// isMovable() and isResizable() may be false for maximized windows
// with moving/resizing maximized windows disabled
TemporaryAssign< MaximizeMode > tmp(max_mode, MaximizeRestore);
if (!isResizable() || isToolbar()) // SELI isToolbar() ?
return;
}
if (!isResizable() || isToolbar()) // SELI isToolbar() ?
return;
QRect clientArea;
if (isElectricBorderMaximizing())

20
utils.h
View file

@ -127,26 +127,6 @@ enum ShadeMode {
ShadeActivated // "shaded", but visible due to alt+tab to the window
};
// Class which saves original value of the variable, assigns the new value
// to it, and in the destructor restores the value.
// Used in Client::isMaximizable() and so on.
// It also casts away contness and generally this looks like a hack.
template< typename T >
class TemporaryAssign
{
public:
TemporaryAssign(const T& var, const T& value)
: variable(var), orig(var) {
const_cast< T& >(variable) = value;
}
~TemporaryAssign() {
const_cast< T& >(variable) = orig;
}
private:
const T& variable;
T orig;
};
template <typename T>
class ScopedCPointer : public QScopedPointer<T, QScopedPointerPodDeleter>
{