By default, Bugzilla does not search the list of RESOLVED bugs.
You can force it to do so by putting the upper-case word ALL in front of your search query, e.g.: ALL tdelibs
We recommend searching for bugs this way, as you may discover that your bug has already been resolved and fixed in a later release. View | Details | Raw Unified | Return to bug 1499
Collapse All | Expand All

(-)kdebase-3.5.9/kcontrol/background/crossfade.h.crossfade-efect (+56 lines)
Line 0 Link Here
1
/* vi: ts=8 sts=4 sw=4
2
 * kate: space-indent on; tab-width 8; indent-width 4; indent-mode cstyle;
3
 *
4
 * This file is part of the KDE project, module kdesktop.
5
 * Copyright (C) 1999,2000 Geert Jansen <jansen@kde.org>
6
 *
7
 * You can Freely distribute this program under the GNU General Public
8
 * License. See the file "COPYING" for the exact licensing terms.
9
 */
10
11
#ifndef __crossfade_h_Included__
12
#define __crossfade_h_Included__
13
14
#include <tqtimer.h>
15
#include <tqpainter.h>
16
#include <tqpixmap.h>
17
#include <X11/X.h>
18
#include <X11/Xlib.h>
19
#include <X11/Xatom.h>
20
#include <X11/extensions/Xrender.h>
21
#include <kdebug.h>
22
#include <unistd.h>
23
24
25
26
27
inline TQPixmap crossFade(const TQPixmap &pix1, const TQPixmap &pix2, double r_alpha,
28
	                bool sync = false){
29
30
    TQPixmap pix = TQPixmap(1,1,8); 
31
    int mw,mh;
32
    mw = pix1.width();
33
    mh = pix1.height();
34
35
    int alpha = 0xffff * (1-r_alpha);
36
    
37
    XRenderColor clr = { 0, 0, 0, alpha }; 
38
    XRenderPictureAttributes pa;
39
    pa.repeat = True;
40
    Picture pic = XRenderCreatePicture(pix.x11Display(), pix.handle(),
41
	    XRenderFindStandardFormat (pix.x11Display(), PictStandardA8),
42
	    CPRepeat, &pa);
43
    XRenderFillRectangle(pix.x11Display(), PictOpSrc, pic,
44
			 &clr, 0, 0, 1, 1);
45
    TQPixmap dst(pix1);
46
    dst.detach();
47
    XRenderComposite(pix.x11Display(), PictOpOver, pix2.x11RenderHandle(),
48
	    pic, dst.x11RenderHandle(),0,0, 0,0, 0,0, mw,mh);
49
50
    if (sync)
51
       XSync(pix.x11Display(), false);	
52
    XRenderFreePicture(pix.x11Display(), pic);
53
    return dst;
54
}
55
56
#endif // __crossfade_h_Included__
(-)./kcontrol/background/CMakeLists.txt.ORI (-1 / +1 lines)
Lines 28-34 Link Here
28
  ##### bgnd (static) #############################
28
  ##### bgnd (static) #############################
29
29
30
  tde_add_library( bgnd STATIC_PIC AUTOMOC
30
  tde_add_library( bgnd STATIC_PIC AUTOMOC
31
    SOURCES bgrender.cpp bgsettings.cpp
31
    SOURCES bgrender.cpp bgsettings.cpp KCrossBGRender.cc
32
    LINK ${LIBART_LIBRARIES}
32
    LINK ${LIBART_LIBRARIES}
33
  )
33
  )
34
34
(-)./kcontrol/background/bgrender.cpp.ORI (-3 / +7 lines)
Lines 10-15 Link Here
10
10
11
#include <config.h>
11
#include <config.h>
12
12
13
#include "KCrossBGRender.h"
14
13
#include <time.h>
15
#include <time.h>
14
#include <stdlib.h>
16
#include <stdlib.h>
15
#include <utime.h>
17
#include <utime.h>
Lines 1061-1067 Link Here
1061
}
1063
}
1062
1064
1063
1065
1064
KBackgroundRenderer * KVirtualBGRenderer::renderer(unsigned screen)
1066
KCrossBGRender * KVirtualBGRenderer::renderer(unsigned screen)
1065
{
1067
{
1066
    return m_renderer[screen];
1068
    return m_renderer[screen];
1067
}
1069
}
Lines 1220-1226 Link Here
1220
    for (unsigned i=0; i<m_numRenderers; ++i)
1222
    for (unsigned i=0; i<m_numRenderers; ++i)
1221
    {
1223
    {
1222
        int eScreen = m_bCommonScreen ? 0 : i;
1224
        int eScreen = m_bCommonScreen ? 0 : i;
1223
        KBackgroundRenderer * r = new KBackgroundRenderer( m_desk, eScreen, m_bDrawBackgroundPerScreen, m_pConfig );
1225
        //KBackgroundRenderer * r = new KBackgroundRenderer( m_desk, eScreen, m_bDrawBackgroundPerScreen, m_pConfig );
1226
        KCrossBGRender *r = new KCrossBGRender(m_desk, eScreen, m_bDrawBackgroundPerScreen, m_pConfig);
1224
        m_renderer.insert( i, r );
1227
        m_renderer.insert( i, r );
1225
        r->setSize(renderSize(i));
1228
        r->setSize(renderSize(i));
1226
        connect( r, TQT_SIGNAL(imageDone(int,int)), this, TQT_SLOT(screenDone(int,int)) );
1229
        connect( r, TQT_SIGNAL(imageDone(int,int)), this, TQT_SLOT(screenDone(int,int)) );
Lines 1250-1256 Link Here
1250
    Q_UNUSED(_desk);
1253
    Q_UNUSED(_desk);
1251
    Q_UNUSED(_screen);
1254
    Q_UNUSED(_screen);
1252
1255
1253
    const KBackgroundRenderer * sender = dynamic_cast<const KBackgroundRenderer*>(this->sender());
1256
    //const KBackgroundRenderer * sender = dynamic_cast<const KBackgroundRenderer*>(this->sender());
1257
    const KCrossBGRender * sender = dynamic_cast<const KCrossBGRender*>(this->sender());
1254
    int screen = m_renderer.find(sender);
1258
    int screen = m_renderer.find(sender);
1255
    if (screen == -1)
1259
    if (screen == -1)
1256
        //??
1260
        //??
(-)kdebase-3.5.9/kcontrol/background/KCrossBGRender.h.crossfade-efect (+76 lines)
Line 0 Link Here
1
/*
2
 * Copyright (C) 2008 Danilo Cesar Lemes de Paula <danilo@mandriva.com>
3
 * Copyright (C) 2008 Gustavo Boiko <boiko@mandriva.com>
4
 * Mandriva Conectiva
5
 *
6
 * This library is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU Library General Public
8
 * License version 2 as published by the Free Software Foundation.
9
 *
10
 * This library is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 * Library General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU Library General Public License
16
 * along with this library; see the file COPYING.LIB.  If not, write to
17
 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18
 * Boston, MA 02111-1307, USA.
19
*/
20
21
#ifndef __KCrossBGRender_h_Included__
22
#define __KCrossBGRender_h_Included__
23
24
25
#include <tqvaluelist.h>
26
#include <tqpixmap.h>
27
#include <tqvaluelist.h>
28
#include <tqdatetime.h>
29
30
#include "bgrender.h"
31
32
class TQDomElement;
33
34
typedef struct crossEvent{
35
	bool transition;
36
	TQString pix1;
37
	TQString pix2;
38
	TQTime stime; //start time
39
	TQTime etime; //end time
40
} KBGCrossEvent;
41
42
43
class KCrossBGRender: public KBackgroundRenderer{
44
	
45
TQ_OBJECT
46
47
public:
48
	KCrossBGRender(int desk, int screen, bool drawBackgroundPerScreen, KConfig *config=0);
49
	~KCrossBGRender();
50
51
	bool needWallpaperChange();
52
	void changeWallpaper(bool init=false);
53
	TQPixmap pixmap();
54
	bool usingCrossXml(){return useCrossEfect;};
55
56
57
private:
58
	TQPixmap pix;
59
	int secs;
60
	TQString xmlFileName;
61
	bool useCrossEfect;
62
	
63
	int actualPhase;
64
	 
65
	void createStartTime(TQDomElement e);
66
	void createTransition(TQDomElement e);
67
	void createStatic(TQDomElement e);
68
	bool setCurrentEvent(bool init = false);
69
	void initCrossFade(TQString xml);
70
	void fixEnabled();
71
	QPixmap getCurrentPixmap();
72
	KBGCrossEvent current;
73
	TQValueList<KBGCrossEvent> timeList;
74
};
75
76
#endif // __KCrossBGRender_h_Included__ 
(-)./kcontrol/background/bgrender.h.ORI (-2 / +4 lines)
Lines 28-33 Link Here
28
class KTempFile;
28
class KTempFile;
29
class KShellProcess;
29
class KShellProcess;
30
class KStandardDirs;
30
class KStandardDirs;
31
class KCrossBGRender;
31
32
32
/**
33
/**
33
 * This class renders a desktop background to a TQImage. The operation is
34
 * This class renders a desktop background to a TQImage. The operation is
Lines 127-133 Link Here
127
    KVirtualBGRenderer(int desk, KConfig *config=0l);
128
    KVirtualBGRenderer(int desk, KConfig *config=0l);
128
    ~KVirtualBGRenderer();
129
    ~KVirtualBGRenderer();
129
    
130
    
130
    KBackgroundRenderer * renderer(unsigned screen);
131
    KCrossBGRender * renderer(unsigned screen);
131
    unsigned numRenderers() const { return m_numRenderers; }
132
    unsigned numRenderers() const { return m_numRenderers; }
132
133
133
    TQPixmap pixmap();
134
    TQPixmap pixmap();
Lines 173-179 Link Here
173
    TQSize m_size;
174
    TQSize m_size;
174
    
175
    
175
    TQMemArray<bool> m_bFinished;
176
    TQMemArray<bool> m_bFinished;
176
    TQPtrVector<KBackgroundRenderer> m_renderer;
177
    //TQPtrVector<KBackgroundRenderer> m_renderer;
178
    TQPtrVector<KCrossBGRender> m_renderer;
177
    TQPixmap *m_pPixmap;
179
    TQPixmap *m_pPixmap;
178
};
180
};
179
181
(-)kdebase-3.5.9/kcontrol/background/KCrossBGRender.cc.crossfade-efect (+356 lines)
Line 0 Link Here
1
/*
2
 * Copyright (C) 2008 Danilo Cesar Lemes de Paula <danilo@mandriva.com>
3
 * Copyright (C) 2008 Gustavo Boiko <boiko@mandriva.com>
4
 * Mandriva Conectiva
5
 *
6
 * This library is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU Library General Public
8
 * License version 2 as published by the Free Software Foundation.
9
 *
10
 * This library is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 * Library General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU Library General Public License
16
 * along with this library; see the file COPYING.LIB.  If not, write to
17
 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18
 * Boston, MA 02111-1307, USA.
19
 */
20
21
#include <tqdom.h>
22
#include <tqfile.h>
23
24
#include <kdebug.h>
25
26
#include "KCrossBGRender.h"
27
//#include "crossfade.h"
28
#include <tqapplication.h>
29
#include <kimageeffect.h>
30
31
32
KCrossBGRender::KCrossBGRender(int desk, int screen, bool drawBackgroundPerScreen, KConfig *config): KBackgroundRenderer(desk,screen,drawBackgroundPerScreen,config)
33
{
34
	useCrossEfect = false;
35
	if ( wallpaperList()[0].endsWith("xml",false) ){
36
		initCrossFade(wallpaperList()[0]);
37
	}
38
		
39
}
40
41
void KCrossBGRender::initCrossFade(TQString xmlFile){
42
	
43
	useCrossEfect = true;
44
	if (xmlFile.isEmpty()){
45
		useCrossEfect = false;
46
		return;
47
	}
48
	secs = 0;
49
	timeList.empty();
50
51
	// read the XMLfile
52
	TQDomDocument xmldoc = TQDomDocument(xmlFile);
53
	TQFile file( xmlFile );
54
	if ( !file.open( IO_ReadOnly ) ){
55
		useCrossEfect = false;
56
		return;
57
	}
58
	if ( !xmldoc.setContent( &file ) ) {
59
		useCrossEfect = false;
60
		file.close();
61
		return;
62
	}
63
	file.close();
64
65
	TQDomElement docElem = xmldoc.documentElement();
66
	TQDomNode n = docElem.firstChild();
67
	while( !n.isNull() ) {
68
        	TQDomElement e = n.toElement(); // try to convert the node to an element.
69
		if( !e.isNull() ) {
70
			if (e.tagName() == "starttime"){
71
				createStartTime(e);	
72
				
73
			}else if (e.tagName() == "transition"){
74
				createTransition(e);
75
			}else if (e.tagName() == "static"){
76
				createStatic(e);
77
			}
78
		}
79
		n = n.nextSibling();
80
	}
81
82
	// Setting "now" state
83
	setCurrentEvent(true);
84
	pix = getCurrentPixmap();
85
	
86
	useCrossEfect = true;
87
}
88
89
90
KCrossBGRender::~KCrossBGRender(){
91
}
92
93
TQPixmap KCrossBGRender::pixmap(){
94
95
	fixEnabled();	
96
	if (!useCrossEfect)
97
		return KBackgroundRenderer::pixmap();
98
	
99
	return pix;
100
}
101
102
bool KCrossBGRender::needWallpaperChange(){
103
104
105
	if (!useCrossEfect)
106
		return KBackgroundRenderer::needWallpaperChange();
107
108
	bool forceChange = setCurrentEvent();    // If we change the current state
109
	if (forceChange){			 // do not matter what hapens
110
		actualPhase = 0;                 // we need to change background
111
		return true;
112
	}
113
114
	// Return false if it's not a transition
115
	if (!current.transition)
116
		return false;
117
118
	double timeLeft, timeTotal;
119
	TQTime now = QTime::currentTime();
120
121
	timeLeft = now.secsTo(current.etime);
122
	if (timeLeft < 0)
123
		timeLeft += 86400; // before midnight
124
	timeTotal = current.stime.secsTo(current.etime);
125
	if (timeTotal < 0)
126
		timeTotal += 86400;
127
128
	double passed  = timeTotal - timeLeft;
129
	double timeCell   =  timeTotal/60; //Time cell size
130
131
	//kdDebug() << "\ntimeleft:" << timeLeft << " timeTotal:" << timeTotal 
132
	//          << "\npassed:" << passed << " timeCell:" << timeCell
133
	//	  << "\nactualPhase: " << actualPhase << endl;	
134
135
	int aux = passed/timeCell;	
136
	if(actualPhase != aux){
137
		//kdDebug() << "needWallpaperChange() => returned true" << endl;
138
		actualPhase = passed/timeCell;
139
		return true;
140
	}
141
142
	//kdDebug() << "needWallpaperChange() => returned false" << endl;
143
	return false;
144
145
}
146
147
/* 
148
 * This method change the enabledEffect flag to TRUE of FLASE, acording 
149
 * with multiWallpaperMode and FileName (it needs to be a XML)
150
 */
151
void KCrossBGRender::fixEnabled(){
152
153
	
154
	TQString w = wallpaperList()[0];
155
	useCrossEfect = false;	
156
	if(multiWallpaperMode() == Random || multiWallpaperMode() == InOrder){
157
		
158
		if ( w != xmlFileName ){
159
			// New XML File
160
			xmlFileName = w;
161
			if (w.endsWith("xml",false)){
162
				initCrossFade(wallpaperList()[0]);
163
				//useCrossEfect = true;	
164
			}else{
165
				// Not, it's not a xml file
166
				useCrossEfect = false;
167
			}
168
		}else if (w.endsWith("xml",false)){
169
			//xmlFile doesn't change
170
			//but it's there
171
			useCrossEfect = true;
172
		}else{
173
			// it's not a XML file
174
			useCrossEfect = false;
175
		}
176
	}
177
}
178
179
void KCrossBGRender::changeWallpaper(bool init){
180
181
182
183
	fixEnabled();
184
185
	if (!useCrossEfect){
186
		KBackgroundRenderer::changeWallpaper(init);
187
		return;
188
	}
189
190
	pix = getCurrentPixmap();
191
192
193
}
194
195
196
bool KCrossBGRender::setCurrentEvent(bool init){
197
	TQTime now = QTime::currentTime();
198
	
199
200
	//Verify if is need to change
201
	if (!(init || now <= current.stime || now >= current.etime ))
202
		return false;
203
204
	TQValueList<KBGCrossEvent>::iterator it;
205
	for ( it = timeList.begin(); it != timeList.end(); ++it ){
206
207
		// Look for time
208
		if ( ((*it).stime <= now && now <= (*it).etime) ||   //normal situation
209
		     ((*it).etime <= (*it).stime && (now >= (*it).stime ||
210
		     				     now <= (*it).etime) ) )	
211
		{
212
			current = *it;
213
			actualPhase = 0;
214
215
			//kdDebug() << "Cur: " << current.stime << "< now <" << current.etime << endl;
216
			return true;
217
		}
218
	}
219
}
220
221
TQPixmap KCrossBGRender::getCurrentPixmap(){
222
223
	float alpha;
224
	TQPixmap ret;
225
	TQImage tmp;
226
	TQImage p1;
227
	if (!tmp.load(current.pix1))
228
		return TQPixmap();
229
230
	// scale the pixmap to fit in the screen
231
	//p1 = TQPixmap(QApplication::desktop()->screenGeometry().size());
232
	//TQPainter p(&p1);
233
	//p.drawPixmap(p1.rect(), tmp);
234
	//
235
	p1 = tmp.smoothScale(TQApplication::desktop()->screenGeometry().size());
236
237
	if (current.transition){
238
		TQTime now = QTime::currentTime();
239
		double timeLeft,timeTotal;
240
241
		TQImage p2;
242
243
		if (!tmp.load(current.pix2) )
244
			return NULL;
245
246
		p2 = tmp.smoothScale(TQApplication::desktop()->screenGeometry().size());
247
		//TQPainter p(&p2);
248
		//p.drawPixmap(p2.rect(), tmp);
249
250
		timeLeft = now.secsTo(current.etime);
251
		if (timeLeft < 0)
252
			timeLeft += 86400;
253
		timeTotal = current.stime.secsTo(current.etime);
254
		if (timeTotal < 0)
255
			timeTotal += 86400;
256
		
257
		alpha = (timeTotal - timeLeft)/timeTotal;
258
259
		//ret = crossFade(p2,p1,alpha);
260
		tmp = KImageEffect::blend(p2,p1,alpha);
261
		ret.convertFromImage(tmp);
262
		return ret;
263
	}else{
264
		ret.convertFromImage(p1);
265
		return ret;
266
	}	
267
	
268
269
}
270
271
void KCrossBGRender::createStartTime(QDomElement docElem){
272
	
273
	int hour;
274
	int minutes;
275
276
	TQDomNode n = docElem.firstChild();
277
	while( !n.isNull() ) {
278
		TQDomElement e = n.toElement();
279
		if( !e.isNull() ) {
280
			if (e.tagName() == "hour"){
281
				hour =  e.text().toInt();
282
			}else if ( e.tagName() == "minute" ){
283
				minutes = e.text().toInt();
284
			}
285
			
286
		}
287
		
288
		n = n.nextSibling();
289
	}
290
	secs = hour*60*60 + minutes*60;
291
}
292
void KCrossBGRender::createTransition(TQDomElement docElem){
293
294
	int duration;
295
	QString from;
296
	QString to;
297
298
	TQDomNode n = docElem.firstChild();
299
	while( !n.isNull() ) {
300
		TQDomElement e = n.toElement();
301
		if( !e.isNull() ) {
302
			if (e.tagName() == "duration"){
303
				duration = e.text().toFloat();
304
			}else if ( e.tagName() == "from" ){
305
				from = e.text();
306
			}
307
			else if ( e.tagName() == "to" ){
308
				to = e.text();
309
			}
310
			
311
		}
312
		n = n.nextSibling();
313
	}
314
	TQTime startTime(0,0,0);
315
	startTime = startTime.addSecs(secs);
316
	TQTime endTime(0,0,0);
317
	endTime = endTime.addSecs(secs+duration);
318
319
	secs += duration;
320
	
321
	KBGCrossEvent l = {true, from, to, startTime,endTime};
322
323
	timeList.append(l);
324
325
}
326
void KCrossBGRender::createStatic(TQDomElement docElem){
327
	
328
	int duration;
329
	TQString file;
330
	
331
	TQDomNode n = docElem.firstChild();
332
	while( !n.isNull() ) {
333
		TQDomElement e = n.toElement();
334
		if( !e.isNull() ) {
335
			if (e.tagName() == "duration"){
336
				duration = e.text().toFloat();
337
			}else if ( e.tagName() == "file" ){
338
				file = e.text();
339
			}
340
			
341
		}
342
		n = n.nextSibling();
343
	}
344
	
345
	TQTime startTime(0,0,0);
346
	startTime = startTime.addSecs(secs);
347
	TQTime endTime(0,0,0);
348
	endTime = endTime.addSecs(secs+duration);
349
	
350
	secs += duration;
351
352
	KBGCrossEvent l = {false, file, NULL, startTime,endTime};
353
	timeList.append(l);
354
}
355
356
#include "KCrossBGRender.moc"
(-)./kdm/kfrontend/krootimage.h.ORI (+1 lines)
Lines 27-32 Link Here
27
#include <tqtimer.h>
27
#include <tqtimer.h>
28
28
29
#include <bgrender.h>
29
#include <bgrender.h>
30
#include <KCrossBGRender.h>
30
31
31
32
32
class MyApplication : public KApplication
33
class MyApplication : public KApplication
(-)./kdesktop/bgmanager.cc.ORI (-10 / +94 lines)
Lines 16-25 Link Here
16
#include "bgsettings.h"
16
#include "bgsettings.h"
17
#include "kdesktopapp.h"
17
#include "kdesktopapp.h"
18
18
19
//FIXME
20
#include "KCrossBGRender.h"
21
#include "crossfade.h"
22
19
#include <assert.h>
23
#include <assert.h>
20
24
21
#include <tqtimer.h>
25
#include <tqtimer.h>
22
#include <tqscrollview.h>
26
#include <tqscrollview.h>
27
#include <tqpainter.h>
28
#include <tqdesktopwidget.h>
23
29
24
#include <kiconloader.h>
30
#include <kiconloader.h>
25
#include <kconfig.h>
31
#include <kconfig.h>
Lines 34-39 Link Here
34
#include <X11/X.h>
40
#include <X11/X.h>
35
#include <X11/Xlib.h>
41
#include <X11/Xlib.h>
36
#include <X11/Xatom.h>
42
#include <X11/Xatom.h>
43
#include <X11/extensions/Xrender.h>
44
#include <unistd.h>
37
45
38
#ifndef None
46
#ifndef None
39
#define None 0L
47
#define None 0L
Lines 47-53 Link Here
47
55
48
#include "pixmapserver.h"
56
#include "pixmapserver.h"
49
57
50
template class TQPtrVector<KBackgroundRenderer>;
58
//template class TQPtrVector<KBackgroundRenderer>;
59
template class TQPtrVector<KCrossBGRender>;
51
template class TQPtrVector<KBackgroundCacheEntry>;
60
template class TQPtrVector<KBackgroundCacheEntry>;
52
template class TQMemArray<int>;
61
template class TQMemArray<int>;
53
62
Lines 108-113 Link Here
108
    connect(m_pTimer, TQT_SIGNAL(timeout()), TQT_SLOT(slotTimeout()));
117
    connect(m_pTimer, TQT_SIGNAL(timeout()), TQT_SLOT(slotTimeout()));
109
    m_pTimer->start( 60000 );
118
    m_pTimer->start( 60000 );
110
119
120
    /*CrossFade's config*/
121
    m_crossTimer = new TQTimer(this);
122
    connect(m_crossTimer, TQT_SIGNAL(timeout()), TQT_SLOT(slotCrossFadeTimeout()));
123
    /*Ends here*/
124
125
111
    connect(m_pKwinmodule, TQT_SIGNAL(currentDesktopChanged(int)),
126
    connect(m_pKwinmodule, TQT_SIGNAL(currentDesktopChanged(int)),
112
	    TQT_SLOT(slotChangeDesktop(int)));
127
	    TQT_SLOT(slotChangeDesktop(int)));
113
    connect(m_pKwinmodule, TQT_SIGNAL(numberOfDesktopsChanged(int)),
128
    connect(m_pKwinmodule, TQT_SIGNAL(numberOfDesktopsChanged(int)),
Lines 577-582 Link Here
577
592
578
593
579
/*
594
/*
595
 * This slot is called when the Timeout is executed
596
 */
597
void KBackgroundManager::slotCrossFadeTimeout()
598
{
599
    KVirtualBGRenderer *r = m_Renderer[fadeDesk];
600
    if (crossInit) {
601
        mBenchmark.start();
602
    }
603
604
    if (mAlpha <= 0.0 || mBenchmark.elapsed() > 300 ) {
605
        bool do_cleanup = true;
606
        mAlpha = 1;
607
        m_crossTimer->stop();
608
        KPixmap pixm(mNextScreen);
609
        setPixmap(&pixm, r->hash(), fadeDesk);
610
        return;
611
    }
612
    // Reset Timer
613
    mBenchmark.start();
614
615
    TQPixmap dst = crossFade(*mOldScreen, mNextScreen, mAlpha, crossInit);
616
    KPixmap pixm(dst);
617
    setPixmap(&pixm, r->hash(), fadeDesk);
618
619
    mAlpha -=0.03;
620
    crossInit = false;
621
}
622
623
624
/*
580
 * This slot is called when a renderer is done.
625
 * This slot is called when a renderer is done.
581
 */
626
 */
582
void KBackgroundManager::slotImageDone(int desk)
627
void KBackgroundManager::slotImageDone(int desk)
Lines 592-597 Link Here
592
    KPixmap *pm = new KPixmap();
637
    KPixmap *pm = new KPixmap();
593
    KVirtualBGRenderer *r = m_Renderer[desk];
638
    KVirtualBGRenderer *r = m_Renderer[desk];
594
    bool do_cleanup = true;
639
    bool do_cleanup = true;
640
    fadeDesk = desk; 
641
    mAlpha = 1.0;
642
    int width,height;
643
595
644
596
    *pm = r->pixmap();
645
    *pm = r->pixmap();
597
    // If current: paint it
646
    // If current: paint it
Lines 603-609 Link Here
603
        //setPixmap(viewport_background, r->hash(), desk);
652
        //setPixmap(viewport_background, r->hash(), desk);
604
        //delete viewport_background;
653
        //delete viewport_background;
605
        
654
        
606
        setPixmap(pm, r->hash(), desk);
655
        //START
656
        if (!m_Renderer[effectiveDesktop()]->renderer(0)->usingCrossXml()){	
657
            int mode = m_Renderer[effectiveDesktop()]->renderer(0)->wallpaperMode();
658
            width = TQApplication::desktop()->screenGeometry().width(); //m_pDesktop->width();
659
            height = TQApplication::desktop()->screenGeometry().height();// m_pDesktop->height();	
660
661
            if (mode == KBackgroundSettings::NoWallpaper || mode == KBackgroundSettings::Tiled || mode  == KBackgroundSettings::CenterTiled ){
662
                mNextScreen = TQPixmap(width,height);
663
                TQPainter p (&mNextScreen);
664
                p.drawTiledPixmap(0,0,width,height,*pm);        
665
            } else {
666
                mNextScreen = QPixmap(*pm);
667
            }
668
669
            if (m_pDesktop){
670
                mOldScreen = const_cast<QPixmap *>( m_pDesktop->backgroundPixmap() );
671
            }else{
672
                mOldScreen = const_cast<QPixmap *>(
673
                QApplication::desktop()->screen()->backgroundPixmap() );
674
            }
675
676
            //TODO Find a way to discover if CrossFade effect needs to run  
677
            if (mOldScreen){
678
                crossInit = true;
679
                m_crossTimer->start(70);
680
            } else{
681
                setPixmap(pm, r->hash(), desk);
682
            }
683
        }else{
684
            setPixmap(pm, r->hash(), desk);
685
        }
686
        //ENDS HERE  */
687
	    
688
        //setPixmap(pm, r->hash(), desk);
689
607
        if (!m_bBgInitDone)
690
        if (!m_bBgInitDone)
608
        {
691
        {
609
            m_bBgInitDone = true;
692
            m_bBgInitDone = true;
Lines 801-807 Link Here
801
TQString KBackgroundManager::currentWallpaper(int desk)
884
TQString KBackgroundManager::currentWallpaper(int desk)
802
{
885
{
803
    //TODO Is the behaviour of this function appropriate for multiple screens?
886
    //TODO Is the behaviour of this function appropriate for multiple screens?
804
    KBackgroundRenderer *r = m_Renderer[validateDesk(desk)]->renderer(0);
887
    //KBackgroundRenderer *r = m_Renderer[validateDesk(desk)]->renderer(0);
888
    KCrossBGRender *r = m_Renderer[validateDesk(desk)]->renderer(0);
805
889
806
    return r->currentWallpaper();
890
    return r->currentWallpaper();
807
}
891
}
Lines 818-824 Link Here
818
// DCOP exported
902
// DCOP exported
819
void KBackgroundManager::setExport(int _export)
903
void KBackgroundManager::setExport(int _export)
820
{
904
{
821
    kdDebug() << "KBackgroundManager enabling exports.\n";
905
//    kdDebug() << "KBackgroundManager enabling exports.\n";
822
    applyExport(_export);
906
    applyExport(_export);
823
    slotChangeDesktop(0);
907
    slotChangeDesktop(0);
824
}
908
}
Lines 843-849 Link Here
843
    //TODO Is the behaviour of this function appropriate for multiple screens?
927
    //TODO Is the behaviour of this function appropriate for multiple screens?
844
    for (unsigned i=0; i < m_Renderer[effectiveDesktop()]->numRenderers(); ++i)
928
    for (unsigned i=0; i < m_Renderer[effectiveDesktop()]->numRenderers(); ++i)
845
    {
929
    {
846
        KBackgroundRenderer *r = m_Renderer[effectiveDesktop()]->renderer(i);
930
        KCrossBGRender *r = m_Renderer[effectiveDesktop()]->renderer(i);
847
        r->stop();
931
        r->stop();
848
        r->setWallpaperMode(mode);
932
        r->setWallpaperMode(mode);
849
        r->setMultiWallpaperMode(KBackgroundSettings::NoMulti);
933
        r->setMultiWallpaperMode(KBackgroundSettings::NoMulti);
Lines 856-862 Link Here
856
void KBackgroundManager::setWallpaper(TQString wallpaper)
940
void KBackgroundManager::setWallpaper(TQString wallpaper)
857
{
941
{
858
    //TODO Is the behaviour of this function appropriate for multiple screens?
942
    //TODO Is the behaviour of this function appropriate for multiple screens?
859
    KBackgroundRenderer *r = m_Renderer[effectiveDesktop()]->renderer(0);
943
    KCrossBGRender *r = m_Renderer[effectiveDesktop()]->renderer(0);
860
    int mode = r->wallpaperMode();
944
    int mode = r->wallpaperMode();
861
    if (mode == KBackgroundSettings::NoWallpaper)
945
    if (mode == KBackgroundSettings::NoWallpaper)
862
       mode = KBackgroundSettings::Tiled;
946
       mode = KBackgroundSettings::Tiled;
Lines 869-875 Link Here
869
TQStringList KBackgroundManager::wallpaperFiles(int desk)
953
TQStringList KBackgroundManager::wallpaperFiles(int desk)
870
{
954
{
871
    //TODO Is the behaviour of this function appropriate for multiple screens?
955
    //TODO Is the behaviour of this function appropriate for multiple screens?
872
    KBackgroundRenderer *r = m_Renderer[validateDesk(desk)]->renderer(0);
956
    KCrossBGRender *r = m_Renderer[validateDesk(desk)]->renderer(0);
873
957
874
    return r->wallpaperFiles();
958
    return r->wallpaperFiles();
875
}
959
}
Lines 880-886 Link Here
880
TQStringList KBackgroundManager::wallpaperList(int desk)
964
TQStringList KBackgroundManager::wallpaperList(int desk)
881
{
965
{
882
    //TODO Is the behaviour of this function appropriate for multiple screens?
966
    //TODO Is the behaviour of this function appropriate for multiple screens?
883
    KBackgroundRenderer *r = m_Renderer[validateDesk(desk)]->renderer(0);;
967
    KCrossBGRender *r = m_Renderer[validateDesk(desk)]->renderer(0);;
884
968
885
    return r->wallpaperList();
969
    return r->wallpaperList();
886
}
970
}
Lines 907-913 Link Here
907
    //TODO Is the behaviour of this function appropriate for multiple screens?
991
    //TODO Is the behaviour of this function appropriate for multiple screens?
908
    for (unsigned i=0; i < m_Renderer[sdesk]->numRenderers(); ++i)
992
    for (unsigned i=0; i < m_Renderer[sdesk]->numRenderers(); ++i)
909
    {
993
    {
910
        KBackgroundRenderer *r = m_Renderer[sdesk]->renderer(i);
994
        KCrossBGRender *r = m_Renderer[sdesk]->renderer(i);
911
    
995
    
912
        setCommon(false);   // Force each desktop to have it's own wallpaper
996
        setCommon(false);   // Force each desktop to have it's own wallpaper
913
    
997
    
Lines 974-980 Link Here
974
    //TODO Is the behaviour of this function appropriate for multiple screens?
1058
    //TODO Is the behaviour of this function appropriate for multiple screens?
975
    for (unsigned i=0; i < m_Renderer[effectiveDesktop()]->numRenderers(); ++i)
1059
    for (unsigned i=0; i < m_Renderer[effectiveDesktop()]->numRenderers(); ++i)
976
    {
1060
    {
977
        KBackgroundRenderer *r = m_Renderer[effectiveDesktop()]->renderer(i);
1061
        KCrossBGRender *r = m_Renderer[effectiveDesktop()]->renderer(i);
978
        r->stop();
1062
        r->stop();
979
    
1063
    
980
        if (isColorA)
1064
        if (isColorA)
(-)./kdesktop/bgmanager.h.ORI (+11 lines)
Lines 13-18 Link Here
13
#include <tqstring.h>
13
#include <tqstring.h>
14
#include <tqptrvector.h>
14
#include <tqptrvector.h>
15
15
16
#include <qdatetime.h>
16
#include <KBackgroundIface.h>
17
#include <KBackgroundIface.h>
17
18
18
#if defined(Q_WS_X11) && defined(HAVE_XRENDER) && QT_VERSION >= 0x030300
19
#if defined(Q_WS_X11) && defined(HAVE_XRENDER) && QT_VERSION >= 0x030300
Lines 89-94 Link Here
89
    void desktopResized();
90
    void desktopResized();
90
    void clearRoot();
91
    void clearRoot();
91
    void saveImages();
92
    void saveImages();
93
    void slotCrossFadeTimeout();
92
    void slotCmBackgroundChanged(bool);
94
    void slotCmBackgroundChanged(bool);
93
95
94
private:
96
private:
Lines 131-136 Link Here
131
    KPixmapServer *m_pPixmapServer;
133
    KPixmapServer *m_pPixmapServer;
132
    
134
    
133
    unsigned long m_xrootpmap;
135
    unsigned long m_xrootpmap;
136
137
    /*CrossFade vars*/
138
    TQTimer * m_crossTimer;
139
    double mAlpha;
140
    TQPixmap  mNextScreen;
141
    TQPixmap  * mOldScreen;
142
    int fadeDesk;
143
    TQTime mBenchmark;
144
    bool crossInit;
134
};
145
};
135
146
136
#endif // __BGManager_h_Included__
147
#endif // __BGManager_h_Included__

Return to bug 1499