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

List:       kde-commits
Subject:    [kde-workspace] kwin/tabbox: [kwin/tabbox] Recreate DeclarativeTabBoxView every time it's shown
From:       Martin_Gräßlin <mgraesslin () kde ! org>
Date:       2013-10-25 12:22:55
Message-ID: E1VZgPn-0003PB-4I () scm ! kde ! org
[Download RAW message or body]

Git commit 87c3f4e65b65b1cd7e01ea808610d72ca08abd7a by Martin Gräßlin.
Committed on 25/10/2013 at 12:16.
Pushed by graesslin into branch 'master'.

[kwin/tabbox] Recreate DeclarativeTabBoxView every time it's shown

Not the best solution, but at least TabBox works each time it's invoked.
It doesn't make much of a difference as the QML is reparsed anyway at
each show.

M  +11   -17   kwin/tabbox/tabboxhandler.cpp

http://commits.kde.org/kde-workspace/87c3f4e65b65b1cd7e01ea808610d72ca08abd7a

diff --git a/kwin/tabbox/tabboxhandler.cpp b/kwin/tabbox/tabboxhandler.cpp
index 8e60d59..10cc6a9 100644
--- a/kwin/tabbox/tabboxhandler.cpp
+++ b/kwin/tabbox/tabboxhandler.cpp
@@ -64,8 +64,8 @@ public:
     TabBoxHandler *q; // public pointer
     // members
     TabBoxConfig config;
-    DeclarativeView *m_declarativeView;
-    DeclarativeView *m_declarativeDesktopView;
+    QScopedPointer<DeclarativeView> m_declarativeView;
+    QScopedPointer<DeclarativeView> m_declarativeDesktopView;
     ClientModel* m_clientModel;
     DesktopModel* m_desktopModel;
     QModelIndex index;
@@ -100,8 +100,6 @@ TabBoxHandlerPrivate::TabBoxHandlerPrivate(TabBoxHandler *q)
 
 TabBoxHandlerPrivate::~TabBoxHandlerPrivate()
 {
-    delete m_declarativeView;
-    delete m_declarativeDesktopView;
 }
 
 ClientModel* TabBoxHandlerPrivate::clientModel() const
@@ -122,7 +120,7 @@ void TabBoxHandlerPrivate::updateHighlightWindows()
     TabBoxClient *currentClient = q->client(index);
     QWindow *w = NULL;
     if (m_declarativeView && m_declarativeView->isVisible()) {
-        w = m_declarativeView;
+        w = m_declarativeView.data();
     }
 
     if (q->isKWinCompositing()) {
@@ -220,14 +218,14 @@ void TabBoxHandler::show()
         if (d->config.tabBoxMode() == TabBoxConfig::ClientTabBox) {
             // use declarative view
             if (!d->m_declarativeView) {
-                d->m_declarativeView = new DeclarativeView(d->clientModel(), \
TabBoxConfig::ClientTabBox); +                d->m_declarativeView.reset(new \
DeclarativeView(d->clientModel(), TabBoxConfig::ClientTabBox));  }
-            dv = d->m_declarativeView;
+            dv = d->m_declarativeView.data();
         } else {
             if (!d->m_declarativeDesktopView) {
-                d->m_declarativeDesktopView = new DeclarativeView(d->desktopModel(), \
TabBoxConfig::DesktopTabBox); +                d->m_declarativeDesktopView.reset(new \
DeclarativeView(d->desktopModel(), TabBoxConfig::DesktopTabBox));  }
-            dv = d->m_declarativeDesktopView;
+            dv = d->m_declarativeDesktopView.data();
         }
         if (dv->status() == QQuickView::Ready && dv->rootObject()) {
             dv->show();
@@ -262,12 +260,8 @@ void TabBoxHandler::hide(bool abort)
     if (d->config.isHighlightWindows()) {
         d->endHighlightWindows(abort);
     }
-    if (d->m_declarativeView) {
-        d->m_declarativeView->hide();
-    }
-    if (d->m_declarativeDesktopView) {
-        d->m_declarativeDesktopView->hide();
-    }
+    d->m_declarativeView.reset();
+    d->m_declarativeDesktopView.reset();
 }
 
 QModelIndex TabBoxHandler::nextPrev(bool forward) const
@@ -387,9 +381,9 @@ bool TabBoxHandler::containsPos(const QPoint& pos) const
 {
     QWindow *w = NULL;
     if (d->m_declarativeView && d->m_declarativeView->isVisible()) {
-        w = d->m_declarativeView;
+        w = d->m_declarativeView.data();
     } else if (d->m_declarativeDesktopView && \
                d->m_declarativeDesktopView->isVisible()) {
-        w = d->m_declarativeDesktopView;
+        w = d->m_declarativeDesktopView.data();
     } else {
         return false;
     }


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

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