From 717bd9c929c96d4746685b9d4bdf29fa71d937b1 Mon Sep 17 00:00:00 2001
From: Andrei Karas <akaras@inbox.ru>
Date: Sun, 10 May 2015 17:54:00 +0300
Subject: Improve window resize speed.

---
 src/gui/widgets/window.cpp | 15 ++++++++++-----
 src/gui/widgets/window.h   |  3 +++
 2 files changed, 13 insertions(+), 5 deletions(-)

(limited to 'src/gui')

diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index c438b5475..cd526db98 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -138,6 +138,9 @@ Window::Window(const std::string &caption,
     mGripPadding(2),
     mResizeHandles(-1),
     mOldResizeHandles(-1),
+    mClosePadding(0),
+    mStickySpacing(0),
+    mStickyPadding(0),
     mCaptionFont(getFont()),
     mModal(modal),
     mShowTitle(true),
@@ -196,6 +199,9 @@ Window::Window(const std::string &caption,
             setPalette(getOption("palette"));
             childPalette = getOption("childPalette");
             mShowTitle = getOptionBool("showTitle", true);
+            mClosePadding = getOption("closePadding");
+            mStickySpacing = getOption("stickySpacing");
+            mStickyPadding = getOption("stickyPadding");
         }
     }
 
@@ -570,13 +576,12 @@ void Window::widgetResized(const Event &event A_UNUSED)
     {
         const bool showClose = mCloseWindowButton
             && mSkin->getCloseImage(false);
-        const int closePadding = getOption("closePadding");
         if (showClose)
         {
             const Image *const button = mSkin->getCloseImage(false);
             const int buttonWidth = button->getWidth();
-            mCloseRect.x = mDimension.width - buttonWidth - closePadding;
-            mCloseRect.y = closePadding;
+            mCloseRect.x = mDimension.width - buttonWidth - mClosePadding;
+            mCloseRect.y = mClosePadding;
             mCloseRect.width = buttonWidth;
             mCloseRect.height = button->getHeight();
         }
@@ -587,13 +592,13 @@ void Window::widgetResized(const Event &event A_UNUSED)
             {
                 const int buttonWidth = button->getWidth();
                 int x = mDimension.width - buttonWidth
-                    - getOption("stickySpacing") - closePadding;
+                    - mStickySpacing - mClosePadding;
 
                 if (showClose)
                     x -= mSkin->getCloseImage(false)->getWidth();
 
                 mStickyRect.x = x;
-                mStickyRect.y = getOption("stickyPadding");
+                mStickyRect.y = mStickyPadding;
                 mStickyRect.width = buttonWidth;
                 mStickyRect.height = button->getHeight();
             }
diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h
index 2b2bdb261..386b7e16b 100644
--- a/src/gui/widgets/window.h
+++ b/src/gui/widgets/window.h
@@ -692,6 +692,9 @@ class Window notfinal : public BasicContainer2,
         int mGripPadding;
         int mResizeHandles;
         int mOldResizeHandles;
+        int mClosePadding;
+        int mStickySpacing;
+        int mStickyPadding;
         Font *mCaptionFont;
         Modal mModal;                 /**< Window is modal */
         bool mShowTitle;              /**< Window has a title bar */
-- 
cgit v1.2.3-70-g09d2