|
1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Display sub session |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include "alfsrvdisplaysubsession.h" |
|
21 #include "alf/alfconstants.h" |
|
22 #include "alf/alfappsrvsessionbase.h" |
|
23 #include "alfappsrvsession.h" |
|
24 #include "alfsrvscreenbuffermanager.h" |
|
25 #include "alfsrvtranseffect.h" |
|
26 #include <alf/alfdisplaybackgrounditem.h> |
|
27 #include <uiacceltk/HuiEnv.h> |
|
28 #include <uiacceltk/HuiDisplay.h> |
|
29 #include <uiacceltk/HuiDisplayCoeControl.h> |
|
30 #include <uiacceltk/HuiControlGroup.h> |
|
31 #include <uiacceltk/HuiControl.h> |
|
32 #include <uiacceltk/huidisplaybackgrounditem.h> |
|
33 #include <uiacceltk/HuiEvent.h> |
|
34 #include <mtransitionserver.h> |
|
35 |
|
36 |
|
37 // ======== MEMBER FUNCTIONS ======== |
|
38 |
|
39 // --------------------------------------------------------------------------- |
|
40 // Constructor |
|
41 // --------------------------------------------------------------------------- |
|
42 // |
|
43 CAlfSrvDisplaySubSession::CAlfSrvDisplaySubSession( |
|
44 CAlfAppSrvSessionBase& aSession, |
|
45 const TRect& aRect, |
|
46 TInt aWindowGroupId, |
|
47 TInt aDisplayType, |
|
48 const TUid& aBufferUid) |
|
49 : CAlfSrvSubSessionBase( aSession ), |
|
50 iDisplayType(aDisplayType), |
|
51 iScreenBufferUid(aBufferUid), |
|
52 iRect(aRect), |
|
53 iDisplayClearBackground(CHuiDisplay::EClearWithSkinBackground), |
|
54 iDisplayRenderingQuality(EHuiQualityAccurate), |
|
55 iDisplayUseDepthTest(EFalse), |
|
56 iDisplayUsage(0) |
|
57 |
|
58 { |
|
59 if (!IsTvOut()) |
|
60 { |
|
61 // Note: Might not work if there are multiple displays: the client drawing area is set |
|
62 // according to the last display. Also the new area is left there even if ConstructL() |
|
63 // fails(!). |
|
64 static_cast<CAlfAppSrvSession&>(Session()).SetClientDrawingArea( aRect ); |
|
65 aSession.SetClientWindowGroupId( aWindowGroupId ); |
|
66 } |
|
67 } |
|
68 |
|
69 |
|
70 // --------------------------------------------------------------------------- |
|
71 // 2nd phasse constructor |
|
72 // --------------------------------------------------------------------------- |
|
73 // |
|
74 void CAlfSrvDisplaySubSession::ConstructL() |
|
75 { |
|
76 CAlfSrvSubSessionBase::ConstructL(); |
|
77 |
|
78 // With one display, use the existing one or create one if there aren't any. |
|
79 const TRect& rect = CHuiStatic::ScreenDevice()->SizeInPixels(); |
|
80 |
|
81 // when running oldstyle, we may have rect different from whole screen |
|
82 if (Session().AlfAppUi()->Container()) |
|
83 { |
|
84 const TRect& rect = Session().AlfAppUi()->Container()->Rect(); |
|
85 } |
|
86 |
|
87 // Shared normal screen 0 |
|
88 if ((iDisplayType == CHuiDisplay::EDisplayLcd0) || |
|
89 ((iDisplayType == CHuiDisplay::EDisplayNormal) && (iScreenBufferUid == KHuiUidBackBufferScreen0))) |
|
90 { |
|
91 iDisplay = |
|
92 Session().SharedHuiEnv()->DisplayCount() ? |
|
93 &Session().SharedHuiEnv()->PrimaryDisplay() : |
|
94 &Session().SharedHuiEnv()->NewDisplayL( rect, Session().AlfAppUi()->Container(), 0, |
|
95 NULL, CHuiDisplay::EDisplayNormal, iScreenBufferUid ); |
|
96 |
|
97 Session().AlfAppUi()->AppendDisplayOnSharedWindowL(*iDisplay); |
|
98 |
|
99 #ifdef TFXSERVER_API_V2 |
|
100 // Register to Tfx Server |
|
101 MTransitionServer2* tfxServer = Session().AlfServer()->TfxServer(); |
|
102 if (tfxServer) |
|
103 { |
|
104 // Note: if this returns KErrNotFound, it is also send to Tfx server |
|
105 TInt wgId = Session().ClientWindowGroup(); |
|
106 // Just ignore returned error code. Can this cause trouble? |
|
107 tfxServer->RegisterApp(MTransitionServer2::ETypeAlf, wgId, KNullUid, KNullUid); |
|
108 } |
|
109 #endif |
|
110 } |
|
111 |
|
112 // Off screen buffer |
|
113 else if (iDisplayType == CHuiDisplay::EDisplayOffScreenBuffer) |
|
114 { |
|
115 iDisplay = &Session().SharedHuiEnv()->NewDisplayL( rect, Session().AlfAppUi()->Container(), 0, NULL, iDisplayType, iScreenBufferUid ); |
|
116 |
|
117 TRect clipped = rect; |
|
118 if (clipped.Intersects(iRect)) |
|
119 { |
|
120 clipped.Intersection(iRect); |
|
121 } |
|
122 |
|
123 iDisplay->SetVisibleArea(clipped); |
|
124 } |
|
125 |
|
126 // Shared TV-out display |
|
127 else if (IsTvOut()) |
|
128 { |
|
129 if (Session().SharedHuiEnv()->DisplayCount() == 0) |
|
130 { |
|
131 // Primary lcd must exist before tv out is created |
|
132 User::Leave(KErrNotFound); |
|
133 } |
|
134 else |
|
135 { |
|
136 iDisplay = &Session().SharedHuiEnv()->NewDisplayL( iRect, |
|
137 Session().AlfAppUi()->Container(), |
|
138 0, |
|
139 &Session().SharedHuiEnv()->PrimaryDisplay(), |
|
140 CHuiDisplay::EDisplayNormal, |
|
141 KHuiUidBackBufferTvOutNormal |
|
142 ); |
|
143 } |
|
144 } |
|
145 else |
|
146 { |
|
147 User::Leave(KErrNotFound); |
|
148 } |
|
149 |
|
150 // If we have screen buffer observers for the new display, add Alf server as an observer |
|
151 TAlfScreenBufferEvent event = {iScreenBufferUid, MHuiScreenBufferObserver::ECreated, TRect(), TRect()}; |
|
152 if (Session().AlfServer()->ScreenBufferManager().TriggerScreenBufferEvent(event)) |
|
153 { |
|
154 iDisplay->AddScreenBufferObserverL(&Session().AlfServer()->ScreenBufferManager()); |
|
155 } |
|
156 |
|
157 } |
|
158 |
|
159 |
|
160 // --------------------------------------------------------------------------- |
|
161 // NewL |
|
162 // --------------------------------------------------------------------------- |
|
163 // |
|
164 CAlfSrvDisplaySubSession* CAlfSrvDisplaySubSession::NewL( |
|
165 CAlfAppSrvSessionBase& aSession, |
|
166 const TRect& aRect, |
|
167 TInt aWindowGroupId, |
|
168 TInt aDisplayType, |
|
169 const TUid& aBufferUid ) |
|
170 { |
|
171 CAlfSrvDisplaySubSession* self = |
|
172 CAlfSrvDisplaySubSession::NewLC( aSession, aRect, aWindowGroupId, aDisplayType, aBufferUid ); |
|
173 CleanupStack::Pop( self ); |
|
174 return self; |
|
175 } |
|
176 |
|
177 |
|
178 // --------------------------------------------------------------------------- |
|
179 // NewLC |
|
180 // --------------------------------------------------------------------------- |
|
181 // |
|
182 CAlfSrvDisplaySubSession* CAlfSrvDisplaySubSession::NewLC( |
|
183 CAlfAppSrvSessionBase& aSession, |
|
184 const TRect& aRect, |
|
185 TInt aWindowGroupId, |
|
186 TInt aDisplayType, |
|
187 const TUid& aBufferUid ) |
|
188 { |
|
189 CAlfSrvDisplaySubSession* self = |
|
190 new( ELeave ) CAlfSrvDisplaySubSession( aSession, aRect, aWindowGroupId, aDisplayType, aBufferUid); |
|
191 CleanupClosePushL( *self ); |
|
192 self->ConstructL(); |
|
193 return self; |
|
194 } |
|
195 |
|
196 |
|
197 // --------------------------------------------------------------------------- |
|
198 // Destructor |
|
199 // --------------------------------------------------------------------------- |
|
200 // |
|
201 CAlfSrvDisplaySubSession::~CAlfSrvDisplaySubSession() |
|
202 { |
|
203 if (iDisplay && (IsTvOut() || (iDisplayType == CHuiDisplay::EDisplayOffScreenBuffer))) |
|
204 { |
|
205 if (IsTvOut()) |
|
206 { |
|
207 Session().AlfAppUi()->RemoveTvDisplayOnSharedWindow(*iDisplay); |
|
208 } |
|
209 delete iDisplay; |
|
210 } |
|
211 iDisplay = NULL; |
|
212 iBackgroundItems.Close(); |
|
213 |
|
214 // If we are deleting shared screen subsession, deregister to Tfx Server |
|
215 if ((iDisplayType == CHuiDisplay::EDisplayLcd0) || |
|
216 ((iDisplayType == CHuiDisplay::EDisplayNormal) && (iScreenBufferUid == KHuiUidBackBufferScreen0))) |
|
217 { |
|
218 #ifdef TFXSERVER_API_V2 |
|
219 MTransitionServer2* tfxServer = Session().AlfServer()->TfxServer(); |
|
220 if (tfxServer) |
|
221 { |
|
222 // Note: if this returns KErrNotFound, it is also send to Tfx server |
|
223 TInt wgId = Session().ClientWindowGroup(); |
|
224 tfxServer->UnregisterApp(MTransitionServer2::ETypeAlf, wgId); |
|
225 } |
|
226 #endif |
|
227 } |
|
228 |
|
229 |
|
230 } |
|
231 |
|
232 // --------------------------------------------------------------------------- |
|
233 // Gets display |
|
234 // --------------------------------------------------------------------------- |
|
235 // |
|
236 CHuiDisplay& CAlfSrvDisplaySubSession::Display() |
|
237 { |
|
238 return *iDisplay; |
|
239 } |
|
240 |
|
241 // --------------------------------------------------------------------------- |
|
242 // Sets background clear mode. |
|
243 // --------------------------------------------------------------------------- |
|
244 // |
|
245 void CAlfSrvDisplaySubSession::SetClearBackgroundL( const RMessage2& aMessage ) |
|
246 { |
|
247 CAlfAppSrvSession& session = static_cast<CAlfAppSrvSession&>(Session()); |
|
248 // Parse parameters |
|
249 |
|
250 // 1: clear background (in) |
|
251 const TInt clearBackground = aMessage.Int1(); |
|
252 |
|
253 if ( session.IsFocused() ) |
|
254 { |
|
255 // Clear the background items, those are not used in this case |
|
256 iBackgroundItems.Reset(); |
|
257 |
|
258 // Set background |
|
259 Display().SetClearBackgroundL( CHuiDisplay::TClearMode( clearBackground )); |
|
260 } |
|
261 |
|
262 // Complete |
|
263 aMessage.Complete( KErrNone ); |
|
264 |
|
265 // Store value for this client |
|
266 iDisplayClearBackground = clearBackground; |
|
267 } |
|
268 |
|
269 // --------------------------------------------------------------------------- |
|
270 // Sets visible area. |
|
271 // --------------------------------------------------------------------------- |
|
272 // |
|
273 void CAlfSrvDisplaySubSession::SetVisibleAreaL( const RMessage2& aMessage, TBool aForce ) |
|
274 { |
|
275 // Parse parameters |
|
276 |
|
277 // 1: area rect (in) |
|
278 TRect rect; |
|
279 TPckg<TRect> rectPckg(rect); |
|
280 aMessage.Read(1,rectPckg); |
|
281 |
|
282 CAlfAppSrvSession& session = static_cast<CAlfAppSrvSession&>(Session()); |
|
283 |
|
284 // Set clipping rect for display visible area to e.g. avoid unnecesssary |
|
285 // drawing under Avkon status/control pane areas. TV out does not show |
|
286 // those so no clipping in that case. |
|
287 if (UseVisualAreaClipping()) |
|
288 { |
|
289 iRect = rect; |
|
290 |
|
291 if ( session.IsFocused() ) |
|
292 { |
|
293 TRect clipped = Session().AlfAppUi()->Container()->Rect(); |
|
294 #ifndef SYMBIAN_BUILD_GCE |
|
295 if (clipped.Intersects(rect)) |
|
296 { |
|
297 clipped.Intersection(rect); |
|
298 } |
|
299 #endif |
|
300 iDisplay->SetVisibleAreaClippingRect(clipped); |
|
301 iDisplay->SetDirty(); |
|
302 } |
|
303 } |
|
304 |
|
305 // Set visible area |
|
306 if ( session.IsFocused() || aForce ) |
|
307 { |
|
308 static_cast<CAlfAppSrvSession&>(Session()).SetClientDrawingArea( rect ); |
|
309 } |
|
310 // Complete |
|
311 aMessage.Complete( KErrNone ); |
|
312 } |
|
313 |
|
314 // --------------------------------------------------------------------------- |
|
315 // Returns the visible area. |
|
316 // --------------------------------------------------------------------------- |
|
317 // |
|
318 void CAlfSrvDisplaySubSession::VisibleAreaL( const RMessage2& aMessage ) |
|
319 { |
|
320 // Parse parameters |
|
321 |
|
322 // 2: area rect (out) |
|
323 TRect rect; |
|
324 TPckg<TRect> rectPckg(rect); |
|
325 aMessage.Read(2,rectPckg); |
|
326 |
|
327 // Get visible area |
|
328 rect = static_cast<CAlfAppSrvSession&>(Session()).ClientDrawingArea(); |
|
329 |
|
330 // Write parameters |
|
331 aMessage.Write(2,rectPckg); |
|
332 |
|
333 // Complete |
|
334 aMessage.Complete( KErrNone ); |
|
335 } |
|
336 |
|
337 |
|
338 // --------------------------------------------------------------------------- |
|
339 // Sets display dirty |
|
340 // --------------------------------------------------------------------------- |
|
341 // |
|
342 void CAlfSrvDisplaySubSession::SetDirtyL( const RMessage2& aMessage ) |
|
343 { |
|
344 CAlfAppSrvSession& session = static_cast<CAlfAppSrvSession&>(Session()); |
|
345 |
|
346 if ( session.IsFocused() ) |
|
347 { |
|
348 Display().SetDirty(); |
|
349 } |
|
350 |
|
351 // Complete |
|
352 aMessage.Complete( KErrNone ); |
|
353 } |
|
354 |
|
355 // --------------------------------------------------------------------------- |
|
356 // Sets display rendering quality |
|
357 // --------------------------------------------------------------------------- |
|
358 // |
|
359 void CAlfSrvDisplaySubSession::SetQualityL( const RMessage2& aMessage ) |
|
360 { |
|
361 CAlfAppSrvSession& session = static_cast<CAlfAppSrvSession&>(Session()); |
|
362 |
|
363 // Parse parameters |
|
364 |
|
365 // 1: quality (in) |
|
366 THuiQuality value = EHuiQualityAccurate; |
|
367 TPckg<THuiQuality> valuePckg(value); |
|
368 aMessage.Read(1,valuePckg); |
|
369 |
|
370 if ( session.IsFocused() ) |
|
371 { |
|
372 // Set quality |
|
373 Display().SetQuality(value); |
|
374 } |
|
375 |
|
376 // Complete |
|
377 aMessage.Complete( KErrNone ); |
|
378 |
|
379 // Store value for this client |
|
380 iDisplayRenderingQuality = value; |
|
381 } |
|
382 |
|
383 // --------------------------------------------------------------------------- |
|
384 // Gets display rendering quality |
|
385 // --------------------------------------------------------------------------- |
|
386 // |
|
387 void CAlfSrvDisplaySubSession::QualityL( const RMessage2& aMessage ) |
|
388 { |
|
389 CAlfAppSrvSession& session = static_cast<CAlfAppSrvSession&>(Session()); |
|
390 |
|
391 // Parse parameters |
|
392 |
|
393 // 2: quality (out) |
|
394 THuiQuality value = EHuiQualityAccurate; |
|
395 TPckg<THuiQuality> valuePckg(value); |
|
396 |
|
397 if ( session.IsFocused() ) |
|
398 { |
|
399 // Get quality |
|
400 value = Display().Quality(); |
|
401 } |
|
402 else |
|
403 { |
|
404 value = THuiQuality(iDisplayRenderingQuality); |
|
405 } |
|
406 |
|
407 // Write parameters |
|
408 aMessage.Write(2,valuePckg); |
|
409 |
|
410 // Complete |
|
411 aMessage.Complete( KErrNone ); |
|
412 } |
|
413 |
|
414 // --------------------------------------------------------------------------- |
|
415 // Sets display depth test usage |
|
416 // --------------------------------------------------------------------------- |
|
417 // |
|
418 void CAlfSrvDisplaySubSession::SetUseDepthL( const RMessage2& aMessage ) |
|
419 { |
|
420 CAlfAppSrvSession& session = static_cast<CAlfAppSrvSession&>(Session()); |
|
421 |
|
422 // Parse parameters |
|
423 |
|
424 // 1: bool (in) |
|
425 TBool value = EFalse; |
|
426 TPckg<TBool> valuePckg(value); |
|
427 aMessage.Read(1,valuePckg); |
|
428 |
|
429 // Update value if the client is on focus |
|
430 if ( session.IsFocused() ) |
|
431 { |
|
432 // Set use depth |
|
433 Display().SetUseDepth(value); |
|
434 } |
|
435 |
|
436 // Complete |
|
437 aMessage.Complete( KErrNone ); |
|
438 |
|
439 // Store value for this client |
|
440 iDisplayUseDepthTest = value; |
|
441 } |
|
442 |
|
443 // --------------------------------------------------------------------------- |
|
444 // Sets display usage |
|
445 // --------------------------------------------------------------------------- |
|
446 // |
|
447 void CAlfSrvDisplaySubSession::SetUsageL( const RMessage2& aMessage ) |
|
448 { |
|
449 CAlfAppSrvSession& session = static_cast<CAlfAppSrvSession&>(Session()); |
|
450 |
|
451 // Parse parameters |
|
452 |
|
453 // 1: TUint (in) |
|
454 TUint value = 0; |
|
455 TPckg<TUint> valuePckg(value); |
|
456 aMessage.Read(1,valuePckg); |
|
457 |
|
458 // Update value if the client is on focus |
|
459 if ( session.IsFocused() ) |
|
460 { |
|
461 // Set use depth |
|
462 Display().SetUsageL(value); |
|
463 } |
|
464 |
|
465 // Complete |
|
466 aMessage.Complete( KErrNone ); |
|
467 |
|
468 // Store value for this client |
|
469 iDisplayUsage = value; |
|
470 } |
|
471 |
|
472 // --------------------------------------------------------------------------- |
|
473 // Sets visual content for the window |
|
474 // --------------------------------------------------------------------------- |
|
475 // |
|
476 void CAlfSrvDisplaySubSession::SetClientWindowForDrawingL( const RMessage2& aMessage ) |
|
477 { |
|
478 CAlfAppSrvSession& session = static_cast<CAlfAppSrvSession&>(Session()); |
|
479 |
|
480 // Parse parameters |
|
481 |
|
482 // 1: TUint (in) |
|
483 TInt3 data(0,0,0); |
|
484 TPckg<TInt3> dataPckg(data); |
|
485 aMessage.Read(1,dataPckg); |
|
486 |
|
487 // Update value even if the client is not in focus |
|
488 |
|
489 CHuiVisual* visual = NULL; |
|
490 TInt visualHandle = data.iInt3; |
|
491 if (visualHandle) |
|
492 { |
|
493 visual = (CHuiVisual*) Session().GetInterfaceL(EHuiObjectTypeVisual, visualHandle); |
|
494 } |
|
495 Session().AlfAppUi()->SetClientWindowForDrawingL(data.iInt1, data.iInt2, visual); |
|
496 |
|
497 // Complete |
|
498 aMessage.Complete( KErrNone ); |
|
499 } |
|
500 |
|
501 // --------------------------------------------------------------------------- |
|
502 // Sets display bqckground items |
|
503 // --------------------------------------------------------------------------- |
|
504 // |
|
505 void CAlfSrvDisplaySubSession::SetBackgroundItemsL( const RMessage2& aMessage ) |
|
506 { |
|
507 CAlfAppSrvSession& session = static_cast<CAlfAppSrvSession&>(Session()); |
|
508 |
|
509 // Parse parameters |
|
510 HBufC8* buffer = HBufC8::NewLC(aMessage.GetDesLength(1)); |
|
511 TPtr8 ptr = buffer->Des(); |
|
512 aMessage.Read(1, ptr); |
|
513 |
|
514 RArray<TAlfDisplayBackgroundItem> array; |
|
515 CleanupClosePushL( array ); |
|
516 InternalizeL(*buffer, array); |
|
517 |
|
518 // Store value for this client |
|
519 iBackgroundItems.Reset(); |
|
520 for(TInt i = 0; i < array.Count(); ++i) |
|
521 { |
|
522 TAlfDisplayBackgroundItem alfItem = array[i]; |
|
523 THuiDisplayBackgroundItem* huiItem = (THuiDisplayBackgroundItem*)&alfItem; |
|
524 iBackgroundItems.Append(*huiItem); |
|
525 } |
|
526 |
|
527 CleanupStack::PopAndDestroy( &array ); |
|
528 |
|
529 // Reset full background to none |
|
530 iDisplayClearBackground = CHuiDisplay::EClearNone; |
|
531 |
|
532 // Update value if the client is on focus |
|
533 if ( session.IsFocused() ) |
|
534 { |
|
535 // Set use background items |
|
536 Display().SetBackgroundItemsL(iBackgroundItems); |
|
537 } |
|
538 |
|
539 CleanupStack::PopAndDestroy( buffer ); |
|
540 |
|
541 // Complete |
|
542 aMessage.Complete( KErrNone ); |
|
543 } |
|
544 |
|
545 // --------------------------------------------------------------------------- |
|
546 // Sets non fading |
|
547 // --------------------------------------------------------------------------- |
|
548 // |
|
549 void CAlfSrvDisplaySubSession::SuppressAutomaticFadingL( |
|
550 const RMessage2& aMessage ) |
|
551 { |
|
552 CAlfAppSrvSession& session = static_cast<CAlfAppSrvSession&>(Session()); |
|
553 |
|
554 // Parse parameters |
|
555 |
|
556 // 1: TBool (in) |
|
557 TBool value = EFalse; |
|
558 TPckg<TBool> valuePckg(value); |
|
559 aMessage.Read(1,valuePckg); |
|
560 |
|
561 // Store value for this client |
|
562 iAutomaticFadingSuppressed = value; |
|
563 |
|
564 // Update value if the client is on focus and it's shown in a window. |
|
565 if ( session.IsFocused() ) |
|
566 { |
|
567 UpdateAutomaticFading(); |
|
568 } |
|
569 |
|
570 // Complete |
|
571 aMessage.Complete( KErrNone ); |
|
572 } |
|
573 |
|
574 // --------------------------------------------------------------------------- |
|
575 // From CAlfSrvSubSessionBase |
|
576 // Process the message. |
|
577 // --------------------------------------------------------------------------- |
|
578 // |
|
579 void CAlfSrvDisplaySubSession::DoProcessMessageL(const RMessage2& aMessage) |
|
580 { |
|
581 switch( aMessage.Int0() ) |
|
582 { |
|
583 case EAlfDisplaySetClearBackground: |
|
584 { |
|
585 SetClearBackgroundL( aMessage ); |
|
586 break; |
|
587 } |
|
588 case EAlfDisplaySetVisibleArea: |
|
589 { |
|
590 SetVisibleAreaL( aMessage ); |
|
591 break; |
|
592 } |
|
593 case EAlfDisplayForceSetVisibleArea: |
|
594 { |
|
595 SetVisibleAreaL( aMessage, ETrue ); |
|
596 break; |
|
597 } |
|
598 case EAlfDisplayVisibleArea: |
|
599 { |
|
600 VisibleAreaL( aMessage ); |
|
601 break; |
|
602 } |
|
603 case EAlfDisplaySubSessionClose: // obsolete |
|
604 { |
|
605 Session().CloseSubSession( aMessage ); |
|
606 break; |
|
607 } |
|
608 case EAlfDisplaySetDirty: |
|
609 { |
|
610 SetDirtyL( aMessage ); |
|
611 break; |
|
612 } |
|
613 case EAlfDisplaySetQuality: |
|
614 { |
|
615 SetQualityL( aMessage ); |
|
616 break; |
|
617 } |
|
618 case EAlfDisplayQuality: |
|
619 { |
|
620 QualityL( aMessage ); |
|
621 break; |
|
622 } |
|
623 case EAlfDisplaySetUseDepth: |
|
624 { |
|
625 SetUseDepthL( aMessage ); |
|
626 break; |
|
627 } |
|
628 case EAlfDisplaySetUsage: |
|
629 { |
|
630 SetUsageL( aMessage ); |
|
631 break; |
|
632 } |
|
633 case EAlfDisplaySetBackgroundItems: |
|
634 { |
|
635 SetBackgroundItemsL( aMessage ); |
|
636 break; |
|
637 } |
|
638 case EAlfDisplayHandlePointerEvent: |
|
639 { |
|
640 HandlePointerEventL( aMessage ); |
|
641 break; |
|
642 } |
|
643 |
|
644 case EAlfDisplaySuppressAutomaticFading: |
|
645 { |
|
646 SuppressAutomaticFadingL( aMessage ); |
|
647 break; |
|
648 } |
|
649 |
|
650 case EAlfDisplaySetClientWindowForDrawing: |
|
651 { |
|
652 SetClientWindowForDrawingL( aMessage ); |
|
653 break; |
|
654 } |
|
655 |
|
656 default: |
|
657 CAlfSrvSubSessionBase::DoProcessMessageL( aMessage ); |
|
658 break; |
|
659 } |
|
660 } |
|
661 |
|
662 |
|
663 CHuiDisplay* CAlfSrvDisplaySubSession::AsHuiDisplay() |
|
664 { |
|
665 return iDisplay; |
|
666 } |
|
667 |
|
668 void CAlfSrvDisplaySubSession::SetSessionFocused(TBool aFocused) |
|
669 { |
|
670 if ( iDisplay ) |
|
671 { |
|
672 if (aFocused) |
|
673 { |
|
674 // Set clipping rect for display visible area to e.g. avoid unnecesssary |
|
675 // drawing under Avkon status/control pane areas. TV out does not show |
|
676 // those so no clipping in that case. |
|
677 if (UseVisualAreaClipping()) |
|
678 { |
|
679 TRect clipped = Session().AlfAppUi()->Container()->Rect(); |
|
680 if (clipped.Intersects(iRect)) |
|
681 { |
|
682 clipped.Intersection(iRect); |
|
683 } |
|
684 iDisplay->SetVisibleAreaClippingRect(clipped); |
|
685 iDisplay->SetDirty(); |
|
686 } |
|
687 |
|
688 // If background items are used |
|
689 if (iBackgroundItems.Count() != 0) |
|
690 { |
|
691 TRAP_IGNORE(iDisplay->SetBackgroundItemsL(iBackgroundItems)) |
|
692 } |
|
693 else |
|
694 { |
|
695 TRAP_IGNORE(iDisplay->SetClearBackgroundL( |
|
696 CHuiDisplay::TClearMode(iDisplayClearBackground))) |
|
697 } |
|
698 |
|
699 iDisplay->SetQuality(THuiQuality(iDisplayRenderingQuality)); |
|
700 iDisplay->SetUseDepth(iDisplayUseDepthTest); |
|
701 |
|
702 UpdateAutomaticFading(); // update non-fading to app ui container |
|
703 } |
|
704 else |
|
705 { |
|
706 // Disable clipping rect |
|
707 if (UseVisualAreaClipping()) |
|
708 { |
|
709 iDisplay->SetVisibleAreaClippingRect(TRect(0,0,0,0)); |
|
710 iDisplay->SetDirty(); |
|
711 } |
|
712 } |
|
713 |
|
714 if (IsTvOut()) |
|
715 { |
|
716 if (aFocused) |
|
717 { |
|
718 TRAP_IGNORE( |
|
719 { |
|
720 iDisplay->RestoreL(); |
|
721 Session().AlfAppUi()->AppendTvDisplayOnSharedWindowL(*iDisplay); |
|
722 }) |
|
723 } |
|
724 else |
|
725 { |
|
726 Session().AlfAppUi()->RemoveTvDisplayOnSharedWindow(*iDisplay); |
|
727 iDisplay->Release(); |
|
728 } |
|
729 } |
|
730 } |
|
731 } |
|
732 |
|
733 TBool CAlfSrvDisplaySubSession::IsTvOut() const |
|
734 { |
|
735 return((iDisplayType == CHuiDisplay::EDisplayTvOut) || |
|
736 (iDisplayType == CHuiDisplay::EDisplayTvOutWide) || |
|
737 ((iDisplayType == CHuiDisplay::EDisplayNormal) && |
|
738 ((iScreenBufferUid == KHuiUidBackBufferTvOutNormal) || |
|
739 (iScreenBufferUid == KHuiUidBackBufferTvOutWide)))); |
|
740 } |
|
741 |
|
742 TInt CAlfSrvDisplaySubSession::DisplayType() const |
|
743 { |
|
744 return iDisplayType; |
|
745 } |
|
746 |
|
747 void CAlfSrvDisplaySubSession::HandlePointerEventL( const RMessage2& aMessage ) |
|
748 { |
|
749 // This function handles pointer events that are (optionally) sent from client side |
|
750 |
|
751 // Parse parameters |
|
752 CAlfAppSrvSession& session = static_cast<CAlfAppSrvSession&>(Session()); |
|
753 |
|
754 // 1: TPointerEvent (in) |
|
755 TAdvancedPointerEvent value; |
|
756 TPckg<TAdvancedPointerEvent> valuePckg(value); |
|
757 aMessage.Read(1,valuePckg); |
|
758 |
|
759 // Update value if the client is on focus |
|
760 if ( session.IsFocused() && AsHuiDisplay() ) |
|
761 { |
|
762 // iPosition has no meaning as client does not know the location of visuals |
|
763 // Threfore only iParentposition is used, it is assumed to be relative to |
|
764 // display coordinates. |
|
765 value.iPosition = value.iParentPosition; |
|
766 session.StartPointerHandling(); |
|
767 THuiEvent event(AsHuiDisplay(), value); |
|
768 |
|
769 AsHuiDisplay()->Roster().HandleEventL(event); |
|
770 session.FlushPointerHandling(); |
|
771 } |
|
772 |
|
773 // Complete |
|
774 aMessage.Complete( KErrNone ); |
|
775 } |
|
776 |
|
777 void CAlfSrvDisplaySubSession::UpdateAutomaticFading() |
|
778 { |
|
779 CAlfAppSrvSession& session = static_cast<CAlfAppSrvSession&>(Session()); |
|
780 |
|
781 if ( ( iDisplayType == CHuiDisplay::EDisplayLcd0 ) || |
|
782 ( ( iDisplayType == CHuiDisplay::EDisplayNormal ) && |
|
783 ( iScreenBufferUid == KHuiUidBackBufferScreen0 ) ) ) |
|
784 { |
|
785 Session().AlfAppUi()->SetContainerNonFading( iAutomaticFadingSuppressed ); |
|
786 } |
|
787 } |
|
788 |
|
789 TBool CAlfSrvDisplaySubSession::UseVisualAreaClipping() |
|
790 { |
|
791 // This method decides wheter we try to clip drawing to the visible area |
|
792 // and thus avoid unnesessary drawing under status/control |
|
793 // panes and thus gain some perfomance improvement. |
|
794 // |
|
795 // - For TV out visual area is never clipped as there is no Avkon |
|
796 // statuspane/control panes. |
|
797 // |
|
798 // - We dont use clipping if we use Hitchcock transitions between apps |
|
799 // because setting clipping in the middle of transition may look ugly |
|
800 // if clipped areas are different sizes. |
|
801 // |
|
802 // - Clipping is only done for BitGdi renderer. |
|
803 // |
|
804 #ifdef SYMBIAN_BUILD_GCE |
|
805 return EFalse; |
|
806 #else |
|
807 return (!IsTvOut() && |
|
808 !Session().AlfServer()->TransitionEffects()->IsEnabled() && |
|
809 Session().AlfAppUi()->HuiEnv().Renderer() == EHuiRendererBitgdi); |
|
810 #endif |
|
811 } |