diff --git a/client.cpp b/client.cpp index 87020b8853..ebd043f52a 100644 --- a/client.cpp +++ b/client.cpp @@ -103,6 +103,8 @@ Client::Client(Workspace* ws) , wrapper(None) , decoration(NULL) , bridge(new Bridge(this)) + , m_activityUpdatesBlocked(false) + , m_blockedActivityUpdatesRequireTransients(false) , move_resize_grab_window(None) , move_resize_has_keyboard_grab(false) , m_managed(false) @@ -1551,15 +1553,28 @@ void Client::setOnActivities(QStringList newActivitiesList) updateActivities(false); } +void Client::blockActivityUpdates(bool b) +{ + if (b) { + ++m_activityUpdatesBlocked; + } else { + Q_ASSERT(m_activityUpdatesBlocked); + --m_activityUpdatesBlocked; + if (!m_activityUpdatesBlocked) + updateActivities(m_blockedActivityUpdatesRequireTransients); + } +} + /** * update after activities changed */ void Client::updateActivities(bool includeTransients) { - /* FIXME do I need this? - if ( decoration != NULL ) - decoration->desktopChange(); - */ + if (m_activityUpdatesBlocked) { + m_blockedActivityUpdatesRequireTransients |= includeTransients; + return; + } + m_blockedActivityUpdatesRequireTransients = false; // reset if (includeTransients) workspace()->updateOnAllActivitiesOfTransients(this); FocusChain::self()->update(this, FocusChain::MakeFirst); diff --git a/client.h b/client.h index b3a439cc88..1e3a3458da 100644 --- a/client.h +++ b/client.h @@ -364,6 +364,7 @@ public: void setOnAllActivities(bool set); void setOnActivities(QStringList newActivitiesList); void updateActivities(bool includeTransients); + void blockActivityUpdates(bool b = true); /// Is not minimized and not hidden. I.e. normally visible on some virtual desktop. bool isShown(bool shaded_is_shown) const; @@ -848,6 +849,8 @@ private: Bridge* bridge; int desk; QStringList activityList; + int m_activityUpdatesBlocked; + bool m_blockedActivityUpdatesRequireTransients; bool buttonDown; bool moveResizeMode; Window move_resize_grab_window; diff --git a/clients/aurorae/src/aurorae.cpp b/clients/aurorae/src/aurorae.cpp index ec53269413..eee2a42a77 100644 --- a/clients/aurorae/src/aurorae.cpp +++ b/clients/aurorae/src/aurorae.cpp @@ -159,11 +159,8 @@ bool AuroraeFactory::reset(unsigned long changed) const QString themeName = group.readEntry("ThemeName", "example-deco"); const KConfig config("aurorae/themes/" + themeName + '/' + themeName + "rc", KConfig::FullConfig, "data"); const KConfigGroup themeGroup(&conf, themeName); - if (themeName != m_theme->themeName()) { - delete m_engine; - m_engine = new QDeclarativeEngine(this); - delete m_component; - m_component = new QDeclarativeComponent(m_engine, this); + if (themeName != m_themeName) { + m_engine->clearComponentCache(); init(); // recreate all decorations return true; diff --git a/useractions.cpp b/useractions.cpp index 9f21ce14f8..67e726ae8e 100755 --- a/useractions.cpp +++ b/useractions.cpp @@ -54,8 +54,8 @@ along with this program. If not, see . #include #endif #include +#include #include -#include #include #include @@ -156,9 +156,14 @@ void UserActionsMenu::show(const QRect &pos, const QWeakPointer &cl) Workspace *ws = Workspace::self(); int x = pos.left(); int y = pos.bottom(); - if (y == pos.top()) + if (y == pos.top()) { + m_client.data()->blockActivityUpdates(true); m_menu->exec(QPoint(x, y)); + if (!m_client.isNull()) + m_client.data()->blockActivityUpdates(false); + } else { + m_client.data()->blockActivityUpdates(true); QRect area = ws->clientArea(ScreenArea, QPoint(x, y), VirtualDesktopManager::self()->current()); menuAboutToShow(); // needed for sizeHint() to be correct :-/ int popupHeight = m_menu->sizeHint().height(); @@ -166,6 +171,8 @@ void UserActionsMenu::show(const QRect &pos, const QWeakPointer &cl) m_menu->exec(QPoint(x, y)); else m_menu->exec(QPoint(x, pos.top() - popupHeight)); + if (!m_client.isNull()) + m_client.data()->blockActivityUpdates(true); } } @@ -710,13 +717,22 @@ void UserActionsMenu::activityPopupAboutToShow() KActivities::Info activity(id); QString name = activity.name(); name.replace('&', "&&"); - action = m_activityMenu->addAction(KIcon(activity.icon()), name); + QWidgetAction *action = new QWidgetAction(m_activityMenu); + QCheckBox *box = new QCheckBox(name, m_activityMenu); + action->setDefaultWidget(box); + const QString icon = activity.icon(); + if (!icon.isEmpty()) + box->setIcon(KIcon(icon)); + box->setBackgroundRole(m_activityMenu->backgroundRole()); + box->setForegroundRole(m_activityMenu->foregroundRole()); + box->setPalette(m_activityMenu->palette()); + connect (box, SIGNAL(clicked(bool)), action, SIGNAL(triggered(bool))); + m_activityMenu->addAction(action); action->setData(id); - action->setCheckable(true); if (!m_client.isNull() && !m_client.data()->isOnAllActivities() && m_client.data()->isOnActivity(id)) - action->setChecked(true); + box->setChecked(true); } #endif } @@ -796,6 +812,9 @@ void UserActionsMenu::slotToggleOnActivity(QAction *action) } Workspace::self()->toggleClientOnActivity(m_client.data(), activity, false); + if (m_activityMenu && m_activityMenu->isVisible() && m_activityMenu->actions().count()) { + m_activityMenu->actions().at(0)->setChecked(m_client.data()->isOnAllActivities()); + } } //****************************************