From d6b346df92b17b56e88107c0673f31a970749305 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Wed, 19 Mar 2014 15:01:56 +0100 Subject: [PATCH] [kwin] Remove TemporaryAssign from utils.h Only used in geometry.cpp for MaximizationState and that's no longer needed. REVIEW: 116902 --- geometry.cpp | 19 ++++--------------- utils.h | 20 -------------------- 2 files changed, 4 insertions(+), 35 deletions(-) diff --git a/geometry.cpp b/geometry.cpp index c63342723f..a79388d165 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -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()) diff --git a/utils.h b/utils.h index 40e969c38c..2376d08769 100644 --- a/utils.h +++ b/utils.h @@ -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 class ScopedCPointer : public QScopedPointer {