partitially revert 92c0cae and remove some activities related cruft

This commit is contained in:
Ivailo Monev 2015-01-16 02:17:28 +00:00
parent 656348fc8b
commit 187981587b
11 changed files with 14 additions and 306 deletions

View file

@ -96,6 +96,7 @@ static Atom kde_net_wm_window_type_override = 0;
static Atom kde_net_wm_window_type_topmenu = 0;
static Atom kde_net_wm_temporary_rules = 0;
static Atom kde_net_wm_frame_overlap = 0;
static Atom kde_net_wm_activities = 0;
static Atom kde_net_wm_block_compositing = 0;
static Atom kde_net_wm_shadow = 0;
@ -235,7 +236,6 @@ static void refdec_nwi(NETWinInfoPrivate *p) {
delete [] p->startup_id;
delete [] p->class_class;
delete [] p->class_name;
delete [] p->activities;
int i;
for (i = 0; i < p->icons.size(); i++)
@ -353,6 +353,7 @@ static void create_netwm_atoms(Display *d) {
"WM_PROTOCOLS",
"_NET_WM_FULL_PLACEMENT",
"_KDE_NET_WM_ACTIVITIES",
"_KDE_NET_WM_BLOCK_COMPOSITING",
"_KDE_NET_WM_SHADOW"
};
@ -453,6 +454,7 @@ static void create_netwm_atoms(Display *d) {
&wm_protocols,
&net_wm_full_placement,
&kde_net_wm_activities,
&kde_net_wm_block_compositing,
&kde_net_wm_shadow
};
@ -1291,6 +1293,9 @@ void NETRootInfo::setSupported() {
if (p->properties[ PROTOCOLS2 ] & WM2FullPlacement)
atoms[pnum++] = net_wm_full_placement;
if (p->properties[ PROTOCOLS2 ] & WM2Activities)
atoms[pnum++] = kde_net_wm_activities;
if (p->properties[ PROTOCOLS2 ] & WM2BlockCompositing)
atoms[pnum++] = kde_net_wm_block_compositing;
@ -1533,6 +1538,9 @@ void NETRootInfo::updateSupportedProperties( Atom atom )
else if( atom == net_wm_full_placement )
p->properties[ PROTOCOLS2 ] |= WM2FullPlacement;
else if( atom == kde_net_wm_activities )
p->properties[ PROTOCOLS2 ] |= WM2Activities;
else if( atom == kde_net_wm_block_compositing )
p->properties[ PROTOCOLS2 ] |= WM2BlockCompositing;
@ -2787,7 +2795,6 @@ NETWinInfo::NETWinInfo(Display *display, Window window, Window rootWindow,
p->window_role = (char*) 0;
p->client_machine = (char*) 0;
p->icon_sizes = NULL;
p->activities = (char *) 0;
p->blockCompositing = false;
// p->strut.left = p->strut.right = p->strut.top = p->strut.bottom = 0;
@ -2851,7 +2858,6 @@ NETWinInfo::NETWinInfo(Display *display, Window window, Window rootWindow,
p->window_role = (char*) 0;
p->client_machine = (char*) 0;
p->icon_sizes = NULL;
p->activities = (char *) 0;
p->blockCompositing = false;
// p->strut.left = p->strut.right = p->strut.top = p->strut.bottom = 0;
@ -3873,6 +3879,8 @@ void NETWinInfo::event(XEvent *event, unsigned long* properties, int properties_
dirty2 |= WM2WindowRole;
else if (pe.xproperty.atom == XA_WM_CLIENT_MACHINE)
dirty2 |= WM2ClientMachine;
else if (pe.xproperty.atom == kde_net_wm_activities)
dirty2 |= WM2Activities;
else if (pe.xproperty.atom == kde_net_wm_block_compositing)
dirty2 |= WM2BlockCompositing;
else if (pe.xproperty.atom == kde_net_wm_shadow)
@ -4664,10 +4672,6 @@ const char* NETWinInfo::clientMachine() const {
return p->client_machine;
}
const char* NETWinInfo::activities() const {
return p->activities;
}
void NETWinInfo::setBlockingCompositing(bool active) {
if (p->role != Client) return;

View file

@ -1268,14 +1268,6 @@ public:
*/
const char* clientMachine() const;
/**
* returns a comma-separated list of the activities the window is associated with.
* FIXME this might be better as a NETRArray ?
* @since 4.6
*/
const char* activities() const;
/**
* Sets whether the client wishes to block compositing (for better performance)
* @since 4.7

View file

@ -692,8 +692,9 @@ public:
WM2FullPlacement = 1<<16,
WM2FullscreenMonitors = 1<<17,
WM2FrameOverlap = 1<<18, // NOT STANDARD
WM2BlockCompositing = 1<<19, // NOT STANDARD @since 4.7
WM2KDEShadow = 1<<20 // NOT Standard @since 4.7
WM2Activities = 1<<19, // NOT STANDARD @since 4.6
WM2BlockCompositing = 1<<20, // NOT STANDARD @since 4.7
WM2KDEShadow = 1<<21 // NOT Standard @since 4.7
};
/**

View file

@ -154,7 +154,6 @@ struct NETWinInfoPrivate {
NETFullscreenMonitors fullscreen_monitors;
bool has_net_support;
char *activities;
bool blockCompositing;
int ref;

View file

@ -84,7 +84,6 @@ set(plasma_LIB_SRCS
containment.cpp
containmentactions.cpp
containmentactionspluginsconfig.cpp
context.cpp
corona.cpp
datacontainer.cpp
dataengine.cpp
@ -266,7 +265,6 @@ set(plasma_LIB_INCLUDES
containment.h
containmentactions.h
containmentactionspluginsconfig.h
context.h
corona.h
datacontainer.h
dataengine.h

View file

@ -1611,13 +1611,6 @@ Location Applet::location() const
return c ? c->d->location : Plasma::Desktop;
}
Context *Applet::context() const
{
Containment *c = containment();
Q_ASSERT(c);
return c->d->context();
}
Plasma::AspectRatioMode Applet::aspectRatioMode() const
{
return d->aspectRatioMode;

View file

@ -270,11 +270,6 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
*/
virtual Location location() const;
/**
* Returns the workspace context which the applet is operating in
*/
Context *context() const;
/**
* @return the preferred aspect ratio mode for placement and resizing
*/

View file

@ -54,7 +54,6 @@
#include "abstracttoolbox.h"
#include "animator.h"
#include "context.h"
#include "containmentactions.h"
#include "containmentactionspluginsconfig.h"
#include "corona.h"
@ -204,11 +203,6 @@ void Containment::init()
}
if (d->type != PanelContainment && d->type != CustomPanelContainment) {
if (corona()) {
//FIXME this is just here because of the darn keyboard shortcut :/
act = corona()->action("manage activities");
if (act) {
d->actions()->addAction("manage activities", act);
}
//a stupid hack to make this one's keyboard shortcut work
act = corona()->action("configure shortcuts");
if (act) {
@ -239,14 +233,6 @@ void ContainmentPrivate::addDefaultActions(KActionCollection *actions, Containme
appAction->setShortcut(KShortcut("alt+d, alt+r"));
if (c && c->d->isPanelContainment()) {
appAction->setText(i18n("Remove this Panel"));
} else {
appAction->setText(i18n("Remove this Activity"));
}
appAction = qobject_cast<KAction*>(actions->action("configure"));
if (appAction) {
appAction->setShortcut(KShortcut("alt+d, alt+s"));
appAction->setText(i18n("Activity Settings"));
}
//add our own actions
@ -324,11 +310,6 @@ void Containment::restore(KConfigGroup &group)
d->lastScreen = group.readEntry("lastScreen", d->lastScreen);
d->lastDesktop = group.readEntry("lastDesktop", d->lastDesktop);
d->setScreen(group.readEntry("screen", d->screen), group.readEntry("desktop", d->desktop), false);
QString activityId = group.readEntry("activityId", QString());
if (!activityId.isEmpty()) {
d->context()->setCurrentActivityId(activityId);
}
setActivity(group.readEntry("activity", QString()));
flushPendingConstraintsEvents();
restoreContents(group);
@ -351,11 +332,6 @@ void Containment::restore(KConfigGroup &group)
if (source == "Global") {
cfg = KConfigGroup(corona()->config(), "ActionPlugins");
d->containmentActionsSource = ContainmentPrivate::Global;
} else if (source == "Activity") {
cfg = KConfigGroup(corona()->config(), "Activities");
cfg = KConfigGroup(&cfg, activityId);
cfg = KConfigGroup(&cfg, "ActionPlugins");
d->containmentActionsSource = ContainmentPrivate::Activity;
} else if (source == "Local") {
cfg = group;
d->containmentActionsSource = ContainmentPrivate::Local;
@ -420,8 +396,6 @@ void Containment::save(KConfigGroup &g) const
group.writeEntry("lastDesktop", d->lastDesktop);
group.writeEntry("formfactor", (int)d->formFactor);
group.writeEntry("location", (int)d->location);
group.writeEntry("activity", d->context()->currentActivity());
group.writeEntry("activityId", d->context()->currentActivityId());
QMetaObject::invokeMethod(d->toolBox.data(), "save", Q_ARG(KConfigGroup, group));
@ -984,8 +958,6 @@ void ContainmentPrivate::setScreen(int newScreen, int newDesktop, bool preventIn
newDesktop = -1;
}
//kDebug() << activity() << "setting screen to " << newScreen << newDesktop << "and type is" << type;
Containment *swapScreensWith(0);
const bool isDesktopContainment = type == Containment::DesktopContainment ||
type == Containment::CustomContainment;
@ -1005,7 +977,6 @@ void ContainmentPrivate::setScreen(int newScreen, int newDesktop, bool preventIn
if (currently && currently != q) {
kDebug() << "currently is on screen" << currently->screen()
<< "desktop" << currently->desktop()
<< "and is" << currently->activity()
<< (QObject*)currently << "i'm" << (QObject*)q;
currently->setScreen(-1, currently->desktop());
swapScreensWith = currently;
@ -1866,8 +1837,6 @@ void Containment::setContainmentActions(const QString &trigger, const QString &p
}
} else {
switch (d->containmentActionsSource) {
case ContainmentPrivate::Activity:
//FIXME
case ContainmentPrivate::Local:
plugin = ContainmentActions::load(this, pluginName);
break;
@ -1897,62 +1866,6 @@ QString Containment::containmentActions(const QString &trigger)
return c ? c->pluginName() : QString();
}
void Containment::setActivity(const QString &activity)
{
Context *context = d->context();
if (context->currentActivity() != activity) {
context->setCurrentActivity(activity);
}
}
void ContainmentPrivate::onContextChanged(Plasma::Context *con)
{
foreach (Applet *a, applets) {
a->updateConstraints(ContextConstraint);
}
KConfigGroup c = q->config();
QString act = con->currentActivityId();
//save anything that's been set (boy I hope this avoids overwriting things)
//FIXME of course if the user sets the name to an empty string we have a bug
//but once we get context retrieving the name as soon as the id is set, this issue should go away
if (!act.isEmpty()) {
c.writeEntry("activityId", act);
}
act = con->currentActivity();
if (!act.isEmpty()) {
c.writeEntry("activity", act);
}
if (toolBox) {
toolBox.data()->update();
}
emit q->configNeedsSaving();
emit q->contextChanged(con);
}
QString Containment::activity() const
{
return d->context()->currentActivity();
}
Context *Containment::context() const
{
return d->context();
}
Context *ContainmentPrivate::context()
{
if (!con) {
con = new Context(q);
q->connect(con, SIGNAL(changed(Plasma::Context*)),
q, SLOT(onContextChanged(Plasma::Context*)));
}
return con;
}
KActionCollection* ContainmentPrivate::actions()
{
return static_cast<Applet*>(q)->d->actions;
@ -2400,11 +2313,6 @@ KConfigGroup Containment::containmentActionsConfig()
cfg = config();
cfg = KConfigGroup(&cfg, "ActionPlugins");
break;
case ContainmentPrivate::Activity:
cfg = KConfigGroup(corona()->config(), "Activities");
cfg = KConfigGroup(&cfg, d->context()->currentActivityId());
cfg = KConfigGroup(&cfg, "ActionPlugins");
break;
default:
cfg = KConfigGroup(corona()->config(), "ActionPlugins");
}
@ -2414,8 +2322,6 @@ KConfigGroup Containment::containmentActionsConfig()
QHash<QString, ContainmentActions*> * ContainmentPrivate::actionPlugins()
{
switch (containmentActionsSource) {
case Activity:
//FIXME
case Local:
return &localActionPlugins;
default:

View file

@ -355,24 +355,6 @@ class PLASMA_EXPORT Containment : public Applet
*/
Plasma::Wallpaper *wallpaper() const;
/**
* Sets the current activity by name
*
* @param activity the name of the activity
*/
void setActivity(const QString &activity);
/**
* @return the current activity name associated with this containment
*/
QString activity() const;
/**
* @return the context for this containment
* @since 4.5
*/
Context* context() const;
/**
* Shows the context menu for the containment directly, bypassing Applets
* altogether.
@ -474,11 +456,6 @@ Q_SIGNALS:
*/
void configureRequested(Plasma::Containment *containment);
/**
* The context associated to this containment has changed
*/
void contextChanged(Plasma::Context *context);
public Q_SLOTS:
/**
* Informs the Corona as to what position it is in. This is informational
@ -646,7 +623,6 @@ Q_SIGNALS:
Q_PRIVATE_SLOT(d, void updateToolBoxVisibility())
Q_PRIVATE_SLOT(d, void showDropZoneDelayed())
Q_PRIVATE_SLOT(d, void checkStatus(Plasma::ItemStatus))
Q_PRIVATE_SLOT(d, void onContextChanged(Plasma::Context *con))
/**
* This slot is called when the 'stat' after a job event has finished.
*/

View file

@ -1,89 +0,0 @@
/*
* Copyright 2008 by Aaron Seigo <aseigo@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "context.h"
namespace Plasma
{
class ContextPrivate
{
public:
QString activityId;
QString activityName;
};
Context::Context(QObject *parent)
: QObject(parent),
d(new ContextPrivate)
{
//TODO: look up activity in Nepomuk
//except we can't, because that code is in kdebase.
}
Context::~Context()
{
delete d;
}
void Context::createActivity(const QString &name)
{
Q_UNUSED(name);
}
QStringList Context::listActivities() const
{
return QStringList();
}
void Context::setCurrentActivity(const QString &name)
{
if (d->activityName == name || name.isEmpty()) {
return;
}
d->activityName = name;
emit activityChanged(this);
emit changed(this);
}
QString Context::currentActivity() const
{
return d->activityName;
}
void Context::setCurrentActivityId(const QString &id)
{
if (d->activityId == id) {
return;
}
d->activityId = id;
emit changed(this);
}
QString Context::currentActivityId() const
{
return d->activityId;
}
} // namespace Plasma
#include "context.moc"

View file

@ -1,67 +0,0 @@
/*
* Copyright 2008 by Aaron Seigo <aseigo@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef PLASMA_CONTEXT_H
#define PLASMA_CONTEXT_H
#include <QtCore/QObject>
#include <QtCore/QStringList>
#include "plasma_export.h"
namespace Plasma
{
class ContextPrivate;
class PLASMA_EXPORT Context : public QObject
{
Q_OBJECT
public:
explicit Context(QObject *parent = 0);
~Context();
//don't use these two
void createActivity(const QString &name);
QStringList listActivities() const;
//activity name
void setCurrentActivity(const QString &name);
QString currentActivity() const;
//activity id
void setCurrentActivityId(const QString &id);
QString currentActivityId() const;
//TODO: location
Q_SIGNALS:
void changed(Plasma::Context *context);
void activityChanged(Plasma::Context *context);
void locationChanged(Plasma::Context *context);
private:
ContextPrivate * const d;
};
} // namespace Plasma
#endif // multiple inclusion guard