uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfserverdrawer.cpp
branchRCL_3
changeset 34 3a60ebea00d0
parent 24 f93c875b566e
child 41 cd0ae4656946
equal deleted inserted replaced
24:f93c875b566e 34:3a60ebea00d0
    41 #include "alfmoduletest.h" 
    41 #include "alfmoduletest.h" 
    42 
    42 
    43 // This sets the maximum time for an effect. Even if the fxml file has specified a longer duration, 
    43 // This sets the maximum time for an effect. Even if the fxml file has specified a longer duration, 
    44 // this will stop the effect.
    44 // this will stop the effect.
    45 const TInt KAlfShortEffectTimeout     = 4000000;
    45 const TInt KAlfShortEffectTimeout     = 4000000;
       
    46 
       
    47 // Note, The timeouts are DIFFERENT for EMULATOR AND ARMV5
       
    48 #ifdef __WINS__
       
    49 const TInt KAlfAppStartEffectTimeout  = 800000;
       
    50 const TInt KAlfLongEffectTimeout      = 10000000;
       
    51 #else
    46 const TInt KAlfAppStartEffectTimeout  = 300000;
    52 const TInt KAlfAppStartEffectTimeout  = 300000;
    47 const TInt KAlfLongEffectTimeout      = 5000000;
    53 const TInt KAlfLongEffectTimeout      = 5000000;
       
    54 #endif
    48 const TInt KAlfActiveControlFxGranularity = 4;
    55 const TInt KAlfActiveControlFxGranularity = 4;
    49 const TInt KAlfLongApplicationStartContext = 20;
    56 const TInt KAlfLongApplicationStartContext = 20;
    50 
    57 
    51 //const TInt KAlfLongEffectTimeout  = 500000;
    58 //const TInt KAlfLongEffectTimeout  = 500000;
    52 // Timer to send finish full screen effect
    59 // Timer to send finish full screen effect
   669     bufferSize += fileName.Length() * 2;
   676     bufferSize += fileName.Length() * 2;
   670     
   677     
   671     // I don't think we need this
   678     // I don't think we need this
   672     TInt index = 0;
   679     TInt index = 0;
   673 
   680 
   674     IncreaseFullScreenHandle();
   681     iCurrentFullScreenHandle = iToSid.iId;
   675 
   682 
   676     iFullScreenTransitionEndObserver->Cancel();
   683     iFullScreenTransitionEndObserver->Cancel();
   677     iFinishFullScreen->Cancel();
   684     iFinishFullScreen->Cancel();
   678     iFullScreenTimeout->Cancel();
   685     iFullScreenTimeout->Cancel();
   679 
   686 
   683     if ( bridgeBuffer )
   690     if ( bridgeBuffer )
   684         {
   691         {
   685         RMemWriteStream stream( bridgeBuffer, bufferSize );
   692         RMemWriteStream stream( bridgeBuffer, bufferSize );
   686         // The writes should not leave if we have calculated our buffer length correctly.
   693         // The writes should not leave if we have calculated our buffer length correctly.
   687         stream.WriteInt32L( MAlfGfxEffectPlugin::EBeginFullscreen );
   694         stream.WriteInt32L( MAlfGfxEffectPlugin::EBeginFullscreen );
   688         stream.WriteInt32L(  iToSid.iId ); //iCurrentFullScreenHandle );
   695         stream.WriteInt32L(  iToSid.iId );
   689         stream.WriteInt32L( iType );
   696         stream.WriteInt32L( iType );
   690         stream.WriteInt32L( 0 ); // timeout triggered
   697         stream.WriteInt32L( 0 ); // timeout? 0 always in BeginFullScreen
       
   698         stream.WriteInt32L( 0 );
   691       	if ( iType == AknTransEffect::EParameterType && isExit )
   699       	if ( iType == AknTransEffect::EParameterType && isExit )
   692       	    {
   700       	    {
   693             stream.WriteInt32L( iToWg );
   701             stream.WriteInt32L( iToWg );
   694             stream.WriteInt32L( 0 );
   702             stream.WriteInt32L( 0 );
   695 
   703 
   808     // endfullscreen signals.
   816     // endfullscreen signals.
   809     
   817     
   810     // It appears that folder open and close never send endfullscreen, so for them the effect
   818     // It appears that folder open and close never send endfullscreen, so for them the effect
   811     // must be started as soon as we get beginfullscreen
   819     // must be started as soon as we get beginfullscreen
   812     
   820     
   813     isAppStartEffect = EFalse; // disable different timeout effect for appstart effects
   821     // isAppStartEffect = EFalse; // disable different timeout effect for appstart effects
   814 	
   822 	
   815     if (isAppStartEffect)
   823     if (isAppStartEffect)
   816         {
   824         {
   817 		// The shorter timeout can be disabled here!
   825 		// The shorter timeout can be disabled here!
   818         iFullScreenTimeout->Start( KAlfAppStartEffectTimeout, TCallBack( FullScreenTimeout, this ) );
   826         iFullScreenTimeout->Start( KAlfAppStartEffectTimeout, TCallBack( FullScreenTimeout, this ) );
   835     if ( iFullScreenEndSent )
   843     if ( iFullScreenEndSent )
   836         {
   844         {
   837         __ALFFXLOGSTRING("CAlfServerDrawer::SendEndFullscreen END no need");
   845         __ALFFXLOGSTRING("CAlfServerDrawer::SendEndFullscreen END no need");
   838         return KErrNone;
   846         return KErrNone;
   839         }
   847         }
   840     iFullScreenEndSent = ETrue;
       
   841         
   848         
   842     __ALFFXLOGSTRING("CAlfServerDrawer::SendEndFullscreen");
   849     __ALFFXLOGSTRING("CAlfServerDrawer::SendEndFullscreen");
   843     iFullScreenTransitionEndObserver->Cancel();
   850     iFullScreenTransitionEndObserver->Cancel();
   844     iFullScreenTimeout->Cancel();
   851     iFullScreenTimeout->Cancel();
   845     iFinishFullScreen->Cancel();
   852     iFinishFullScreen->Cancel();
       
   853     TBool timeout = iFullScreenTimeout->iTimeoutTriggered;
   846     TBool triggerStartEffectTimeout= iFullScreenTimeout->iTimeoutTriggered && iFullScreenTimeout->iIsStartEffect;
   854     TBool triggerStartEffectTimeout= iFullScreenTimeout->iTimeoutTriggered && iFullScreenTimeout->iIsStartEffect;
       
   855     iFullScreenEndSent = !triggerStartEffectTimeout;
   847     iFullScreenTimeout->iTimeoutTriggered = EFalse;
   856     iFullScreenTimeout->iTimeoutTriggered = EFalse;
   848     iFullScreenTimeout->iIsStartEffect = EFalse;
   857     iFullScreenTimeout->iIsStartEffect = EFalse;
   849     
   858     
   850      // This is where the second part of the effect should start
   859      // This is where the second part of the effect should start
   851     // The new window should already have something on the screen.
   860     // The new window should already have something on the screen.
   877     // We must make a stream of the data as the length may vary.
   886     // We must make a stream of the data as the length may vary.
   878     // At the moment we only send some numbers, but we should probably include
   887     // At the moment we only send some numbers, but we should probably include
   879     // also the effect file name or something else to identify the effect 
   888     // also the effect file name or something else to identify the effect 
   880     // that is going to be used
   889     // that is going to be used
   881     
   890     
   882     TInt bufferSize = 12 * sizeof(TInt); // operation, type, 2 wg ids, 2 app uids, flags and rect, timeoutTriggered
   891     TInt bufferSize = 13 * sizeof(TInt); // operation, type, 2 wg ids, 2 app uids, flags and rect, timeoutTriggered
   883     bufferSize += sizeof(TPtrC);
   892     bufferSize += sizeof(TPtrC);
   884     bufferSize += resourceDir.Length() * 2;
   893     bufferSize += resourceDir.Length() * 2;
   885     bufferSize += sizeof(TPtrC);
   894     bufferSize += sizeof(TPtrC);
   886     bufferSize += fileName.Length() * 2;
   895     bufferSize += fileName.Length() * 2;
   887     
   896     
   902             {
   911             {
   903             stream.WriteInt32L( MAlfGfxEffectPlugin::EEndFullscreen );
   912             stream.WriteInt32L( MAlfGfxEffectPlugin::EEndFullscreen );
   904             stream.WriteInt32L( iCurrentFullScreenHandle );
   913             stream.WriteInt32L( iCurrentFullScreenHandle );
   905             stream.WriteInt32L( iType );
   914             stream.WriteInt32L( iType );
   906             stream.WriteInt32L( triggerStartEffectTimeout );
   915             stream.WriteInt32L( triggerStartEffectTimeout );
       
   916             stream.WriteInt32L( timeout );
   907             stream.WriteInt32L( iToWg );
   917             stream.WriteInt32L( iToWg );
   908             stream.WriteInt32L( iFromWg );
   918             stream.WriteInt32L( iFromWg );
   909 
   919 
   910             // AppUid for the future. alfbridge can figure out the windog groups based on that
   920             // AppUid for the future. alfbridge can figure out the windog groups based on that
   911             stream.WriteInt32L( iToUid.iUid );
   921             stream.WriteInt32L( iToUid.iUid );
   932         iFullScreenTransitionEndObserver->StartObserving( TCallBack( FullScreenTransitionFinished, this ), iCurrentFullScreenHandle  );
   942         iFullScreenTransitionEndObserver->StartObserving( TCallBack( FullScreenTransitionFinished, this ), iCurrentFullScreenHandle  );
   933         }
   943         }
   934 
   944 
   935     iFullScreenFinished = EFalse;
   945     iFullScreenFinished = EFalse;
   936     iFullScreenTimeout->iIsStartEffect = EFalse;
   946     iFullScreenTimeout->iIsStartEffect = EFalse;
       
   947     if (triggerStartEffectTimeout)
       
   948         {
       
   949         return KErrNone;
       
   950         }
   937     if ( iAction == AknTransEffect::EApplicationExit /*||
   951     if ( iAction == AknTransEffect::EApplicationExit /*||
   938         iAction == 1001*/  ) 
   952         iAction == 1001*/  ) 
   939         {
   953         {
   940 		// no more events expected
   954 		// no more events expected
   941         iFinishFullScreen->Start( KAlfShortEffectTimeout, TCallBack( FinishFullScreenTimeout, this ) );
   955         iFinishFullScreen->Start( KAlfShortEffectTimeout, TCallBack( FinishFullScreenTimeout, this ) );
   959         {
   973         {
   960         return KErrNone;
   974         return KErrNone;
   961         }
   975         }
   962 
   976 
   963     iFullScreenTransitionEndObserver->Cancel();
   977     iFullScreenTransitionEndObserver->Cancel();
   964     
   978     iFinishFullScreen->Cancel();
       
   979     iFullScreenTimeout->Cancel();
   965     iFullScreenFxSent = EFalse;
   980     iFullScreenFxSent = EFalse;
   966     iFullScreenEndSent = ETrue;
   981     iFullScreenEndSent = ETrue;
   967     
   982     
   968     // Send the data to CAlfAppUI via bridge
   983     // Send the data to CAlfAppUI via bridge
   969     TAlfBridgerData bridgerData;
   984     TAlfBridgerData bridgerData;
  1284     // handles must be unique, but increasing control handle should not change fullscreen handle
  1299     // handles must be unique, but increasing control handle should not change fullscreen handle
  1285     TInt highestHandle = iCurrentControlHandle > iCurrentFullScreenHandle ? iCurrentControlHandle : iCurrentFullScreenHandle;
  1300     TInt highestHandle = iCurrentControlHandle > iCurrentFullScreenHandle ? iCurrentControlHandle : iCurrentFullScreenHandle;
  1286     highestHandle++;
  1301     highestHandle++;
  1287     iCurrentControlHandle = highestHandle; 
  1302     iCurrentControlHandle = highestHandle; 
  1288 	}
  1303 	}
  1289 	
       
  1290 void CAlfServerDrawer::IncreaseFullScreenHandle()
       
  1291     {
       
  1292     TInt highestHandle = iCurrentControlHandle > iCurrentFullScreenHandle ? iCurrentControlHandle : iCurrentFullScreenHandle;
       
  1293     highestHandle++;
       
  1294     iCurrentFullScreenHandle = highestHandle;
       
  1295     }
       
  1296 
  1304 
  1297 // ---------------------------------------------------------------------------
  1305 // ---------------------------------------------------------------------------
  1298 // ---------------------------------------------------------------------------
  1306 // ---------------------------------------------------------------------------
  1299 //		
  1307 //		
  1300 TInt CAlfServerDrawer::CurrentControlHandle()
  1308 TInt CAlfServerDrawer::CurrentControlHandle()
  1337     if ( iFullScreenTimeout->iStatus.Int() != KErrCancel )
  1345     if ( iFullScreenTimeout->iStatus.Int() != KErrCancel )
  1338         {
  1346         {
  1339         iFullScreenTimeout->Cancel();
  1347         iFullScreenTimeout->Cancel();
  1340         // If we don't get an EndFullScreen in a timely manner, 
  1348         // If we don't get an EndFullScreen in a timely manner, 
  1341         // we generate an EndFullScreen signal by ourselves
  1349         // we generate an EndFullScreen signal by ourselves
  1342         EndFullscreen();
  1350         EndFullscreen(ETrue);
  1343         }
  1351         }
  1344     }
  1352     }
  1345 
  1353 
  1346 TInt CAlfServerDrawer::FinishFullScreenTimeout( TAny* aServerDrawer )
  1354 TInt CAlfServerDrawer::FinishFullScreenTimeout( TAny* aServerDrawer )
  1347     {
  1355     {