[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/workspace/plasma/applets/systemtray
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2008-06-30 21:46:23
Message-ID: 1214862383.120196.20389.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 826530 by aseigo:

can't take the "sytem tray populating" dance anymore. introducing this small hack to \
simply not show the system tray or adjust our size at startup until we stop getting \
new embeds. from that point forward it's business as usual, but this prevents all \
those panel relayouts, white blockynesses and what not.

the hack is slightly crude: it's hardcoded to 1500ms as being the trigger time \
between embeds. on my systems here it's a regualar 1000ms +-100ms between embeds, so \
1500ms seems to be a nice number. will have to see how it works for others.


 M  +22 -2     systemtray.cpp  
 M  +7 -2      systemtray.h  
 M  +0 -1      systemtraywidget.cpp  


--- trunk/KDE/kdebase/workspace/plasma/applets/systemtray/systemtray.cpp \
#826529:826530 @@ -25,12 +25,14 @@
 
 // Qt
 #include <QGraphicsView>
+#include <QTimer>
 
 //Plasma
 #include <plasma/panelsvg.h>
 
 SystemTray::SystemTray(QObject *parent, const QVariantList &arguments)
     : Plasma::Applet(parent, arguments),
+      m_startUpDelayShowTimer(0),
       m_showOwnBackground(false)
 {
     m_background = new Plasma::PanelSvg(this);
@@ -86,17 +88,28 @@
 {
     QGraphicsView *parentView = view();
     if (!parentView) {
-        kDebug()<<"Problem view is NULL";
+        kDebug() << "Problem view is NULL";
         return;
     }
 
+    if (m_startUpDelayShowTimer) {
+        kDebug() << "start up delay";
+        m_startUpDelayShowTimer->start(STARTUP_TIMER_DELAY);
+        return;
+    }
+
     if (!m_systemTrayWidget || m_systemTrayWidget->parentWidget() != parentView) {
         delete m_systemTrayWidget;
         m_systemTrayWidget = new SystemTrayWidget(parentView);
         updateWidgetOrientation();
         connect(m_systemTrayWidget, SIGNAL(sizeShouldChange()),
                 this, SLOT(updateWidgetGeometry()));
-        m_systemTrayWidget->setVisible(true);
+
+        if (!m_startUpDelayShowTimer) {
+            m_startUpDelayShowTimer = new QTimer(this);
+            connect(m_startUpDelayShowTimer, SIGNAL(timeout()), this, \
SLOT(startupDelayer())); +            \
m_startUpDelayShowTimer->start(STARTUP_TIMER_DELAY); +        }
     }
 
     // Figure out the margins set by the background svg and disable the svg
@@ -148,4 +161,11 @@
     m_systemTrayWidget->setGeometry(r);
 }
 
+void SystemTray::startupDelayer()
+{
+    delete m_startUpDelayShowTimer;
+    m_startUpDelayShowTimer = 0;
+    m_systemTrayWidget->setVisible(true);
+}
+
 #include "systemtray.moc"
--- trunk/KDE/kdebase/workspace/plasma/applets/systemtray/systemtray.h #826529:826530
@@ -32,6 +32,8 @@
 // Plasma
 #include <plasma/applet.h>
 
+class QTimer;
+
 namespace Plasma
 {
     class PanelSvg;
@@ -44,20 +46,23 @@
 public:
     explicit SystemTray(QObject *parent, const QVariantList &arguments = \
QVariantList());  ~SystemTray();
-  
+
     void constraintsEvent(Plasma::Constraints constraints);
-
     void paintInterface(QPainter *painter,
                         const QStyleOptionGraphicsItem *option,
                         const QRect &contentsRect);
 
 private slots:
     void updateWidgetGeometry();
+    void startupDelayer();
 
 private:
     void updateWidgetOrientation();
 
+    static const int STARTUP_TIMER_DELAY = 1500;
+
     Plasma::PanelSvg *m_background;
+    QTimer *m_startUpDelayShowTimer;
     bool m_showOwnBackground;
 
     // The parent widget might delete this so we guard it
--- trunk/KDE/kdebase/workspace/plasma/applets/systemtray/systemtraywidget.cpp \
#826529:826530 @@ -87,7 +87,6 @@
     if (event->type == ClientMessage) {
         if (event->xclient.message_type == m_opcodeAtom &&
             event->xclient.data.l[1] == SYSTEM_TRAY_REQUEST_DOCK) {
-
             // Set up a SystemTrayContainer for the client
             SystemTrayContainer *container = new SystemTrayContainer(this);
             connect(container, SIGNAL(destroyed(QObject *)), this, \
SLOT(relayoutContainers(QObject *)));


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic