don't load the wallpaper config until we paint. this means that if we have off-screen containments, even with complex wallpapers, they don't take up unecessary memory or delay start up because they won't render the wallpaper until the first paint event.
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=872755
This commit is contained in:
parent
390f76d33a
commit
b5df90348f
@ -963,6 +963,15 @@ void Applet::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QW
|
||||
if (!v || v->isWallpaperEnabled()) {
|
||||
Containment* c = qobject_cast<Plasma::Containment*>(this);
|
||||
if (c && c->drawWallpaper() && c->wallpaper()) {
|
||||
Wallpaper *w = c->wallpaper();
|
||||
if (!w->isInitialized()) {
|
||||
// delayed paper initialization
|
||||
KConfigGroup wallpaperConfig = c->config();
|
||||
wallpaperConfig = KConfigGroup(&wallpaperConfig, "Wallpaper");
|
||||
wallpaperConfig = KConfigGroup(&wallpaperConfig, w->pluginName());
|
||||
w->restore(wallpaperConfig);
|
||||
}
|
||||
|
||||
p->save();
|
||||
c->wallpaper()->paint(p, option->exposedRect);
|
||||
p->restore();
|
||||
|
@ -301,9 +301,12 @@ void Containment::save(KConfigGroup &g) const
|
||||
if (d->wallpaper) {
|
||||
group.writeEntry("wallpaperplugin", d->wallpaper->pluginName());
|
||||
group.writeEntry("wallpaperpluginmode", d->wallpaper->renderingMode().name());
|
||||
KConfigGroup wallpaperConfig(&group, "Wallpaper");
|
||||
wallpaperConfig = KConfigGroup(&wallpaperConfig, d->wallpaper->pluginName());
|
||||
d->wallpaper->save(wallpaperConfig);
|
||||
|
||||
if (d->wallpaper->isInitialized()) {
|
||||
KConfigGroup wallpaperConfig(&group, "Wallpaper");
|
||||
wallpaperConfig = KConfigGroup(&wallpaperConfig, d->wallpaper->pluginName());
|
||||
d->wallpaper->save(wallpaperConfig);
|
||||
}
|
||||
}
|
||||
|
||||
saveContents(group);
|
||||
@ -379,7 +382,7 @@ Corona *Containment::corona() const
|
||||
void Containment::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
event->ignore();
|
||||
if (d->wallpaper) {
|
||||
if (d->wallpaper && d->wallpaper->isInitialized()) {
|
||||
QGraphicsItem *item = scene()->itemAt(event->scenePos());
|
||||
if (item == this) {
|
||||
d->wallpaper->mouseMoveEvent(event);
|
||||
@ -395,7 +398,7 @@ void Containment::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||
void Containment::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
event->ignore();
|
||||
if (d->wallpaper) {
|
||||
if (d->wallpaper && d->wallpaper->isInitialized()) {
|
||||
QGraphicsItem *item = scene()->itemAt(event->scenePos());
|
||||
if (item == this) {
|
||||
d->wallpaper->mousePressEvent(event);
|
||||
@ -413,7 +416,7 @@ void Containment::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
void Containment::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
event->ignore();
|
||||
if (d->wallpaper) {
|
||||
if (d->wallpaper && d->wallpaper->isInitialized()) {
|
||||
QGraphicsItem *item = scene()->itemAt(event->scenePos());
|
||||
if (item == this) {
|
||||
d->wallpaper->mouseReleaseEvent(event);
|
||||
@ -1045,7 +1048,7 @@ void Containment::keyPressEvent(QKeyEvent *event)
|
||||
|
||||
void Containment::wheelEvent(QGraphicsSceneWheelEvent *event)
|
||||
{
|
||||
if (d->wallpaper) {
|
||||
if (d->wallpaper && d->wallpaper->isInitialized()) {
|
||||
QGraphicsItem *item = scene()->itemAt(event->scenePos());
|
||||
if (item == this) {
|
||||
event->ignore();
|
||||
@ -1254,10 +1257,7 @@ void Containment::setWallpaper(const QString &pluginName, const QString &mode)
|
||||
|
||||
if (d->wallpaper) {
|
||||
d->wallpaper->setBoundingRect(boundingRect());
|
||||
|
||||
KConfigGroup wallpaperConfig = KConfigGroup(&cfg, "Wallpaper");
|
||||
wallpaperConfig = KConfigGroup(&wallpaperConfig, pluginName);
|
||||
d->wallpaper->restore(wallpaperConfig, mode);
|
||||
d->wallpaper->setRenderingMode(mode);
|
||||
|
||||
if (newPlugin) {
|
||||
connect(d->wallpaper, SIGNAL(update(const QRectF&)),
|
||||
@ -1265,6 +1265,12 @@ void Containment::setWallpaper(const QString &pluginName, const QString &mode)
|
||||
cfg.writeEntry("wallpaperplugin", pluginName);
|
||||
}
|
||||
|
||||
if (d->wallpaper->isInitialized()) {
|
||||
KConfigGroup wallpaperConfig = KConfigGroup(&cfg, "Wallpaper");
|
||||
wallpaperConfig = KConfigGroup(&wallpaperConfig, pluginName);
|
||||
d->wallpaper->restore(wallpaperConfig);
|
||||
}
|
||||
|
||||
if (newMode) {
|
||||
cfg.writeEntry("wallpaperpluginmode", mode);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user