|
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: Adapter to the GfxTransEffect client. This is the entry point into |
|
15 * the Nokia specific parts of the KML transition sollution, from the |
|
16 * GfxTransEffect client. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 #include <s32mem.h> //RMemReadStream |
|
23 #include <coecntrl.h> |
|
24 #include <ecom.h> |
|
25 |
|
26 #include <akntranseffect.h> |
|
27 #include <akntransitionutils.h> |
|
28 #include <avkondomainpskeys.h> |
|
29 #include <centralrepository.h> |
|
30 #include <aknlistboxtfxinternal.h> // list box types |
|
31 #include <eikenv.h> |
|
32 #include <eikappui.h> |
|
33 #include <eikapp.h> |
|
34 #include <eiksrvs.h> |
|
35 |
|
36 #include "gfxtransenginetfx.h" |
|
37 #include "e32property.h" |
|
38 //#include "wstranscontrolgraphic.h" |
|
39 //#include "wsadaptergraphic.h" |
|
40 |
|
41 //#include "tfxserverdef.h" |
|
42 //#include "subwocon.h" |
|
43 |
|
44 #include <gfxtranseffect/gfxtranseffect.h> |
|
45 |
|
46 #include <alfdecoderserverclient.h> |
|
47 #include <alf/AlfTransEffectPlugin.h> |
|
48 #include <alflogger.h> |
|
49 |
|
50 //maximum number of ongoing component effects |
|
51 //No restrictions at the moment. Anything goes. |
|
52 //const TInt KMaxOngoing = 10; |
|
53 |
|
54 enum TNoteSequenceState |
|
55 { |
|
56 ENoSequence = 0, |
|
57 EFirst = 1, |
|
58 EMid = 2, |
|
59 ELast = 3 |
|
60 }; |
|
61 |
|
62 // ======== LOCAL CLASS ======== |
|
63 |
|
64 NONSHARABLE_CLASS(CTransControlDrawerInfo) : public CBase |
|
65 { |
|
66 CTransControlDrawerInfo(TInt aHandle); |
|
67 public: |
|
68 static CTransControlDrawerInfo* NewL(TInt aHandle, TRect& aRect); |
|
69 ~CTransControlDrawerInfo(); |
|
70 inline TInt Handle(); |
|
71 inline CWsTransControlGraphic* Drawer(); |
|
72 void DeleteDrawer(); |
|
73 void SetHasWOParticipants(TBool aHasWOParticipant); |
|
74 TBool HasWOParticipants(); |
|
75 private: |
|
76 TInt iHandle; |
|
77 TBool iHasWOParticipant; |
|
78 // CWsTransControlGraphic* iDrawer; |
|
79 }; |
|
80 |
|
81 CTransControlDrawerInfo::CTransControlDrawerInfo(TInt aHandle) : |
|
82 iHandle(aHandle) |
|
83 { |
|
84 } |
|
85 |
|
86 CTransControlDrawerInfo* CTransControlDrawerInfo::NewL(TInt aHandle, TRect& /*aRect*/) |
|
87 { |
|
88 RThread t; //To get id of current thread to use as client handle. |
|
89 CTransControlDrawerInfo* self = new (ELeave) CTransControlDrawerInfo(aHandle); |
|
90 CleanupStack::PushL(self); |
|
91 // self->iDrawer = CWsTransControlGraphic::NewL(aRect, aHandle, t.Id()); |
|
92 CleanupStack::Pop(self); |
|
93 return self; |
|
94 } |
|
95 |
|
96 void CTransControlDrawerInfo::SetHasWOParticipants(TBool aHasWOParticipant) |
|
97 { |
|
98 iHasWOParticipant = aHasWOParticipant; |
|
99 } |
|
100 |
|
101 TBool CTransControlDrawerInfo::HasWOParticipants() |
|
102 { |
|
103 return iHasWOParticipant; |
|
104 } |
|
105 |
|
106 CTransControlDrawerInfo::~CTransControlDrawerInfo() |
|
107 { |
|
108 // delete iDrawer; |
|
109 } |
|
110 |
|
111 void CTransControlDrawerInfo::DeleteDrawer() |
|
112 { |
|
113 // delete iDrawer; |
|
114 // iDrawer = NULL; |
|
115 } |
|
116 |
|
117 //Inline functions kept here, since they are only used within this file |
|
118 |
|
119 inline TInt CTransControlDrawerInfo::Handle() |
|
120 { |
|
121 return iHandle; |
|
122 } |
|
123 |
|
124 /* |
|
125 inline CWsTransControlGraphic* CTransControlDrawerInfo::Drawer() |
|
126 { |
|
127 return iDrawer; |
|
128 } |
|
129 */ |
|
130 |
|
131 /** |
|
132 * Helper class, handles requests to the transition plugin |
|
133 */ |
|
134 NONSHARABLE_CLASS(CAlfTransitionRequest): public CActive |
|
135 { |
|
136 public: |
|
137 enum TType |
|
138 { |
|
139 ETransFinish, |
|
140 EPolicyUpdate |
|
141 }; |
|
142 |
|
143 CAlfTransitionRequest(CGfxTransAdapterTfx* aParent, MTfxServerObserver* aOwner, TType aType); |
|
144 ~CAlfTransitionRequest(); |
|
145 |
|
146 void IssueReq(); |
|
147 inline TType Type(); |
|
148 private: |
|
149 void RunL(); |
|
150 void DoCancel(); |
|
151 TInt RunError(TInt aError); |
|
152 |
|
153 MTfxServerObserver* iOwner; |
|
154 CGfxTransAdapterTfx* iParent; |
|
155 TType iType; |
|
156 |
|
157 }; |
|
158 |
|
159 // --------------------------------------------------------------------------- |
|
160 // --------------------------------------------------------------------------- |
|
161 // |
|
162 CAlfTransitionRequest::CAlfTransitionRequest(CGfxTransAdapterTfx* aParent, MTfxServerObserver* aOwner, TType aType) : |
|
163 CActive(CActive::EPriorityHigh), |
|
164 iOwner(aOwner), |
|
165 iParent(aParent), |
|
166 iType(aType) |
|
167 { |
|
168 CActiveScheduler::Add(this); |
|
169 } |
|
170 |
|
171 // --------------------------------------------------------------------------- |
|
172 // --------------------------------------------------------------------------- |
|
173 // |
|
174 CAlfTransitionRequest::~CAlfTransitionRequest() |
|
175 { |
|
176 __ALFFXLOGSTRING("CAlfTransitionRequest - cancelling and deleting policy request" ); |
|
177 Cancel(); |
|
178 } |
|
179 |
|
180 // --------------------------------------------------------------------------- |
|
181 // --------------------------------------------------------------------------- |
|
182 // |
|
183 void CAlfTransitionRequest::RunL() |
|
184 { |
|
185 if ( iStatus.Int() == KErrCancel ) |
|
186 { |
|
187 // If the request was cancelled, we are done |
|
188 __ALFFXLOGSTRING("CAlfTransitionRequest: Policy request cancelled" ); |
|
189 return; |
|
190 } |
|
191 |
|
192 switch( iType ) |
|
193 { |
|
194 /* |
|
195 // not supported at the time being - all transaction finishing is handled in alf |
|
196 case ETransFinish: |
|
197 iOwner->TransitionFinished(iStatus.Int()); |
|
198 __ALFFXLOGSTRING1("Client::CActive.iOwner->TransitionFinished status = %d", iStatus.Int()); |
|
199 break; |
|
200 */ |
|
201 case EPolicyUpdate: |
|
202 { |
|
203 #ifdef _DEBUG |
|
204 RThread me; |
|
205 TInt ap = me.Id(); |
|
206 me.Close(); |
|
207 __ALFFXLOGSTRING2("CAlfTransitionRequest: Policy received. Cli: %d, status %d",ap,iStatus.Int()); |
|
208 #endif |
|
209 User::LeaveIfError( iStatus.Int() ); |
|
210 iParent->GetNewPoliciesL( iStatus.Int() ); |
|
211 User::LeaveIfError( iParent->RequestPolicyUpdates() ); |
|
212 } |
|
213 break; |
|
214 default: |
|
215 break; |
|
216 } |
|
217 } |
|
218 |
|
219 // --------------------------------------------------------------------------- |
|
220 // --------------------------------------------------------------------------- |
|
221 // |
|
222 TInt CAlfTransitionRequest::RunError(TInt aError) |
|
223 { |
|
224 //The idea here is that on failure (wich should be OOM), we clear all our policies |
|
225 //clientside. |
|
226 //We must also inform server of this, so it can resend all policies the next time we request. |
|
227 //Next time a transition is tried, policies will be re-requested. |
|
228 #ifdef _DEBUG |
|
229 RThread me; |
|
230 TInt meid = me.Id(); |
|
231 TInt tmp = aError; //remove warning when debug prints and turned off |
|
232 aError = tmp; |
|
233 __ALFFXLOGSTRING2("--->> Policy error <<--. Cli: %d, status: %d",meid,aError); |
|
234 me.Close(); |
|
235 #endif |
|
236 |
|
237 iOwner->ClearAllPolicies(); //clear all policies clientside |
|
238 iParent->CancelPolicyUpdates(); //cancel requests on server. |
|
239 |
|
240 return 0; |
|
241 } |
|
242 |
|
243 // --------------------------------------------------------------------------- |
|
244 // --------------------------------------------------------------------------- |
|
245 // |
|
246 void CAlfTransitionRequest::DoCancel() |
|
247 { |
|
248 //nothing to do here. requests are cancelled elsewhere. |
|
249 } |
|
250 |
|
251 // --------------------------------------------------------------------------- |
|
252 // --------------------------------------------------------------------------- |
|
253 // |
|
254 void CAlfTransitionRequest::IssueReq() |
|
255 { |
|
256 SetActive(); |
|
257 } |
|
258 |
|
259 // --------------------------------------------------------------------------- |
|
260 // We keep it here, even though its inline, since it is never used outside this |
|
261 // file anyway. |
|
262 // The idea with .inl files is to keep the header file clean. |
|
263 // --------------------------------------------------------------------------- |
|
264 // |
|
265 inline CAlfTransitionRequest::TType CAlfTransitionRequest::Type() |
|
266 { |
|
267 return iType; |
|
268 } |
|
269 |
|
270 |
|
271 // ======== MEMBER FUNCTIONS ======== |
|
272 |
|
273 CGfxTransAdapterTfx::CGfxTransAdapterTfx(MGfxTransClient* aClient) : |
|
274 iClient(aClient), |
|
275 iConnected(EFalse), |
|
276 iHasPlugin(EFalse) |
|
277 { |
|
278 } |
|
279 |
|
280 CGfxTransAdapterTfx::~CGfxTransAdapterTfx() |
|
281 { |
|
282 |
|
283 __ALFFXLOGSTRING("CGfxTransAdapterTfx for HWA transitionn effects, destructor "); |
|
284 // iIgnoredWOChildControls.Close(); |
|
285 //iControlInfo.ResetAndDestroy(); |
|
286 if ( iConnected ) |
|
287 { |
|
288 if ( iHasPlugin ) |
|
289 { |
|
290 __ALFFXLOGSTRING("CGfxTransAdapterTfx, canceling policy updates in destructor "); |
|
291 CancelPolicyUpdates(); |
|
292 // should we wait here until the cancellation has returned? |
|
293 __ALFFXLOGSTRING("CGfxTransAdapterTfx, unloading plugin "); |
|
294 iTfxServer.UnloadTfxPlugin( iPluginImplementation ); |
|
295 } |
|
296 } |
|
297 delete iPolicyReq; |
|
298 iTfxServer.Close(); |
|
299 iConnected = EFalse; |
|
300 iHasPlugin = EFalse; |
|
301 delete iTransferBuffer; |
|
302 delete iReturnBuffer; |
|
303 delete iAsyncTransferBuffer; |
|
304 delete iAsyncReturnBuffer; |
|
305 } |
|
306 |
|
307 void CGfxTransAdapterTfx::ConstructL() |
|
308 { |
|
309 |
|
310 __ALFFXLOGSTRING("CGfxTransAdapterTfx for HWA transitionn effects, ConstructL"); |
|
311 |
|
312 RThread me; |
|
313 iClientId = me.Id(); |
|
314 me.Close(); |
|
315 |
|
316 iPluginImplementation = TUid::Null(); |
|
317 ConnectToServer(); |
|
318 |
|
319 // We need to save various 32 bit integers. The exact number depends on the function. |
|
320 // We reserve a bit extra here, should check if the size is big enough for all cases. |
|
321 iTransferBuffer = HBufC8::NewL( 25 * sizeof(TInt32) ); |
|
322 // If we get return values, we'll need a bigger buffer |
|
323 iReturnBuffer = HBufC8::NewL( sizeof( TInt ) ); |
|
324 |
|
325 // We need to save various 32 bit integers. The exact number depends on the function. |
|
326 // We reserve a bit extra here, should check if the size is big enough for all cases. |
|
327 iAsyncTransferBuffer = HBufC8::NewL( 25 * sizeof(TInt32) ); |
|
328 // If we get return values, we'll need a bigger buffer |
|
329 iAsyncReturnBuffer = HBufC8::NewL( sizeof( TInt ) ); |
|
330 |
|
331 iPolicyReq = new( ELeave )CAlfTransitionRequest(this, |
|
332 this, |
|
333 CAlfTransitionRequest::EPolicyUpdate); |
|
334 |
|
335 } |
|
336 |
|
337 void CGfxTransAdapterTfx::ConnectToServer() |
|
338 { |
|
339 // We need to resolve the plugin id for starters, |
|
340 // use default parameters, we take the first one we find. |
|
341 |
|
342 TInt err = KErrNone; |
|
343 |
|
344 if ( !iConnected ) |
|
345 { |
|
346 err = iTfxServer.Open(); |
|
347 if ( err == KErrNone ) |
|
348 { |
|
349 iConnected = ETrue; |
|
350 } |
|
351 else |
|
352 { |
|
353 // could not connect to server - cannot continue. |
|
354 return; |
|
355 } |
|
356 } |
|
357 |
|
358 if ( iHasPlugin ) |
|
359 { |
|
360 // already connected |
|
361 return; |
|
362 } |
|
363 |
|
364 if ( iPluginImplementation == TUid::Null()) |
|
365 { |
|
366 RImplInfoPtrArray pluginArray; |
|
367 TRAP( err, REComSession::ListImplementationsL( KAlfGfxPluginInterfaceUId, pluginArray ) ); |
|
368 |
|
369 if ( pluginArray.Count() > 0 ) |
|
370 { |
|
371 iPluginImplementation = pluginArray[0]->ImplementationUid(); |
|
372 } |
|
373 // Clear the data in plugin array, it is not going to be used any more. |
|
374 TInt i = 0; |
|
375 for ( i = pluginArray.Count() - 1; i >= 0; i-- ) |
|
376 { |
|
377 // destroy |
|
378 delete pluginArray[i]; |
|
379 pluginArray.Remove( i ); |
|
380 } |
|
381 pluginArray.Close(); |
|
382 } |
|
383 |
|
384 if ( err == KErrNone && iPluginImplementation != TUid::Null() ) |
|
385 { |
|
386 err = iTfxServer.LoadTfxPlugin( iPluginImplementation ); |
|
387 if ( err == KErrNone || err == KErrAlreadyExists ) |
|
388 { |
|
389 // We have successfully loaded the plugin and saved |
|
390 // the implementation uid to be used later. |
|
391 iHasPlugin = ETrue; |
|
392 __ALFFXLOGSTRING("HWA TransEffect Plugin loaded"); |
|
393 } |
|
394 } |
|
395 |
|
396 } |
|
397 |
|
398 |
|
399 // --------------------------------------------------------------------------- |
|
400 // tests if adapter is active (trying to make it active if needed) |
|
401 // --------------------------------------------------------------------------- |
|
402 // |
|
403 TBool CGfxTransAdapterTfx::IsActive() |
|
404 { |
|
405 TInt ap = iClientId.Id(); |
|
406 __ALFFXLOGSTRING1("IsActive() cli: %d",ap); |
|
407 |
|
408 TInt err = KErrNone; |
|
409 if( !iHasPlugin ) |
|
410 { |
|
411 ConnectToServer(); |
|
412 if (!iHasPlugin ) |
|
413 { |
|
414 return EFalse; |
|
415 } |
|
416 } |
|
417 |
|
418 if( err == KErrNone ) |
|
419 { |
|
420 //Make sure policy request handling is on. |
|
421 err = RequestPolicyUpdates(); |
|
422 } |
|
423 else |
|
424 { |
|
425 //Failed to connect, remove all policies from client. |
|
426 iClient->ClearAllPolicies(); |
|
427 } |
|
428 |
|
429 return (err == KErrNone); |
|
430 } |
|
431 |
|
432 // --------------------------------------------------------------------------- |
|
433 // Handles the different states of the client. |
|
434 // --------------------------------------------------------------------------- |
|
435 // |
|
436 TInt CGfxTransAdapterTfx::HandleClientState( TClientState aState, const CCoeControl* aKey, TInt aHandle ) |
|
437 { |
|
438 if( !iHasPlugin ) |
|
439 { |
|
440 return KErrNone; |
|
441 } |
|
442 |
|
443 TInt err = KErrNone; |
|
444 TInt action = 0; |
|
445 const CTransitionData* transdata; |
|
446 err = iClient->GetTransitionData( aHandle, transdata ); |
|
447 if ( err == KErrNone ) |
|
448 { |
|
449 action = transdata->iAction; |
|
450 } |
|
451 |
|
452 switch(aState) |
|
453 { |
|
454 case EFallback: |
|
455 break; |
|
456 case EPreBeginCapture: |
|
457 break; |
|
458 case EPostBeginCapture: |
|
459 // If we get KGfxControlAppearAction, it is followed by StartTransition, |
|
460 // but disappear action is not. Therefore we must handle it byself |
|
461 // We use begin capture as trigger, as we assume that the control is still present |
|
462 // at that time. After EPostBeginCapture it will probably be already gone. |
|
463 // If we don't have plugin yet, there will be no transitions. |
|
464 if ( action == KGfxControlDisappearAction && iHasPlugin && aKey && aKey->DrawableWindow()) |
|
465 { |
|
466 // We must generate our own transition as we won't be sending |
|
467 // iClient->TransitionFinished back. |
|
468 // (Client did not ask for transition to be started, and won't be |
|
469 // interested in the end.) |
|
470 TRAP( err, GenerateTransitionL( aKey, transdata ) ); |
|
471 } |
|
472 break; |
|
473 case EPreEndCapture: |
|
474 break; |
|
475 case EPostEndCapture: |
|
476 break; |
|
477 case EAbort: |
|
478 // Abort component transition, handle given. |
|
479 break; |
|
480 case EGlobalAbort: |
|
481 // abort component transition, no handle. |
|
482 break; |
|
483 case EBeginGroup: |
|
484 { |
|
485 __ALFFXLOGSTRING1("-- BeginGroup: New transition group for groupid: %d)",aHandle); |
|
486 SendGroupCommand(aHandle, EFalse); |
|
487 break; |
|
488 } |
|
489 case EEndGroup: |
|
490 { |
|
491 __ALFFXLOGSTRING1("-- EndGroup: closing transition group: %d)",aHandle); |
|
492 SendGroupCommand(aHandle, ETrue); |
|
493 break; |
|
494 } |
|
495 default: |
|
496 break; |
|
497 } |
|
498 return err; |
|
499 } |
|
500 |
|
501 // --------------------------------------------------------------------------- |
|
502 // Called by client when a participant of a transition updates in mid transition. |
|
503 // --------------------------------------------------------------------------- |
|
504 // |
|
505 void CGfxTransAdapterTfx::HandleParticpantUpdate(TInt /*aHandle*/, const CParticipantData* /*aParticipant*/, |
|
506 RWsGraphicMsgBuf* /*aCommandBuffer*/, |
|
507 const TRect& /*aDrawRect*/, const TRect& /*aBoundingRect*/) |
|
508 { |
|
509 /* |
|
510 if(aCommandBuffer->Count() == 0) |
|
511 { |
|
512 return; |
|
513 } |
|
514 |
|
515 const CTransitionData* transdata; |
|
516 TInt err = iClient->GetTransitionData(aHandle,transdata); |
|
517 if(err != KErrNone) |
|
518 { |
|
519 return; |
|
520 } |
|
521 |
|
522 CTransControlDrawerInfo* drawinfo = FindControl(aHandle); |
|
523 if(drawinfo && drawinfo->HasWOParticipants()) |
|
524 { |
|
525 return; |
|
526 } |
|
527 |
|
528 |
|
529 TInt participantid = -1; |
|
530 if(aParticipant == transdata->iBaseControl) |
|
531 { |
|
532 participantid = 0; |
|
533 } |
|
534 else |
|
535 { |
|
536 TBool found = EFalse; |
|
537 for(TInt i = transdata->iSubControls.Count() - 1; (i >= 0) && !found; i--) |
|
538 { |
|
539 if(transdata->iSubControls[i] == aParticipant) |
|
540 { |
|
541 participantid = i + 1; |
|
542 found = ETrue; |
|
543 } |
|
544 } |
|
545 } |
|
546 |
|
547 if(participantid >= 0) |
|
548 { |
|
549 //Find control drawer for this handle, send updated participant to it. |
|
550 CWsTransControlGraphic* drawer = FindDrawer(aHandle); |
|
551 if(drawer) |
|
552 { |
|
553 RThread t; |
|
554 __ALFFXLOGSTRING2("Sending participant update for client:%d, handle:%d",t.Id().Id(),aHandle); |
|
555 drawer->SendParticipantUpdate(participantid, aCommandBuffer, aDrawRect, aBoundingRect); |
|
556 } |
|
557 } |
|
558 */ |
|
559 } |
|
560 |
|
561 |
|
562 // --------------------------------------------------------------------------- |
|
563 // returns an array of supported control transitions |
|
564 // --------------------------------------------------------------------------- |
|
565 // |
|
566 TControlPolicy* CGfxTransAdapterTfx::GetTransitionPolicies(TInt &aCount) |
|
567 { |
|
568 if( !iHasPlugin ) |
|
569 { |
|
570 ConnectToServer(); |
|
571 if ( !iHasPlugin ) |
|
572 { |
|
573 return NULL; |
|
574 } |
|
575 } |
|
576 //Start requesting policies |
|
577 RequestPolicyUpdates(); |
|
578 |
|
579 //No policies at this point, all will be pushed. |
|
580 aCount = 0; |
|
581 return NULL; |
|
582 } |
|
583 |
|
584 // --------------------------------------------------------------------------- |
|
585 // --------------------------------------------------------------------------- |
|
586 // |
|
587 void CGfxTransAdapterTfx::SubConBegin( const CCoeControl* /*aControl*/ ) |
|
588 { |
|
589 /* |
|
590 if ( aControl ) |
|
591 { |
|
592 for ( TInt i = 0; i < aControl->CountComponentControls(); i++ ) |
|
593 { |
|
594 const CCoeControl* subcon = aControl->ComponentControl( i ); |
|
595 if ( subcon && subcon->OwnsWindow() && subcon->Size() != TSize( 0, 0 ) && !GfxTransEffect::IsRegistered(subcon)) |
|
596 { |
|
597 if ( iIgnoredWOChildControls.Find( subcon ) == KErrNotFound ) |
|
598 { |
|
599 iSubCons++; |
|
600 GfxTransEffect::Register( subcon, iActiveUid ); |
|
601 GfxTransEffect::Begin( subcon, iActiveAction ); |
|
602 } |
|
603 } |
|
604 iCurrZ++; |
|
605 SubConBegin( subcon ); |
|
606 iCurrZ--; |
|
607 } |
|
608 } |
|
609 */ |
|
610 } |
|
611 |
|
612 // --------------------------------------------------------------------------- |
|
613 // --------------------------------------------------------------------------- |
|
614 // |
|
615 void CGfxTransAdapterTfx::SubConEnd(const CCoeControl* /*aControl*/) |
|
616 { |
|
617 /* |
|
618 if ( aControl ) |
|
619 { |
|
620 for ( TInt i = aControl->CountComponentControls() - 1; i >= 0 ; i-- ) |
|
621 { |
|
622 CCoeControl* subcon = aControl->ComponentControl(i); |
|
623 SubConEnd( subcon ); |
|
624 if ( subcon && subcon->OwnsWindow() && |
|
625 GfxTransEffect::IsRegistered( subcon ) ) |
|
626 { |
|
627 if (subcon->IsVisible()) |
|
628 { |
|
629 GfxTransEffect::SetBeginDemarcation(subcon, TRect(0, 0, 0, 0)); |
|
630 } |
|
631 else |
|
632 { |
|
633 GfxTransEffect::SetEndDemarcation(subcon, TRect(0, 0, 0, 0)); |
|
634 } |
|
635 GfxTransEffect::Invalidate(subcon); |
|
636 GfxTransEffect::End(subcon); |
|
637 if(subcon->IsVisible()) |
|
638 { |
|
639 // make subcon temporarily invisible to avoid redrawing when deregistering |
|
640 // redrawing will go to the remotegc of the main control but is bad for performance |
|
641 // and causes Begin/End Redraw on the window which can cause flicker. |
|
642 subcon->MakeVisible(EFalse); |
|
643 GfxTransEffect::Deregister(subcon); |
|
644 subcon->MakeVisible(ETrue); |
|
645 } |
|
646 else |
|
647 { |
|
648 GfxTransEffect::Deregister(subcon); |
|
649 } |
|
650 iSubCons--; |
|
651 } |
|
652 } |
|
653 } |
|
654 */ |
|
655 } |
|
656 |
|
657 // --------------------------------------------------------------------------- |
|
658 // --------------------------------------------------------------------------- |
|
659 // |
|
660 void CGfxTransAdapterTfx::SubConAbort( const CCoeControl* /*aControl*/ ) |
|
661 { |
|
662 /* |
|
663 if ( aControl ) |
|
664 { |
|
665 for ( TInt i = aControl->CountComponentControls() - 1; i >= 0; --i ) |
|
666 { |
|
667 CCoeControl* subcon = aControl->ComponentControl( i ); |
|
668 SubConAbort( subcon ); |
|
669 if ( subcon && subcon->OwnsWindow() && |
|
670 GfxTransEffect::IsRegistered( subcon ) ) |
|
671 { |
|
672 GfxTransEffect::Abort( subcon ); |
|
673 } |
|
674 } |
|
675 } |
|
676 */ |
|
677 } |
|
678 |
|
679 // --------------------------------------------------------------------------- |
|
680 // calls to GfxTransEffect::NotifyExternalState comes through here. |
|
681 // --------------------------------------------------------------------------- |
|
682 // |
|
683 void CGfxTransAdapterTfx::NotifyExternalState( TInt aState, const TDesC8* /*aArg*/ ) |
|
684 { |
|
685 switch(aState) |
|
686 { |
|
687 case ECaptureComponentsBegin: |
|
688 if( !IsActive() ) |
|
689 { |
|
690 return; //dont do anything if server is not running |
|
691 } |
|
692 break; |
|
693 case ECaptureComponentsEnd: |
|
694 if( !IsActive() ) |
|
695 { |
|
696 return; //dont do anything if server is not running |
|
697 } |
|
698 break; |
|
699 case ECaptureComponentsAbort: |
|
700 if( !IsActive() ) |
|
701 { |
|
702 return; //dont do anything if server is not running |
|
703 } |
|
704 // iTfxServer.AbortControlTransition(); |
|
705 return; |
|
706 case ENotifyGlobalAbort: |
|
707 // iTfxServer.AbortControlTransition(); |
|
708 return; |
|
709 case EBeginPopupSequence: |
|
710 case ELastPopupInSequence: |
|
711 case EEndPopupSequence: |
|
712 case EInternalHandleSequence: |
|
713 case EGetRegistrationType: |
|
714 case EAddIgnoreWOChildComponent: |
|
715 case ERemoveIgnoreWOChildComponent: |
|
716 default: |
|
717 //ignored |
|
718 break; |
|
719 } |
|
720 } |
|
721 |
|
722 // --------------------------------------------------------------------------- |
|
723 // called by client to start the specific transition |
|
724 // --------------------------------------------------------------------------- |
|
725 // |
|
726 void CGfxTransAdapterTfx::StartTransition(TInt aHandle) |
|
727 { |
|
728 if( !iHasPlugin ) |
|
729 { |
|
730 iClient->TransitionFinished( aHandle ); |
|
731 return; |
|
732 } |
|
733 |
|
734 const CTransitionData* transdata; |
|
735 TInt err = iClient->GetTransitionData( aHandle, transdata ); |
|
736 |
|
737 if( err == KErrNone ) |
|
738 { |
|
739 if ( transdata->iAction != KGfxControlDisappearAction ) |
|
740 { |
|
741 // Disappear action was started by EPostBeginCapture event |
|
742 TRAP( err, DoStartTransitionL( aHandle, transdata ) ); |
|
743 } |
|
744 else |
|
745 { |
|
746 __ALFFXLOGSTRING( "CGfxTransAdapterTfx::StartTransition called for disappear action" ); |
|
747 } |
|
748 } |
|
749 |
|
750 // always finish the caller |
|
751 iClient->TransitionFinished( aHandle ); |
|
752 } |
|
753 |
|
754 // --------------------------------------------------------------------------- |
|
755 // GfxTransEffect::BeginFullscreen gets passed here. |
|
756 // --------------------------------------------------------------------------- |
|
757 // |
|
758 void CGfxTransAdapterTfx::BeginFullScreen(TUint /*aAction*/, const TRect& /*aEffectArea*/) |
|
759 { |
|
760 //This function will not be used. |
|
761 } |
|
762 |
|
763 // --------------------------------------------------------------------------- |
|
764 // GfxTransEffect::BeginFullscreen gets passed here. |
|
765 // --------------------------------------------------------------------------- |
|
766 // |
|
767 void CGfxTransAdapterTfx::BeginFullScreen(TUint aAction, const TRect& aEffectArea, |
|
768 TUint aType, const TDesC8& aParams) |
|
769 { |
|
770 __ALFFXLOGSTRING1( "CGfxTransAdapterTfx::BeginFullScreen - %S >>", &RThread().Name()); |
|
771 __ALFFXLOGSTRING1( "CGfxTransAdapterTfx::BeginFullScreen - iHasPlugin %d >>", iHasPlugin); |
|
772 if( !iHasPlugin ) |
|
773 { |
|
774 ConnectToServer(); |
|
775 if ( !iHasPlugin ) |
|
776 { |
|
777 return; |
|
778 } |
|
779 } |
|
780 |
|
781 TInt op = MAlfGfxEffectPlugin::EBeginFullscreen; |
|
782 |
|
783 TPtr8 inPtr = iTransferBuffer->Des(); |
|
784 inPtr.Zero(); |
|
785 TPtr8 outPtr = iReturnBuffer->Des(); |
|
786 outPtr.Zero(); |
|
787 RDesWriteStream inBuf( inPtr ); |
|
788 |
|
789 // We won't leave here because our buffer is long enough |
|
790 // The buffer has been allocated in the constructor |
|
791 // If you add parameters, check the length of the buffer |
|
792 TRAP_IGNORE( |
|
793 { |
|
794 inBuf.WriteInt32L( op ); |
|
795 inBuf.WriteUint32L( aAction ); |
|
796 inBuf.WriteInt32L( aEffectArea.iTl.iX ); |
|
797 inBuf.WriteInt32L( aEffectArea.iTl.iY ); |
|
798 inBuf.WriteInt32L( aEffectArea.iBr.iX ); |
|
799 inBuf.WriteInt32L( aEffectArea.iBr.iY ); |
|
800 inBuf.WriteInt32L( aType ); |
|
801 |
|
802 AknTransEffect::TParameter tmp; |
|
803 TPckgC<AknTransEffect::TParameter> params( tmp ); |
|
804 params.Set( aParams ); |
|
805 if ( aType == AknTransEffect::EParameterType ) |
|
806 { |
|
807 __ALFFXLOGSTRING3("CGfxTransAdapterTfx::BeginFullScreen - EParameterType, iNext.iUid: 0x%x, iPrev.iUid: 0x%x, iFlags: %d", params().iNext.iUid, params().iPrev.iUid, params().iFlags ); |
|
808 inBuf.WriteInt32L( params().iNext.iUid ); |
|
809 inBuf.WriteInt32L( params().iPrev.iUid ); |
|
810 inBuf.WriteInt32L( params().iFlags ); |
|
811 |
|
812 } |
|
813 else if ( aType == AknTransEffect::EParameterAvkonInternal ) |
|
814 { |
|
815 const TUint* data = reinterpret_cast<const TUint*>( aParams.Ptr() ); |
|
816 inBuf.WriteUint32L( data[0] ); |
|
817 inBuf.WriteUint32L( data[1] ); |
|
818 inBuf.WriteUint32L( data[2] ); |
|
819 __ALFFXLOGSTRING3("CGfxTransAdapterTfx::BeginFullScreen - EParameterAvkonInternal, data[0-2] = [%d, %d, %d]", data[0], data[1], data[2]); |
|
820 } |
|
821 else |
|
822 { |
|
823 inBuf.WriteUint32L( 0 ); |
|
824 inBuf.WriteUint32L( 0 ); |
|
825 inBuf.WriteUint32L( 0 ); |
|
826 } |
|
827 |
|
828 inBuf.CommitL(); |
|
829 }); |
|
830 |
|
831 inBuf.Release(); |
|
832 inBuf.Close(); |
|
833 |
|
834 |
|
835 // we ignore any returned error as we are just doing our best... |
|
836 iTfxServer.SendSynchronousData( iPluginImplementation, inPtr, outPtr ); |
|
837 |
|
838 // clear out used data |
|
839 inPtr.Zero(); |
|
840 outPtr.Zero(); |
|
841 __ALFFXLOGSTRING("CGfxTransAdapterTfx::BeginFullScreen <<"); |
|
842 } |
|
843 |
|
844 // --------------------------------------------------------------------------- |
|
845 // GfxTransEffect::EndFullscreen gets passed here. |
|
846 // --------------------------------------------------------------------------- |
|
847 // |
|
848 void CGfxTransAdapterTfx::EndFullScreen() |
|
849 { |
|
850 __ALFFXLOGSTRING1( "CGfxTransAdapterTfx::EndFullScreen() - %S >>", &RThread().Name()); |
|
851 if( !iHasPlugin ) |
|
852 { |
|
853 return; |
|
854 } |
|
855 |
|
856 TPtr8 inPtr = iTransferBuffer->Des(); |
|
857 inPtr.Zero(); |
|
858 TPtr8 outPtr = iReturnBuffer->Des(); |
|
859 outPtr.Zero(); |
|
860 RDesWriteStream inBuf( inPtr ); |
|
861 TInt op = MAlfGfxEffectPlugin::EEndFullscreen; |
|
862 // We won't leave here because our buffer is long enough |
|
863 TRAP_IGNORE( |
|
864 { |
|
865 // no other parameters used |
|
866 inBuf.WriteInt32L( op ); |
|
867 inBuf.CommitL(); |
|
868 }); |
|
869 inBuf.Release(); |
|
870 inBuf.Close(); |
|
871 |
|
872 __ALFFXLOGSTRING( "CGfxTransAdapterTfx::EndFullScreen" ); |
|
873 // we ignore any returned error as we are just doing our best... |
|
874 iTfxServer.SendSynchronousData( iPluginImplementation, inPtr, outPtr ); |
|
875 // clear out used data |
|
876 inPtr.Zero(); |
|
877 outPtr.Zero(); |
|
878 |
|
879 } |
|
880 |
|
881 // --------------------------------------------------------------------------- |
|
882 // GfxTransEffect::AbortFullscreen gets passed here. |
|
883 // --------------------------------------------------------------------------- |
|
884 // |
|
885 void CGfxTransAdapterTfx::AbortFullScreen() |
|
886 { |
|
887 __ALFFXLOGSTRING1( "CGfxTransAdapterTfx::AbortFullScreen() - %S >>", &RThread().Name()); |
|
888 if ( !iHasPlugin ) |
|
889 { |
|
890 return; |
|
891 } |
|
892 |
|
893 TPtr8 inPtr = iTransferBuffer->Des(); |
|
894 inPtr.Zero(); |
|
895 TPtr8 outPtr = iReturnBuffer->Des(); |
|
896 outPtr.Zero(); |
|
897 RDesWriteStream inBuf( inPtr ); |
|
898 TInt op = MAlfGfxEffectPlugin::EAbortFullscreen; |
|
899 // We won't leave here because our buffer is long enough |
|
900 TRAP_IGNORE( |
|
901 { |
|
902 // no other parameters used |
|
903 inBuf.WriteInt32L( op ); |
|
904 inBuf.CommitL(); |
|
905 }); |
|
906 inBuf.Release(); |
|
907 inBuf.Close(); |
|
908 |
|
909 // we ignore any returned error as we are just doing our best... |
|
910 iTfxServer.SendSynchronousData( iPluginImplementation, inPtr, outPtr ); |
|
911 // clear out used data |
|
912 inPtr.Zero(); |
|
913 outPtr.Zero(); |
|
914 __ALFFXLOGSTRING("CGfxTransAdapterTfx::AbortFullScreen <<"); |
|
915 } |
|
916 |
|
917 |
|
918 // --------------------------------------------------------------------------- |
|
919 // implementation, handling transition startup |
|
920 // --------------------------------------------------------------------------- |
|
921 // |
|
922 void CGfxTransAdapterTfx::DoStartTransitionL( TInt /*aHandle*/, const CTransitionData* aTransData ) |
|
923 { |
|
924 // send the transition request to Alf Plugin |
|
925 __ALFFXLOGSTRING("CGfxTransAdapterTfx::DoStartTransitionL >>"); |
|
926 if ( !aTransData->iKey->DrawableWindow() ) |
|
927 { |
|
928 // If we don't have a window, we cannot do transition |
|
929 return; |
|
930 } |
|
931 |
|
932 TPtr8 inPtr = iTransferBuffer->Des(); |
|
933 inPtr.Zero(); |
|
934 TPtr8 outPtr = iReturnBuffer->Des(); |
|
935 outPtr.Zero(); |
|
936 RDesWriteStream inBuf( inPtr ); |
|
937 TInt op = MAlfGfxEffectPlugin::EBeginComponentTransition; |
|
938 TInt windowGroup = aTransData->iKey->DrawableWindow()->WindowGroupId(); |
|
939 TInt windowHandle = aTransData->iKey->DrawableWindow()->ClientHandle(); |
|
940 |
|
941 // We don't send all the position information as we will do no screen capture |
|
942 // based on position, and the visuals know their own positions anyway. |
|
943 // If we find out that we need to specify some starting or ending positions, |
|
944 // we can add the information later. |
|
945 |
|
946 inBuf.WriteInt32L( op ); |
|
947 inBuf.WriteUint32L( aTransData->iAction ); |
|
948 inBuf.WriteInt32L( aTransData->iUid.iUid ); |
|
949 inBuf.WriteInt32L( windowGroup ); // window group id of the control |
|
950 inBuf.WriteInt32L( windowHandle ); // server side window handle for the control |
|
951 inBuf.WriteInt32L( aTransData->iNLayered ); |
|
952 // Participant data for the main layer. Other layers not handled separately. |
|
953 const CParticipantData* baseControl = aTransData->iBaseControl; |
|
954 inBuf.WriteInt32L( baseControl->iLayerType.iUid ); // uid for this participant |
|
955 inBuf.WriteInt32L( baseControl->iFlags ); // hints |
|
956 // Possible component control data missing - we assume handling of the whole control as one |
|
957 |
|
958 inBuf.CommitL(); |
|
959 inBuf.Release(); |
|
960 inBuf.Close(); |
|
961 |
|
962 __ALFFXLOGSTRING( "CGfxTransAdapterTfx::DoStartTransitionL" ); |
|
963 iTfxServer.SendSynchronousData( iPluginImplementation, inPtr, outPtr ); |
|
964 // clear out used data |
|
965 inPtr.Zero(); |
|
966 outPtr.Zero(); |
|
967 |
|
968 /* |
|
969 if ( iSubCons ) //Note: "normal" nesting wont work, but is not used in this platform. |
|
970 { |
|
971 if(iMainControl) |
|
972 { |
|
973 //Collecting window owning sub controls, add to list. |
|
974 __ALFFXLOGSTRING2("Adding subcon %x, handle: %d",aTransData->iKey, aHandle); |
|
975 CSubWOControl* subcon = CSubWOControl::NewL( aHandle, *aTransData ); |
|
976 iSubWOControls.AppendL(subcon); |
|
977 return; |
|
978 } |
|
979 else |
|
980 { |
|
981 //Subcon Mismatch, abort transition and clean up. |
|
982 iClient->TransitionFinished(aHandle); |
|
983 return; |
|
984 } |
|
985 } |
|
986 |
|
987 if(iControlInfo.Count() >= KMaxOngoing) |
|
988 { |
|
989 __ALFFXLOGSTRING("CGfxTransAdapterTfx::DoStartTransitionL maxongoing"); |
|
990 iClient->TransitionFinished(aHandle); |
|
991 return; |
|
992 } |
|
993 |
|
994 TInt ap = iClientId.Id(); |
|
995 __ALFFXLOGSTRING2("Adapter: Transition Started: %d, cli: %d",aHandle,ap); |
|
996 TRect boundingrect = TRect(aTransData->iBeginWOPos + aTransData->iBaseControl->iBeginRect.iTl, |
|
997 aTransData->iBeginWOPos + aTransData->iBaseControl->iBeginRect.iBr); |
|
998 boundingrect.BoundingRect(TRect(aTransData->iEndWOPos + aTransData->iBaseControl->iEndRect.iTl, |
|
999 aTransData->iEndWOPos + aTransData->iBaseControl->iEndRect.iBr)); |
|
1000 CTransControlDrawerInfo* drawinfo = CTransControlDrawerInfo::NewL(aHandle, boundingrect); |
|
1001 CleanupStack::PushL(drawinfo); |
|
1002 User::LeaveIfError(iControlInfo.Append(drawinfo)); |
|
1003 CleanupStack::Pop(drawinfo); |
|
1004 CWsTransControlGraphic* drawer = drawinfo->Drawer(); |
|
1005 |
|
1006 __ALFFXLOGSTRING("Adapter: Sending participant 0"); |
|
1007 drawer->SendParticipant(aTransData->iBaseControl,0); |
|
1008 TInt count = aTransData->iSubControls.Count(); |
|
1009 for(TInt i = 0; i < count; i++) |
|
1010 { |
|
1011 __ALFFXLOGSTRING1("Adapter: Sending participant %d",i+1); |
|
1012 drawer->SendParticipant(aTransData->iSubControls[i],i + 1); |
|
1013 } |
|
1014 |
|
1015 TInt wocount = iSubWOControls.Count(); |
|
1016 if(wocount) |
|
1017 { |
|
1018 drawinfo->SetHasWOParticipants(ETrue); |
|
1019 } |
|
1020 for(TInt i = wocount - 1; i >= 0; i--) |
|
1021 { |
|
1022 drawer->SendWOParticipant(*iSubWOControls[i]); |
|
1023 } |
|
1024 for(TInt i = 0; i < wocount; i++) |
|
1025 { |
|
1026 iClient->TransitionFinished(iSubWOControls[i]->Handle()); |
|
1027 } |
|
1028 iSubWOControls.ResetAndDestroy(); |
|
1029 |
|
1030 __ALFFXLOGSTRING("Adapter: Sending Transition Data"); |
|
1031 |
|
1032 TBool drawerstart = EFalse; |
|
1033 if(iIsWO && !aTransData->iKey->IsVisible()) |
|
1034 { |
|
1035 drawerstart = ETrue; |
|
1036 } |
|
1037 |
|
1038 drawer->SendTransitionData(aTransData, aHandle, drawerstart); |
|
1039 drawer->Flush(); |
|
1040 |
|
1041 if(iIsWO && !aTransData->iKey->Parent()) |
|
1042 { |
|
1043 // aTransData->iKey->DrawNow(); |
|
1044 if ( aTransData->iKey->IsVisible() && !aTransData->iKey->IsBackedUp() ) |
|
1045 { |
|
1046 RWindow* window = ( RWindow* ) aTransData->iKey->DrawableWindow(); |
|
1047 window->BeginRedraw(); |
|
1048 window->EndRedraw(); |
|
1049 } |
|
1050 } |
|
1051 else |
|
1052 { |
|
1053 const CCoeControl* parent = aTransData->iKey->Parent(); |
|
1054 if(parent) |
|
1055 { |
|
1056 // TRect rect; |
|
1057 // if(iIsWO) |
|
1058 // { |
|
1059 // rect = TRect(aTransData->iKey->PositionRelativeToScreen(),aTransData->iKey->Size()); |
|
1060 // rect.Move(-parent->PositionRelativeToScreen()); |
|
1061 // } |
|
1062 // else |
|
1063 // { |
|
1064 // rect = aTransData->iBaseControl->iBeginRect; |
|
1065 // } |
|
1066 |
|
1067 //Drawing problems with listboxes in component if |
|
1068 //particle systems is used. We disable this rect for now |
|
1069 //to resolve this. Shouldn't affect performance much. |
|
1070 |
|
1071 if ( !aTransData->iKey->IsVisible() ) |
|
1072 { |
|
1073 parent->DrawNow(); |
|
1074 } |
|
1075 } |
|
1076 } |
|
1077 //// |
|
1078 iCoeEnv->WsSession().Flush(); |
|
1079 |
|
1080 __ALFFXLOGSTRING("Adapter: Requesting finished event"); |
|
1081 if(KErrNone != iTfxServer.RequestFinishedEvent(aHandle)) |
|
1082 { |
|
1083 iCurrHandle = 0; |
|
1084 TransitionFinished(aHandle); |
|
1085 return; |
|
1086 } |
|
1087 |
|
1088 if(!drawerstart) |
|
1089 { |
|
1090 if(KErrNone != iTfxServer.SendStartTick(iClientId,aHandle)) |
|
1091 { |
|
1092 TransitionFinished(aHandle); |
|
1093 } |
|
1094 } |
|
1095 iCurrHandle = 0; |
|
1096 */ |
|
1097 __ALFFXLOGSTRING("CGfxTransAdapterTfx::DoStartTransitionL <<"); |
|
1098 } |
|
1099 |
|
1100 void CGfxTransAdapterTfx::GenerateTransitionL( const CCoeControl* aKey, const CTransitionData* aTransData) |
|
1101 { |
|
1102 __ALFFXLOGSTRING("CGfxTransAdapterTfx::GenerateTransitionL >>"); |
|
1103 // We generate a transition call from begin capture for control exit transitions |
|
1104 TPtr8 inPtr = iTransferBuffer->Des(); |
|
1105 inPtr.Zero(); |
|
1106 TPtr8 outPtr = iReturnBuffer->Des(); |
|
1107 outPtr.Zero(); |
|
1108 RDesWriteStream inBuf( inPtr ); |
|
1109 TInt op = MAlfGfxEffectPlugin::EBeginComponentTransition; |
|
1110 TInt windowGroup = aKey->DrawableWindow()->WindowGroupId(); |
|
1111 TInt windowHandle = aKey->DrawableWindow()->ClientHandle(); |
|
1112 |
|
1113 inBuf.WriteInt32L( op ); |
|
1114 inBuf.WriteUint32L( aTransData->iAction ); |
|
1115 inBuf.WriteInt32L( aTransData->iUid.iUid ); |
|
1116 inBuf.WriteInt32L( windowGroup ); // window group id of the control |
|
1117 inBuf.WriteInt32L( windowHandle ); // server side window handle for the control |
|
1118 inBuf.WriteInt32L( aTransData->iNLayered ); |
|
1119 // Participant data not present in exit |
|
1120 inBuf.WriteInt32L( 0 ); |
|
1121 inBuf.WriteInt32L( 0 ); // no hints |
|
1122 |
|
1123 inBuf.CommitL(); |
|
1124 inBuf.Release(); |
|
1125 inBuf.Close(); |
|
1126 |
|
1127 __ALFFXLOGSTRING( "CGfxTransAdapterTfx::GenerateTransitionL" ); |
|
1128 iTfxServer.SendSynchronousData( iPluginImplementation, inPtr, outPtr ); |
|
1129 // clear out used data |
|
1130 inPtr.Zero(); |
|
1131 outPtr.Zero(); |
|
1132 |
|
1133 // Don't signal client because client did not request the transition to start |
|
1134 __ALFFXLOGSTRING("CGfxTransAdapterTfx::GenerateTransitionL <<"); |
|
1135 } |
|
1136 |
|
1137 |
|
1138 // --------------------------------------------------------------------------- |
|
1139 // finds a control |
|
1140 // --------------------------------------------------------------------------- |
|
1141 // |
|
1142 //CTransControlDrawerInfo* CGfxTransAdapterTfx::FindControl(TInt /*aHandle*/) |
|
1143 /* |
|
1144 { |
|
1145 for(TInt i = iControlInfo.Count() - 1; i >= 0; i--) |
|
1146 { |
|
1147 if(iControlInfo[i]->Handle() == aHandle) |
|
1148 { |
|
1149 return iControlInfo[i]; |
|
1150 } |
|
1151 } |
|
1152 return NULL; |
|
1153 } |
|
1154 */ |
|
1155 |
|
1156 // --------------------------------------------------------------------------- |
|
1157 // finds a control drawer. |
|
1158 // --------------------------------------------------------------------------- |
|
1159 // |
|
1160 //CWsTransControlGraphic* CGfxTransAdapterTfx::FindDrawer(TInt /*aHandle*/) |
|
1161 /* |
|
1162 { |
|
1163 for(TInt i = iControlInfo.Count() - 1; i >= 0; i--) |
|
1164 { |
|
1165 if(iControlInfo[i]->Handle() == aHandle) |
|
1166 { |
|
1167 return iControlInfo[i]->Drawer(); |
|
1168 } |
|
1169 } |
|
1170 return NULL; |
|
1171 } |
|
1172 */ |
|
1173 |
|
1174 // --------------------------------------------------------------------------- |
|
1175 // callback called by server when a policy updates. |
|
1176 // --------------------------------------------------------------------------- |
|
1177 // |
|
1178 void CGfxTransAdapterTfx::PolicyUpdate(TControlPolicy* aPolicy) |
|
1179 { |
|
1180 iClient->TransitionPolicyUpdate(aPolicy); |
|
1181 } |
|
1182 |
|
1183 |
|
1184 // --------------------------------------------------------------------------- |
|
1185 // --------------------------------------------------------------------------- |
|
1186 // |
|
1187 void CGfxTransAdapterTfx::ClearAllPolicies() |
|
1188 { |
|
1189 iClient->ClearAllPolicies(); |
|
1190 } |
|
1191 |
|
1192 // --------------------------------------------------------------------------- |
|
1193 // --------------------------------------------------------------------------- |
|
1194 // |
|
1195 TInt CGfxTransAdapterTfx::RequestPolicyUpdates() |
|
1196 { |
|
1197 __ALFFXLOGSTRING("CGfxTransAdapterTfx::RequestPolicyUpdates >>"); |
|
1198 if( iPolicyReq->IsActive() ) |
|
1199 { |
|
1200 // request already ongoing |
|
1201 return KErrNone; |
|
1202 } |
|
1203 |
|
1204 if ( !iHasPlugin ) |
|
1205 { |
|
1206 return KErrDisconnected; |
|
1207 } |
|
1208 |
|
1209 // send a request to plugin to start sending us policy updates |
|
1210 // This is an asynchronous request |
|
1211 |
|
1212 TPtr8 inPtr = iAsyncTransferBuffer->Des(); |
|
1213 inPtr.Zero(); |
|
1214 TPtr8 outPtr = iAsyncReturnBuffer->Des(); |
|
1215 outPtr.Zero(); |
|
1216 RDesWriteStream inBuf( inPtr ); |
|
1217 TInt op = MAlfGfxEffectPlugin::ETfxServerOpControlPolicyRequest; |
|
1218 // We won't leave here because our buffer is long enough |
|
1219 TRAP_IGNORE( |
|
1220 { |
|
1221 // no other parameters used |
|
1222 inBuf.WriteInt32L( op ); |
|
1223 inBuf.CommitL(); |
|
1224 }); |
|
1225 inBuf.Release(); |
|
1226 inBuf.Close(); |
|
1227 |
|
1228 __ALFFXLOGSTRING( "CGfxTransAdapterTfx::RequestPolicyUpdates" ); |
|
1229 iTfxServer.SendAsynchronousData( iPluginImplementation, inPtr, outPtr, iPolicyReq->iStatus ); |
|
1230 iPolicyReq->IssueReq(); |
|
1231 // clear out used data |
|
1232 inPtr.Zero(); |
|
1233 outPtr.Zero(); |
|
1234 __ALFFXLOGSTRING("CGfxTransAdapterTfx::RequestPolicyUpdates <<"); |
|
1235 return KErrNone; |
|
1236 |
|
1237 } |
|
1238 |
|
1239 // --------------------------------------------------------------------------- |
|
1240 // --------------------------------------------------------------------------- |
|
1241 // |
|
1242 void CGfxTransAdapterTfx::GetNewPoliciesL( TUint aCount ) |
|
1243 { |
|
1244 __ALFFXLOGSTRING1("CGfxTransAdapterTfx::GetNewPoliciesL %d >>", aCount); |
|
1245 if ( !iHasPlugin ) |
|
1246 { |
|
1247 User::Leave( KErrDisconnected ); |
|
1248 } |
|
1249 // Send request to plugin |
|
1250 |
|
1251 TInt err = KErrNone; |
|
1252 |
|
1253 TPtr8 inPtr = iTransferBuffer->Des(); |
|
1254 inPtr.Zero(); |
|
1255 |
|
1256 TInt bufferSize = sizeof( TUint32 ) + ( sizeof( TInt32 ) * 2 + sizeof( TUint8 ) ) * aCount ; |
|
1257 if ( iReturnBuffer->Des().MaxSize() < bufferSize ) |
|
1258 { |
|
1259 delete iReturnBuffer; |
|
1260 iReturnBuffer = NULL; |
|
1261 iReturnBuffer = HBufC8::NewL( bufferSize ); |
|
1262 } |
|
1263 |
|
1264 TPtr8 outPtr = iReturnBuffer->Des(); |
|
1265 outPtr.Zero(); |
|
1266 RDesWriteStream inBuf( inPtr ); |
|
1267 TInt op = MAlfGfxEffectPlugin::ETfxServerOpControlPolicyGet; |
|
1268 RThread me; |
|
1269 |
|
1270 inBuf.WriteInt32L( op ); |
|
1271 TUint64 id = me.Id(); |
|
1272 TUint8* ptr = reinterpret_cast<TUint8*>( &id ); |
|
1273 inBuf.WriteL( ptr, 8 ); |
|
1274 inBuf.WriteInt32L( aCount ); |
|
1275 |
|
1276 inBuf.CommitL(); |
|
1277 inBuf.Release(); |
|
1278 inBuf.Close(); |
|
1279 me.Close(); |
|
1280 |
|
1281 if ( iHasPlugin ) |
|
1282 { |
|
1283 __ALFFXLOGSTRING( "CGfxTransAdapterTfx::GetNewPoliciesL" ); |
|
1284 err = iTfxServer.SendSynchronousData( iPluginImplementation, inPtr, outPtr ); |
|
1285 } |
|
1286 // This is a case where we are supposed to get data back |
|
1287 if ( err == KErrNone ) |
|
1288 { |
|
1289 RDesReadStream instream( outPtr ); |
|
1290 CleanupClosePushL( instream ); |
|
1291 TUint count = instream.ReadUint32L(); |
|
1292 while ( count-- > 0 ) |
|
1293 { |
|
1294 TInt uid = instream.ReadInt32L(); |
|
1295 TUint action = instream.ReadUint32L(); |
|
1296 TPolicy policyId = ( TPolicy ) instream.ReadUint8L(); |
|
1297 TControlPolicy* policy = new ( ELeave ) TControlPolicy(); |
|
1298 policy->iId.iUid = uid; |
|
1299 policy->iAction = action; |
|
1300 policy->iPolicy = policyId; |
|
1301 iClient->TransitionPolicyUpdate( policy ); |
|
1302 } |
|
1303 CleanupStack::PopAndDestroy(); // instream |
|
1304 } |
|
1305 |
|
1306 // clear out used data |
|
1307 inPtr.Zero(); |
|
1308 outPtr.Zero(); |
|
1309 __ALFFXLOGSTRING("CGfxTransAdapterTfx::GetNewPoliciesL <<"); |
|
1310 } |
|
1311 |
|
1312 // --------------------------------------------------------------------------- |
|
1313 // --------------------------------------------------------------------------- |
|
1314 // |
|
1315 void CGfxTransAdapterTfx::CancelPolicyUpdates() |
|
1316 { |
|
1317 __ALFFXLOGSTRING("CGfxTransAdapterTfx::CancelPolicyUpdates >>"); |
|
1318 if ( !iHasPlugin ) |
|
1319 { |
|
1320 // nothing to cancel |
|
1321 return; |
|
1322 } |
|
1323 |
|
1324 // send request to plugin |
|
1325 // If the updates have not been subscribed, there is nothing to cancel either |
|
1326 TPtr8 inPtr = iTransferBuffer->Des(); |
|
1327 inPtr.Zero(); |
|
1328 TPtr8 outPtr = iReturnBuffer->Des(); |
|
1329 outPtr.Zero(); |
|
1330 RDesWriteStream inBuf( inPtr ); |
|
1331 TInt op = MAlfGfxEffectPlugin::ETfxServerOpControlCancelPolicyUpdate; |
|
1332 RThread me; |
|
1333 // We won't leave here because our buffer is long enough |
|
1334 TRAP_IGNORE( |
|
1335 { |
|
1336 // no other parameters used |
|
1337 inBuf.WriteInt32L( op ); |
|
1338 TUint64 id = me.Id(); |
|
1339 TUint8* ptr = reinterpret_cast<TUint8*>( &id ); |
|
1340 inBuf.WriteL( ptr, 8 ); |
|
1341 inBuf.CommitL(); |
|
1342 }); |
|
1343 inBuf.Release(); |
|
1344 inBuf.Close(); |
|
1345 me.Close(); |
|
1346 |
|
1347 // not waiting for policies, nothing to cancel |
|
1348 if( iPolicyReq->IsActive() ) |
|
1349 { |
|
1350 // The cancel function will complete the request |
|
1351 __ALFFXLOGSTRING( "CGfxTransAdapterTfx::CancelPolicyUpdates" ); |
|
1352 iTfxServer.SendSynchronousData( iPluginImplementation, inPtr, outPtr ); |
|
1353 } |
|
1354 |
|
1355 // clear out used data |
|
1356 inPtr.Zero(); |
|
1357 outPtr.Zero(); |
|
1358 __ALFFXLOGSTRING("CGfxTransAdapterTfx::CancelPolicyUpdates <<"); |
|
1359 } |
|
1360 |
|
1361 // ------------------------------------------------------------ |
|
1362 // SendGroupCommand |
|
1363 //------------------------------------------------------------- |
|
1364 // |
|
1365 void CGfxTransAdapterTfx::SendGroupCommand(TInt aGroupId, TBool aGroupFinished) |
|
1366 { |
|
1367 __ALFFXLOGSTRING("CGfxTransAdapterTfx::SendGroupCommand >>"); |
|
1368 if ( !iHasPlugin ) |
|
1369 { |
|
1370 // nothing to cancel |
|
1371 return; |
|
1372 } |
|
1373 |
|
1374 // send request to plugin |
|
1375 // If the updates have not been subscribed, there is nothing to cancel either |
|
1376 TPtr8 inPtr = iTransferBuffer->Des(); |
|
1377 inPtr.Zero(); |
|
1378 TPtr8 outPtr = iReturnBuffer->Des(); |
|
1379 outPtr.Zero(); |
|
1380 RDesWriteStream inBuf( inPtr ); |
|
1381 |
|
1382 TInt op; |
|
1383 if ( aGroupFinished ) |
|
1384 { |
|
1385 op = MAlfGfxEffectPlugin::ETfxServerOpEndGroup; |
|
1386 } |
|
1387 else |
|
1388 { |
|
1389 op = MAlfGfxEffectPlugin::ETfxServerOpBeginGroup; |
|
1390 } |
|
1391 RThread me; |
|
1392 // We won't leave here because our buffer is long enough |
|
1393 TRAP_IGNORE( |
|
1394 { |
|
1395 // no other parameters used |
|
1396 inBuf.WriteInt32L( op ); |
|
1397 inBuf.WriteInt32L( aGroupId ); |
|
1398 TUint64 id = me.Id(); |
|
1399 TUint8* ptr = reinterpret_cast<TUint8*>( &id ); |
|
1400 inBuf.WriteL( ptr, 8 ); |
|
1401 inBuf.CommitL(); |
|
1402 }); |
|
1403 inBuf.Release(); |
|
1404 inBuf.Close(); |
|
1405 me.Close(); |
|
1406 |
|
1407 iTfxServer.SendSynchronousData( iPluginImplementation, inPtr, outPtr ); |
|
1408 |
|
1409 // clear out used data |
|
1410 inPtr.Zero(); |
|
1411 outPtr.Zero(); |
|
1412 __ALFFXLOGSTRING("CGfxTransAdapterTfx::SendGroupCommand <<"); |
|
1413 } |
|
1414 |
|
1415 |
|
1416 // ======== GLOBAL FUNCTIONS ======== |
|
1417 |
|
1418 // --------------------------------------------------------------------------- |
|
1419 // DLL interface. used by the client to create the adapter |
|
1420 // --------------------------------------------------------------------------- |
|
1421 // |
|
1422 EXPORT_C MGfxTransAdapter* MGfxTransAdapter::CreateL(MGfxTransClient* aClient) |
|
1423 { |
|
1424 __ALFFXLOGSTRING("MGfxTransAdapter::CreateL >>"); |
|
1425 CGfxTransAdapterTfx* adapter = new (ELeave) CGfxTransAdapterTfx(aClient); |
|
1426 CleanupStack::PushL(adapter); |
|
1427 adapter->ConstructL(); |
|
1428 CleanupStack::Pop(adapter); |
|
1429 __ALFFXLOGSTRING("MGfxTransAdapter::CreateL <<"); |
|
1430 return adapter; |
|
1431 } |
|
1432 |
|
1433 // --------------------------------------------------------------------------- |
|
1434 // DLL interface. used by the client to destroy the adapter |
|
1435 // --------------------------------------------------------------------------- |
|
1436 // |
|
1437 EXPORT_C void MGfxTransAdapter::Destroy(MGfxTransAdapter* aEngine) |
|
1438 { |
|
1439 delete static_cast<CGfxTransAdapterTfx*>(aEngine); |
|
1440 } |