Branch: master

745063fa 2014-07-08 08:27:10 Timothy Pearson
Avoid excessively long Klipper startup time due to oversized tray icon creation when icon widget has not yet been shown
M klipper/toplevel.cpp
diff --git a/klipper/toplevel.cpp b/klipper/toplevel.cpp
index b30d551..ba4b255 100644
--- a/klipper/toplevel.cpp
+++ b/klipper/toplevel.cpp
@@ -198,12 +198,21 @@
 
     if ( isApplet() ) {
         m_pixmap = KSystemTray::loadIcon( "klipper" );
+        m_iconOrigWidth = width();
+        m_iconOrigHeight = height();
     }
     else {
-        m_pixmap = KSystemTray::loadSizedIcon( "klipper", width() );
+        if (isShown()) {
+            m_pixmap = KSystemTray::loadSizedIcon( "klipper", width() );
+            m_iconOrigWidth = width();
+            m_iconOrigHeight = height();
+        }
+        else {
+            m_pixmap = KSystemTray::loadIcon( "klipper" );
+            m_iconOrigWidth = m_pixmap.width();
+            m_iconOrigHeight = m_pixmap,height();
+        }
     }
-    m_iconOrigWidth = width();
-    m_iconOrigHeight = height();
     adjustSize();
 
     globalKeys = new TDEGlobalAccel(TQT_TQOBJECT(this));