|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "walkwindowtree.h" |
|
17 #include "cliwin.h" |
|
18 #include "rootwin.h" |
|
19 #include "ANIM.H" |
|
20 #include "tcursor.h" |
|
21 #include "pointer.h" |
|
22 |
|
23 TWalkWindowTreeFocusChanged::TWalkWindowTreeFocusChanged(TBool aNewFocusState) : |
|
24 iNewFocusState(aNewFocusState) |
|
25 { |
|
26 } |
|
27 |
|
28 TBool TWalkWindowTreeFocusChanged::DoIt(CWsWindow *aWin) |
|
29 // |
|
30 // Walk all windows that have had their focus state changed |
|
31 // |
|
32 { |
|
33 aWin->FocusChanged(iNewFocusState); |
|
34 return(EFalse); |
|
35 } |
|
36 |
|
37 TResumableWalkWindowTreeFindInvalid::TResumableWalkWindowTreeFindInvalid(CWsWindowRedraw** aResult) : |
|
38 iResult(aResult) |
|
39 { |
|
40 } |
|
41 |
|
42 TBool TResumableWalkWindowTreeFindInvalid::DoIt(CWsWindow* aWin) |
|
43 // |
|
44 // Find a window with an invalid area |
|
45 // |
|
46 { |
|
47 WS_ASSERT_DEBUG(aWin->WinType()==EWinTypeClient, EWsPanicWindowType); |
|
48 CWsWindowRedraw *redraw=((CWsClientWindow *)aWin)->Redraw(); |
|
49 if (redraw->NeedsRedraw()>0) |
|
50 { |
|
51 *iResult=redraw; |
|
52 return(ETrue); |
|
53 } |
|
54 return(EFalse); |
|
55 } |
|
56 |
|
57 TWalkWindowTreeDisconnect::TWalkWindowTreeDisconnect(RWsTextCursor *aCursor) : |
|
58 iTextCursor(aCursor) |
|
59 {} |
|
60 |
|
61 TBool TWalkWindowTreeDisconnect::DoIt(CWsWindow *aWin) |
|
62 // |
|
63 // Disconnect a window |
|
64 // |
|
65 { |
|
66 if (aWin->WinType()==EWinTypeClient) |
|
67 { |
|
68 CWsClientWindow *win=(CWsClientWindow *)aWin; |
|
69 win->iRedraw->WindowClosing(); |
|
70 /* XXX jonas: the defect fix for PDEF114190 moved deactivation of sprites from CWsWindow::Shutdown() to here. Check that DeactivateAllSprites() is equivalent to SpriteManager::DeactivateSprites(). |
|
71 win->SpriteManager()->DeactivateSprites(win); |
|
72 */ |
|
73 win->DeactivateAllSprites(); |
|
74 |
|
75 if (iTextCursor) |
|
76 iTextCursor->WindowDisconnected(win); |
|
77 CWsAnim::WindowClosing(win->iAnimList); // Destroy any animated objects attached to this window |
|
78 TWsPointer::WindowDisconnected(aWin); |
|
79 |
|
80 win->iParent=NULL; |
|
81 win->iSibling=NULL; |
|
82 win->iChild=NULL; |
|
83 win->iFlags&=~EFlagActive; |
|
84 win->ResetHiddenFlag(); |
|
85 } |
|
86 return(EFalse); |
|
87 } |
|
88 |
|
89 TWalkWindowTreeRegionBase::TWalkWindowTreeRegionBase(RWsRegion *aRegion, TTranslucentBehaviour aTranslucentBehaviour) : |
|
90 iTranslucentBehaviour(aTranslucentBehaviour), iRegion(aRegion), iSubRegion(NULL) |
|
91 {} |
|
92 |
|
93 TBool TWalkWindowTreeRegionBase::DoIt(CWsWindow *aWin) |
|
94 { |
|
95 if (aWin->IsVisible()) |
|
96 { |
|
97 DoIt2(aWin); |
|
98 if (aWin->WinType()!=EWinTypeRoot) |
|
99 { |
|
100 STACK_REGION tmp; |
|
101 switch(iTranslucentBehaviour) |
|
102 { |
|
103 case EDontWalkTranslucent: |
|
104 static_cast<CWsClientWindow *>(aWin)->GetClippedBaseArea(tmp); |
|
105 iRegion->SubRegion(tmp,iSubRegion); |
|
106 break; |
|
107 case EWalkTranslucent: |
|
108 static_cast<CWsClientWindow *>(aWin)->GetClippedBaseArea(*iSubRegion); |
|
109 iSubRegion->Intersect(*iRegion); |
|
110 if (iSubRegion->Count() > 0) |
|
111 { |
|
112 static_cast<CWsClientWindow *>(aWin)->GetOpaqueClippedBaseArea(tmp); |
|
113 iRegion->SubRegion(tmp); |
|
114 } |
|
115 break; |
|
116 } |
|
117 tmp.Close(); |
|
118 } |
|
119 else if(iSubRegion) |
|
120 { |
|
121 iSubRegion->Copy(*iRegion); |
|
122 } |
|
123 if (iSubRegion && (iSubRegion->Count()>0 || iSubRegion->CheckError())) |
|
124 { |
|
125 if (DoIt3(aWin)) |
|
126 return ETrue; |
|
127 iSubRegion->Clear(); |
|
128 } |
|
129 } |
|
130 return(iRegion->IsEmpty()); |
|
131 } |
|
132 TBool TWalkWindowTreeRegionBase::DoIt3(CWsWindow*) |
|
133 {return EFalse;} |
|
134 |
|
135 TWalkWindowTreeSchedule::TWalkWindowTreeSchedule() : |
|
136 TWalkWindowTreeBase(), |
|
137 iHead(0) |
|
138 { |
|
139 } |
|
140 |
|
141 CWsWindow * TWalkWindowTreeSchedule::HeadWindow() const |
|
142 { |
|
143 return iHead; |
|
144 } |
|
145 |
|
146 TWalkWindowListSchedule::TWalkWindowListSchedule(CWsWindow* aHeadWin, TRegion& aScreenUpdateRegion) |
|
147 : TWalkWindowTreeSchedule(), iScreenUpdateRegion(aScreenUpdateRegion) |
|
148 { |
|
149 iHead = aHeadWin; |
|
150 } |
|
151 |
|
152 void TWalkWindowListSchedule::WalkWindowList() |
|
153 { |
|
154 CWsWindow* win = iHead; |
|
155 CWsWindow* previous = NULL; |
|
156 while (win) |
|
157 { |
|
158 if (!DoIt(win)) |
|
159 { |
|
160 // Remove win from list, as it doesn't need to be rendered |
|
161 if (win == iHead) |
|
162 { |
|
163 iHead = win->NextScheduled(); |
|
164 } |
|
165 else |
|
166 { |
|
167 WS_ASSERT_DEBUG(previous,EWsPanicWindowNull); |
|
168 previous->SetNextScheduled(win->NextScheduled()); |
|
169 } |
|
170 } |
|
171 else |
|
172 { |
|
173 previous = win; |
|
174 } |
|
175 win = win->NextScheduled(); |
|
176 } |
|
177 } |
|
178 |
|
179 /** |
|
180 @return ETrue if aWin has content that needs to be rendered, otherwise EFalse. |
|
181 */ |
|
182 TBool TWalkWindowListSchedule::DoIt(CWsWindow* aWin) |
|
183 { |
|
184 if (aWin->IsVisible()) |
|
185 { |
|
186 //In case we don't have all content, queue a request for the client to provide it. |
|
187 CWsWindowRedraw& redrawWin = *(aWin->Redraw()); |
|
188 if(!redrawWin.InvalidArea().IsEmpty()) |
|
189 { |
|
190 redrawWin.QueueRedraw(); |
|
191 } |
|
192 |
|
193 //Schedule all we got for now |
|
194 const TBool scheduledWindowContent = DoWindow(*aWin); |
|
195 const TBool scheduledSpriteContent = DoSprites(*aWin); |
|
196 return (scheduledWindowContent || scheduledSpriteContent); |
|
197 } |
|
198 return EFalse; |
|
199 } |
|
200 |
|
201 TBool TWalkWindowListSchedule::DoWindow(CWsWindow& aWin) |
|
202 { |
|
203 if (!aWin.DirtyWindowRegion().IsEmpty()) |
|
204 { |
|
205 //Schedule |
|
206 aWin.ScheduleDirtyWindowRegion(); |
|
207 //And ensure this part of the screen is updated |
|
208 iScreenUpdateRegion.Union(aWin.ScheduledRegion()); |
|
209 return ETrue; |
|
210 } |
|
211 return EFalse; |
|
212 } |
|
213 |
|
214 TBool TWalkWindowListSchedule::DoSprites(CWsWindow& aWin) |
|
215 { |
|
216 if (!aWin.DirtySpriteRegion().IsEmpty()) |
|
217 { |
|
218 //Schedule |
|
219 aWin.ScheduleDirtySpriteRegion(); |
|
220 //And ensure this part of the screen is updated |
|
221 iScreenUpdateRegion.Union(aWin.ScheduledSpriteRegion()); |
|
222 return ETrue; |
|
223 } |
|
224 return EFalse; |
|
225 } |
|
226 |
|
227 const TRegion& TWalkWindowListSchedule::WindowRegion(const CWsWindow& aWin) const |
|
228 { |
|
229 return aWin.ScheduledRegion(); |
|
230 } |
|
231 |
|
232 const TRegion& TWalkWindowListSchedule::SpriteRegion(const CWsWindow& aWin) const |
|
233 { |
|
234 return aWin.ScheduledSpriteRegion(); |
|
235 } |
|
236 |
|
237 TWalkWindowTreeScheduleRegions::TWalkWindowTreeScheduleRegions(TRegion& aRegion, const TRegion& aTopElement) : |
|
238 TWalkWindowTreeSchedule(), |
|
239 iRegion(aRegion), |
|
240 iTopElement(aTopElement), |
|
241 iScheduledRegionsOk(ETrue) |
|
242 { |
|
243 } |
|
244 |
|
245 // This is similar to TWalkWindowTreeRegionBase::DoIt |
|
246 TBool TWalkWindowTreeScheduleRegions::DoIt(CWsWindow *aWin) |
|
247 { |
|
248 WS_ASSERT_DEBUG((aWin != iHead), EWsPanicScheduledRedraw); |
|
249 if (aWin->IsVisible()) |
|
250 { |
|
251 // Calculate the region we care about for this window: |
|
252 STACK_REGION region; |
|
253 if (aWin->WinType()==EWinTypeRoot) |
|
254 { |
|
255 region.Copy(iRegion); |
|
256 } |
|
257 else |
|
258 { |
|
259 static_cast<CWsClientWindow *>(aWin)->GetClippedBaseArea(region); |
|
260 region.Intersect(iRegion); |
|
261 } |
|
262 // If there is a region we care about, remember the window: |
|
263 // NOTE: Even if there are no redraw segments (ReadyToDraw is false) the window should |
|
264 // be scheduled if it has a element so that the background surface is made visible |
|
265 // or if it has some animations which should be redrawn via the PostDrawWindow method (cf def131912) |
|
266 if (!region.IsEmpty() && (aWin->ReadyToDraw() || aWin->HasElement() || aWin->HasAnimation() || aWin->HasSprite()) ) |
|
267 { |
|
268 // Add window to linked list: |
|
269 aWin->SetNextScheduled(iHead); |
|
270 iHead = aWin; |
|
271 // Set the window scheduled region to something appropriate: |
|
272 if (iScheduledRegionsOk) |
|
273 { |
|
274 if (region.CheckError()) |
|
275 { |
|
276 iScheduledRegionsOk = EFalse; |
|
277 } |
|
278 else |
|
279 { |
|
280 iScheduledRegionsOk = aWin->SetScheduledRegion(region); |
|
281 } |
|
282 } |
|
283 } |
|
284 if (aWin->WinType()!=EWinTypeRoot) |
|
285 { |
|
286 // Remove the opaque part from our working region: |
|
287 STACK_REGION opaqueRegion; |
|
288 static_cast<CWsClientWindow *>(aWin)->GetOpaqueClippedBaseArea(opaqueRegion); |
|
289 iRegion.SubRegion(opaqueRegion); |
|
290 opaqueRegion.Close(); |
|
291 |
|
292 // Where we were drawing transparent and doing top element only, remove |
|
293 // that bit too: |
|
294 if (!iTopElement.IsEmpty()) |
|
295 { |
|
296 region.Intersect(iTopElement); |
|
297 iRegion.SubRegion(region); |
|
298 } |
|
299 } |
|
300 region.Close(); |
|
301 } |
|
302 |
|
303 return(iRegion.IsEmpty() || !iScheduledRegionsOk); |
|
304 } |
|
305 |
|
306 const TRegion& TWalkWindowTreeScheduleRegions::WindowRegion(const CWsWindow& aWin) const |
|
307 { |
|
308 WS_ASSERT_DEBUG(iScheduledRegionsOk, EWsPanicScheduledRedraw); |
|
309 return aWin.ScheduledRegion(); |
|
310 } |
|
311 |
|
312 const TRegion& TWalkWindowTreeScheduleRegions::SpriteRegion(const CWsWindow& aWin) const |
|
313 { |
|
314 //Intentionally returning WindowRegion as TWalkWindowTreeScheduleRegions do not |
|
315 //make use of ScheduledSpriteRegion |
|
316 return aWin.ScheduledRegion(); |
|
317 } |
|
318 |
|
319 TBool TWalkWindowTreeScheduleRegions::ScheduledRegionsOk() const |
|
320 { |
|
321 return iScheduledRegionsOk; |
|
322 } |
|
323 |
|
324 TWalkWindowTreeScheduleFallback::TWalkWindowTreeScheduleFallback(CScreen::CFallbackMap * aFallbackMap) : |
|
325 TWalkWindowTreeSchedule(), |
|
326 iFallbackMap(aFallbackMap) |
|
327 { |
|
328 } |
|
329 |
|
330 // This is similar to TWalkWindowTreeRegionBase::DoIt |
|
331 TBool TWalkWindowTreeScheduleFallback::DoIt(CWsWindow *aWin) |
|
332 { |
|
333 WS_ASSERT_DEBUG((aWin != iHead), EWsPanicScheduledRedraw); |
|
334 if (aWin->IsVisible()) |
|
335 { |
|
336 if (aWin == aWin->RootWindow()) |
|
337 { |
|
338 aWin->SetNextScheduled(iHead); |
|
339 return ETrue; |
|
340 } |
|
341 else |
|
342 { |
|
343 TBool addWindow = EFalse; |
|
344 CWsClientWindow* cliWin = static_cast<CWsClientWindow *>(aWin); |
|
345 if (cliWin->IsTranslucent()) |
|
346 { |
|
347 addWindow = ETrue; // costs more to work out than it is worth |
|
348 const TRegion * opaque = cliWin->GetUserOpaqueRegion(); |
|
349 if (opaque && !opaque->CheckError()) |
|
350 iFallbackMap->FillRegion(*opaque); |
|
351 } |
|
352 else |
|
353 { |
|
354 addWindow = iFallbackMap->FillRegion(*cliWin->BaseArea()); |
|
355 } |
|
356 if (addWindow) |
|
357 { |
|
358 aWin->SetNextScheduled(iHead); |
|
359 iHead = aWin; |
|
360 } |
|
361 } |
|
362 } |
|
363 |
|
364 return(iFallbackMap->Count() < 1); |
|
365 } |
|
366 |
|
367 const TRegion& TWalkWindowTreeScheduleFallback::WindowRegion(const CWsWindow& aWin) const |
|
368 { |
|
369 if (&aWin == aWin.RootWindow()) |
|
370 return *(iFallbackMap->Region()); |
|
371 else |
|
372 { |
|
373 const CWsClientWindow& win = static_cast<const CWsClientWindow&>(aWin); |
|
374 const TRegion* region = win.VisibleRegionIfValid(); |
|
375 if (!region) |
|
376 region = win.BaseArea(); |
|
377 return *region; |
|
378 } |
|
379 } |
|
380 |
|
381 const TRegion& TWalkWindowTreeScheduleFallback::SpriteRegion(const CWsWindow& aWin) const |
|
382 { |
|
383 return WindowRegion(aWin); |
|
384 } |
|
385 |
|
386 TWalkWindowTreeIsObscured::TWalkWindowTreeIsObscured(TBool &aResult) : |
|
387 iResult(&aResult) |
|
388 { |
|
389 aResult=ETrue; |
|
390 } |
|
391 |
|
392 TBool TWalkWindowTreeIsObscured::DoIt(CWsWindow *aWin) |
|
393 { |
|
394 if (!aWin->VisibleRegion().IsEmpty()) |
|
395 { |
|
396 *iResult=EFalse; |
|
397 return(ETrue); |
|
398 } |
|
399 return(EFalse); |
|
400 } |
|
401 |
|
402 TWalkWindowTreeSetupVisibleRegionTracking::TWalkWindowTreeSetupVisibleRegionTracking(TBool aRegister) : iRegister(aRegister) |
|
403 { |
|
404 } |
|
405 |
|
406 TBool TWalkWindowTreeSetupVisibleRegionTracking::DoIt(CWsWindow *aWin) |
|
407 { |
|
408 ASSERT(aWin->WinType() == EWinTypeClient); |
|
409 if(aWin->WinType() == EWinTypeClient) |
|
410 { |
|
411 aWin->SetupVisibleRegionTracking(iRegister); |
|
412 } |
|
413 return(EFalse); |
|
414 } |
|
415 |
|
416 TWalkWindowTreeSetNonFading::TWalkWindowTreeSetNonFading(TBool aNonFading) : |
|
417 iNonFading(aNonFading) |
|
418 {} |
|
419 TBool TWalkWindowTreeSetNonFading::DoIt(CWsWindow *aWin) |
|
420 { |
|
421 aWin->SetNonFading(iNonFading); |
|
422 return EFalse; |
|
423 } |
|
424 |
|
425 TWalkWindowTreeSetFaded::TWalkWindowTreeSetFaded(TBool aFaded,CWsWindowBase* aWin,TUint8 aBlackMap,TUint8 aWhiteMap) : |
|
426 iBlackMap(aBlackMap), iWhiteMap(aWhiteMap), iFaded(aFaded), iGroup(aWin->WinGroup()) |
|
427 { |
|
428 } |
|
429 |
|
430 TBool TWalkWindowTreeSetFaded::DoIt(CWsWindow *aWin) |
|
431 { |
|
432 if (aWin->WinGroup()!=iGroup) |
|
433 return ETrue; |
|
434 |
|
435 const TBool KNotifyObserver = ETrue; |
|
436 TBool dummy; //not used in this case |
|
437 ((CWsClientWindow*)aWin)->SetFaded(iFaded, iBlackMap, iWhiteMap, KNotifyObserver, dummy); |
|
438 return EFalse; |
|
439 } |
|
440 |
|
441 TWalkWindowTreeSetSystemFaded::TWalkWindowTreeSetSystemFaded(TBool aFaded, CWsWindowBase* aWin, TUint8 aBlackMap, TUint8 aWhiteMap, TBool& aStateChanged) : |
|
442 TWalkWindowTreeSetFaded(aFaded, aWin, aBlackMap, aWhiteMap), |
|
443 iStateChanged(aStateChanged) |
|
444 { |
|
445 } |
|
446 |
|
447 TBool TWalkWindowTreeSetSystemFaded::DoIt(CWsWindow *aWin) |
|
448 { |
|
449 if (aWin->WinGroup()!=iGroup) |
|
450 return ETrue; |
|
451 |
|
452 const TBool KNotifyObserver = EFalse; //don't send fade state change notification |
|
453 |
|
454 TBool stateChanged = EFalse; |
|
455 ((CWsClientWindow*)aWin)->SetFaded(iFaded, iBlackMap, iWhiteMap, KNotifyObserver, stateChanged); |
|
456 iStateChanged = iStateChanged || stateChanged; |
|
457 |
|
458 return EFalse; |
|
459 } |
|
460 |
|
461 TWalkWindowTreePurgeEvents::TWalkWindowTreePurgeEvents() |
|
462 {} |
|
463 |
|
464 TBool TWalkWindowTreePurgeEvents::DoIt(CWsWindow *aWin) |
|
465 { |
|
466 aWin->PurgeEvents(); |
|
467 return EFalse; |
|
468 } |
|
469 |
|
470 TWalkWindowTreeCalcInvalidGraphics::TWalkWindowTreeCalcInvalidGraphics(RWsRegion *aRegion,TRegion &aDirty,const TArray<TGraphicDrawerId>& aInvalid): |
|
471 TWalkWindowTreeRegionBase(aRegion, EWalkTranslucent), |
|
472 iDirty(aDirty), |
|
473 iInvalid(aInvalid) |
|
474 { |
|
475 } |
|
476 |
|
477 void TWalkWindowTreeCalcInvalidGraphics::DestroyRegions() |
|
478 { |
|
479 if(iSubRegion) |
|
480 { |
|
481 iSubRegion->Close(); |
|
482 } |
|
483 delete iSubRegion; |
|
484 iSubRegion = NULL; |
|
485 iDirty.Clear(); |
|
486 } |
|
487 |
|
488 void TWalkWindowTreeCalcInvalidGraphics::CalcInvalid(CScreen& aScreen) |
|
489 { |
|
490 if(aScreen.RootWindow()) |
|
491 { |
|
492 aScreen.RootWindow()->WalkWindowTree(*this,EWalkChildren); |
|
493 if(iRegion->CheckError()) |
|
494 { |
|
495 iDirty.ForceError(); |
|
496 } |
|
497 } |
|
498 } |
|
499 |
|
500 TBool TWalkWindowTreeCalcInvalidGraphics::CreateSubRegion() |
|
501 { |
|
502 iSubRegion=new RWsRegion; |
|
503 return iSubRegion!=NULL; |
|
504 } |
|
505 |
|
506 TBool TWalkWindowTreeCalcInvalidGraphics::DoIt3(CWsWindow *aWin) |
|
507 { |
|
508 if (!iDirty.CheckError() && aWin->Redraw() && |
|
509 aWin->Redraw()->Contains(iInvalid,aWin->VisibleRegion()) && |
|
510 !aWin->Redraw()->RedrawingInProgress()) |
|
511 { |
|
512 STACK_REGION intersection; |
|
513 intersection.Intersection(*iSubRegion,aWin->VisibleRegion()); |
|
514 iDirty.Union(intersection); |
|
515 intersection.Close(); |
|
516 } |
|
517 |
|
518 return iDirty.CheckError(); //causes pessimistic full-screen redraw if failed |
|
519 } |
|
520 |
|
521 #if defined(_DEBUG) |
|
522 |
|
523 TBool TWalkWindowTreeCheck::DoIt(CWsWindow *aWin) |
|
524 { |
|
525 if (aWin->WinType()==EWinTypeRoot) |
|
526 { |
|
527 WS_ASSERT_DEBUG(aWin->BaseParent()==NULL, EWsPanicWindowCheck); |
|
528 WS_ASSERT_DEBUG(aWin->NextSibling()==NULL, EWsPanicWindowCheck); |
|
529 } |
|
530 else |
|
531 { |
|
532 WS_ASSERT_DEBUG(aWin->WinType()==EWinTypeClient, EWsPanicWindowCheck); |
|
533 } |
|
534 if (aWin->BaseChild()) |
|
535 { |
|
536 WS_ASSERT_DEBUG(aWin->BaseChild()->BaseParent()==aWin, EWsPanicWindowCheck); |
|
537 } |
|
538 if (aWin->NextSibling()) |
|
539 { |
|
540 WS_ASSERT_DEBUG(aWin->NextSibling()->GetPrevSibling()==aWin, EWsPanicWindowCheck); |
|
541 } |
|
542 return(EFalse); |
|
543 } |
|
544 |
|
545 TBool TWalkWindowTreeFindWithFlag::DoIt(CWsWindow *aWin) |
|
546 { |
|
547 if (aWin->iFlags & iFlag) |
|
548 { |
|
549 iFound = aWin; |
|
550 return ETrue; |
|
551 } |
|
552 return EFalse; |
|
553 } |
|
554 |
|
555 #endif |
|
556 |
|
557 #include "wnredraw.h" |
|
558 TWalkWindowTreeRedrawStoreSize::TWalkWindowTreeRedrawStoreSize() : iTotalSize(0) |
|
559 { |
|
560 } |
|
561 |
|
562 TBool TWalkWindowTreeRedrawStoreSize::DoIt(CWsWindow *aWin) |
|
563 { |
|
564 iTotalSize += aWin->Redraw()->SizeInBytes(); |
|
565 return EFalse; |
|
566 } |
|
567 |
|
568 |
|
569 TBool TWalkWindowTreeFindByHandle::DoIt(CWsWindow *aWin) |
|
570 { |
|
571 if (aWin->ClientHandle() == iHandle) |
|
572 { |
|
573 iFound = aWin; |
|
574 return ETrue; |
|
575 } |
|
576 return EFalse; |
|
577 } |
|
578 |
|
579 TWalkWindowTreeUpdateRegions::TWalkWindowTreeUpdateRegions(CScreen & aScreen) : |
|
580 iScreen(aScreen) |
|
581 { |
|
582 } |
|
583 |
|
584 void TWalkWindowTreeUpdateRegions::Walk() |
|
585 { |
|
586 STACK_REGION floatingSpriteRgn; |
|
587 iScreen.SpriteManager()->CalcFloatingSpriteRgn( floatingSpriteRgn, iScreen.RootWindow()->AbsRect() ); |
|
588 iVisible.AddRect(iScreen.RootWindow()->AbsRect()); |
|
589 iTop.AddRect(iScreen.RootWindow()->AbsRect()); |
|
590 iRemainsOfFadableScreen.AddRect( iScreen.RootWindow()->AbsRect() ); |
|
591 iTop.SubRegion(floatingSpriteRgn); |
|
592 iScreen.RootWindow()->WalkWindowTree(*this, EWalkChildren); |
|
593 iTop.Close(); |
|
594 iVisible.Close(); |
|
595 iRemainsOfFadableScreen.Close(); |
|
596 floatingSpriteRgn.Close(); |
|
597 } |
|
598 |
|
599 TBool TWalkWindowTreeUpdateRegions::DoIt(CWsWindow * aWin) |
|
600 { |
|
601 if (aWin->IsVisible() && !iVisible.IsEmpty()) |
|
602 { |
|
603 // Calculate the region we care about for this window: |
|
604 STACK_REGION newVisibleRegion; |
|
605 STACK_REGION newFadableRegion; |
|
606 if (aWin->WinType()==EWinTypeRoot) |
|
607 { |
|
608 newVisibleRegion.Copy(iVisible); |
|
609 } |
|
610 else |
|
611 { |
|
612 static_cast<CWsClientWindow *>(aWin)->GetClippedBaseArea(newVisibleRegion); |
|
613 newVisibleRegion.Intersect(iVisible); |
|
614 if (!aWin->IsTranslucent()) |
|
615 { |
|
616 iVisible.SubRegion(newVisibleRegion); |
|
617 } |
|
618 else |
|
619 { |
|
620 STACK_REGION opaque; |
|
621 static_cast<CWsClientWindow *>(aWin)->GetOpaqueClippedBaseArea(opaque); |
|
622 iVisible.SubRegion(opaque); |
|
623 opaque.Close(); |
|
624 } |
|
625 //If the window has been faded calculate what region actually needs fading |
|
626 //(i.e. subtract what has already been faded) |
|
627 if ( aWin->FadeCount() && !aWin->IsNonFading() && aWin->IsVisible() && !iRemainsOfFadableScreen.IsEmpty() ) |
|
628 { |
|
629 newFadableRegion.Copy( newVisibleRegion ); |
|
630 newFadableRegion.Intersect( iRemainsOfFadableScreen ); |
|
631 } |
|
632 } |
|
633 aWin->SetVisibleRegion(newVisibleRegion, &iTop); |
|
634 aWin->SetFadeableRegion(newFadableRegion, iTop); |
|
635 |
|
636 iRemainsOfFadableScreen.SubRegion( newFadableRegion ); |
|
637 newFadableRegion.Close(); |
|
638 |
|
639 iTop.SubRegion(newVisibleRegion); |
|
640 newVisibleRegion.Close(); |
|
641 } |
|
642 else |
|
643 { |
|
644 if (!aWin->VisibleRegion().IsEmpty()) |
|
645 { |
|
646 aWin->ClearVisibleRegion(); |
|
647 } |
|
648 } |
|
649 return(EFalse); |
|
650 } |
|
651 |
|
652 TWalkWindowTreeScheduleRedraws::TWalkWindowTreeScheduleRedraws(): |
|
653 iScheduleRedrawFilter( ERedrawFilterNoFilter ) |
|
654 { |
|
655 } |
|
656 |
|
657 TWalkWindowTreeScheduleRedraws::TWalkWindowTreeScheduleRedraws( TUint32 aFilter ): |
|
658 iScheduleRedrawFilter( aFilter ) |
|
659 { |
|
660 } |
|
661 |
|
662 TBool TWalkWindowTreeScheduleRedraws::DoIt(CWsWindow * aWin) |
|
663 { |
|
664 if (aWin->WinType() != EWinTypeClient || static_cast<CWsClientWindow *>(aWin)->HasBeenDrawnToScreen()) |
|
665 { |
|
666 TBool ban = (iScheduleRedrawFilter & ERedrawFilterOmitDSA) && ( aWin->IsDSAHost() ); |
|
667 if ( !ban ) |
|
668 { |
|
669 aWin->Screen()->AddRedrawRegion(aWin->VisibleRegion()); |
|
670 } |
|
671 } |
|
672 return EFalse; |
|
673 } |
|
674 |
|
675 TWalkWindowTreeOffsetTransparentRegions::TWalkWindowTreeOffsetTransparentRegions(const TPoint& aOffset) : |
|
676 iOffset(aOffset) |
|
677 { |
|
678 } |
|
679 |
|
680 TBool TWalkWindowTreeOffsetTransparentRegions::DoIt(CWsWindow * aWin) |
|
681 { |
|
682 if (aWin != aWin->RootWindow()) |
|
683 static_cast<CWsClientWindow *>(aWin)->OffsetUserTransparentRegion(iOffset); |
|
684 return EFalse; |
|
685 } |
|
686 |
|
687 TWalkWindowTreeRecalcOpaque::TWalkWindowTreeRecalcOpaque() |
|
688 { |
|
689 } |
|
690 |
|
691 TBool TWalkWindowTreeRecalcOpaque::DoIt(CWsWindow * aWin) |
|
692 { |
|
693 if (aWin != aWin->RootWindow()) |
|
694 static_cast<CWsClientWindow *>(aWin)->SetUserOpaqueRegion(); |
|
695 return EFalse; |
|
696 } |
|
697 |
|
698 TWalkWindowTreeSendState::TWalkWindowTreeSendState(MWsWindowTreeObserver& aWindowTreeObserver) |
|
699 : iWindowTreeObserver(aWindowTreeObserver) |
|
700 { |
|
701 } |
|
702 |
|
703 TBool TWalkWindowTreeSendState::DoIt(CWsWindow * aWin) |
|
704 { |
|
705 aWin->SendState(iWindowTreeObserver); |
|
706 return EFalse; |
|
707 } |