windowing/windowserver/nga/CLIENT/rtfxeffect.cpp
changeset 45 36b2e23a8629
parent 36 01a6848ebfd7
equal deleted inserted replaced
36:01a6848ebfd7 45:36b2e23a8629
    37 Function checks the sent parmaters and pancis client if any of its length 
    37 Function checks the sent parmaters and pancis client if any of its length 
    38 is greater than KMaxFileName. Calculates the padded lengths of sent parameters
    38 is greater than KMaxFileName. Calculates the padded lengths of sent parameters
    39 and stores them in member variables
    39 and stores them in member variables
    40 
    40 
    41 @param aResourceDir directory name of animation description file
    41 @param aResourceDir directory name of animation description file
    42 @param aFilenamePhase1 File name of first phase animation of  TFX
    42 @param aFilenameOutgoing File name of Outgoing phase of TFX
    43 @param aFilenamePhase2 File name of second phase animation of  TFX
    43 @param aFilenameIncoming File name of Incoming phase of TFX
    44 */
    44 */
    45 void RTFXEffect::CheckFileNameAndSetSizes(const TFileName& aResourceDir, 
    45 void RTFXEffect::CheckFileNameAndSetSizes(const TFileName& aResourceDir, 
    46 		const TFileName& aFilenamePhase1, const TFileName& aFilenamePhase2)
    46 		const TFileName& aFilenameOutgoing, const TFileName& aFilenameIncoming)
    47 	{
    47 	{
    48 	__ASSERT_ALWAYS(aResourceDir.Length() <= KMaxFileName, Panic(EW32PanicStringTooLong));
    48 	__ASSERT_ALWAYS(aResourceDir.Length() <= KMaxFileName, Panic(EW32PanicStringTooLong));
    49 	__ASSERT_ALWAYS(aFilenamePhase1.Length() <= KMaxFileName, Panic(EW32PanicStringTooLong));
    49 	__ASSERT_ALWAYS(aFilenameOutgoing.Length() <= KMaxFileName, Panic(EW32PanicStringTooLong));
    50 	__ASSERT_ALWAYS(aFilenamePhase2.Length() <= KMaxFileName, Panic(EW32PanicStringTooLong));
    50 	__ASSERT_ALWAYS(aFilenameIncoming.Length() <= KMaxFileName, Panic(EW32PanicStringTooLong));
    51 	
    51 	
    52 	iDirPathSizePaded = PaddedValue(aResourceDir.Size());
    52 	iDirPathSizePaded = PaddedValue(aResourceDir.Size());
    53 	iFileName1SizePaded = PaddedValue(aFilenamePhase1.Size());
    53 	iFileName1SizePaded = PaddedValue(aFilenameOutgoing.Size());
    54 	iFileName2SizePaded = PaddedValue(aFilenamePhase2.Size());
    54 	iFileName2SizePaded = PaddedValue(aFilenameIncoming.Size());
    55 	
    55 	
    56 	iCombSizePaded = iDirPathSizePaded + iFileName1SizePaded + iFileName2SizePaded;
    56 	iCombSizePaded = iDirPathSizePaded + iFileName1SizePaded + iFileName2SizePaded;
    57 	}
    57 	}
    58 
    58 
    59 /**
    59 /**
    61 AppendData adds data directly to buffer. So before calling AppendData we must make sure that
    61 AppendData adds data directly to buffer. So before calling AppendData we must make sure that
    62 current command is added to buffer. Please see description of MWsClientClass::AppendData()
    62 current command is added to buffer. Please see description of MWsClientClass::AppendData()
    63 for more details.
    63 for more details.
    64 
    64 
    65 @param aResourceDir directory name of animation description file
    65 @param aResourceDir directory name of animation description file
    66 @param aFilenamePhase1 File name of first phase animation of  TFX
    66 @param aFilenameOutgoing File name of Outgoing phase of TFX
    67 @param aFilenamePhase2 File name of second phase animation of  TFX
    67 @param aFilenameIncoming File name of Incoming phase of TFX
    68 */
    68 */
    69 void RTFXEffect::AppendFileNameData(const TFileName& aResourceDir, const TFileName& aFilenamePhase1, const TFileName& aFilenamePhase2)
    69 void RTFXEffect::AppendFileNameData(const TFileName& aResourceDir, const TFileName& aFilenameOutgoing, const TFileName& aFilenameIncoming)
    70 	{
    70 	{
    71 	AppendData(aResourceDir.Ptr(), aResourceDir.Size(), EFalse);
    71 	AppendData(aResourceDir.Ptr(), aResourceDir.Size(), EFalse);
    72     AppendData(aFilenamePhase1.Ptr(), aFilenamePhase1.Size(), EFalse);
    72     AppendData(aFilenameOutgoing.Ptr(), aFilenameOutgoing.Size(), EFalse);
    73     AppendData(aFilenamePhase2.Ptr(), aFilenamePhase2.Size(), ETrue);
    73     AppendData(aFilenameIncoming.Ptr(), aFilenameIncoming.Size(), ETrue);
    74 	}
    74 	}
    75 
    75 
    76 /**
    76 /**
    77 Writes file names using IPC args along with data related to TWsClCmdRegisterEffect
    77 Writes file names using IPC args along with data related to TWsClCmdRegisterEffect
    78 First phase animation file name is sent in seocnd slot of IPC to server
    78 Out going phase animation file name is sent in second slot of IPC to server
    79 Second phase animation file name is sent in third slot of IPC to server
    79 In coming phase animation file name is sent in third slot of IPC to server
    80 Data related to TWsClCmdRegisterEffect and folder name are sent in the normal wserv buffer
    80 Data related to TWsClCmdRegisterEffect and folder name are sent in the normal wserv buffer
    81 
    81 
    82 @param aForRegister an object of TWsClCmdRegisterEffect filled with data related to RegisterTFXEffect
    82 @param aForRegister an object of TWsClCmdRegisterEffect filled with data related to RegisterTFXEffect
    83 					If non Empty then this function is called for Register effect
    83 					If non Empty then this function is called for Register effect
    84 @param aForOverride an object of TWsClCmdOverrideEffect filled with data related to OverrideTFXEffect
    84 @param aForOverride an object of TWsClCmdOverrideEffect filled with data related to OverrideTFXEffect
    85 					If non Empty then this function is called for Overide effect					 
    85 					If non Empty then this function is called for Overide effect					 
    86 @param aResourceDir directory name of animation description file
    86 @param aResourceDir directory name of animation description file
    87 @param aFilenamePhase1 File name of first phase animation of  TFX
    87 @param aFilenameOutgoing File name of Outgoing phase of TFX
    88 @param aFilenamePhase2 File name of second phase animation of  TFX
    88 @param aFilenameIncoming File name of Incoming phase of TFX
    89 @param aCalledFrom value from TFXEffect enum reprseting whether called from RWsSession or RWindowbase 	
    89 @param aCalledFrom value from TFXEffect enum reprseting whether called from RWsSession or RWindowbase 	
    90 */
    90 */
    91 void RTFXEffect::WriteDataUsingIPC(TWsClCmdRegisterEffect* aForRegister, TWsClCmdOverrideEffect* aForOverride, 
    91 void RTFXEffect::WriteDataUsingIPC(TWsClCmdRegisterEffect* aForRegister, TWsClCmdOverrideEffect* aForOverride, 
    92 		const TFileName& aResourceDir, const TFileName& aFilenamePhase1, const TFileName& aFilenamePhase2, TFXEffect aCalledFrom)
    92 		const TFileName& aResourceDir, const TFileName& aFilenameOutgoing, const TFileName& aFilenameIncoming, TFXEffect aCalledFrom)
    93 	{
    93 	{
    94 	TIpcArgs ipcArgsDesc;
    94 	TIpcArgs ipcArgsDesc;
    95 	ipcArgsDesc.Set(1, &aFilenamePhase1);
    95 	ipcArgsDesc.Set(1, &aFilenameOutgoing);
    96 	ipcArgsDesc.Set(2, &aFilenamePhase2);
    96 	ipcArgsDesc.Set(2, &aFilenameIncoming);
    97 	// If called for RegisterTFXEffect
    97 	// If called for RegisterTFXEffect
    98 	if (aForRegister)
    98 	if (aForRegister)
    99 		{
    99 		{
   100 		Write(aForRegister, sizeof(*aForRegister), aResourceDir.Ptr(), aResourceDir.Size(), 
   100 		Write(aForRegister, sizeof(*aForRegister), aResourceDir.Ptr(), aResourceDir.Size(), 
   101 				EWsClOpRegisterTFXEffectIPC, &ipcArgsDesc);
   101 				EWsClOpRegisterTFXEffectIPC, &ipcArgsDesc);
   134  Send one string in the wserv buffer as done before ie. pading and unpading
   134  Send one string in the wserv buffer as done before ie. pading and unpading
   135  Other two strings are sent using IPC args in 2 and 3 slot of IPC and do explicit flush
   135  Other two strings are sent using IPC args in 2 and 3 slot of IPC and do explicit flush
   136  And at server side get one string from buffer and other 2 from IPC
   136  And at server side get one string from buffer and other 2 from IPC
   137 
   137 
   138 @param aAction Particular transition to register the animation for.
   138 @param aAction Particular transition to register the animation for.
       
   139 @param aPurpose The purpose of the window.
   139 @param aResourceDir The name of the directory that contains the animation description files.
   140 @param aResourceDir The name of the directory that contains the animation description files.
   140 @param aFilenamePhase1 The file containing the description of the animation for the first phase(Phase1) of the transition. 
   141 @param aFilenameOutgoing The file containing the description of the animation for the outgoing phase of the transition. 
   141 					   Specify KNullDesC for no Phase1 effect.
   142 						 Specify KNullDesC for no outgoing phase effect.
   142 @param aFilenamePhase2 The file containing the description of the animation for the second phase(Phase2) of the transition. 
   143 @param aFilenameIncoming The file containing the description of the animation for the incoming phase of the transition. 
   143 					   Specify KNullDesC for no Phase2 effect.
   144 						 Specify KNullDesC for no incoming phase effect.
   144 @param aAppUid The Application UID this effect applies to. Set to zero to specify that all apps will use default effect.
   145 @param aAppUid The Application UID this effect applies to. Set to zero to specify that all apps will use default effect.
       
   146 @param aFlags Flag for the effect. Please see TTfxFlags for values this flag parameter can use.
   145 */
   147 */
   146 void RTFXEffect::RegisterTFXEffect(TInt aAction, const TFileName& aResourceDir, 
   148 void RTFXEffect::RegisterTFXEffect(TInt aAction, TInt aPurpose, const TFileName& aResourceDir, 
   147 		const TFileName& aFilenamePhase1, const TFileName& aFilenamePhase2, TUint aAppUid)
   149 		const TFileName& aFilenameOutgoing, const TFileName& aFilenameIncoming, TUint aAppUid, TBitFlags aFlags)
   148 	{
   150 	{
   149 	CheckFileNameAndSetSizes(aResourceDir, aFilenamePhase1, aFilenamePhase2);
   151 	CheckFileNameAndSetSizes(aResourceDir, aFilenameOutgoing, aFilenameIncoming);
   150 	if (CheckCombinedSizeWithCurrentBuffer(sizeof(TWsClCmdRegisterEffect)))
   152 	if (CheckCombinedSizeWithCurrentBuffer(sizeof(TWsClCmdRegisterEffect)))
   151 		{
   153 		{
   152 		TWsClCmdRegisterEffect params(aAction, aAppUid, aResourceDir.Size(), aFilenamePhase1.Size(), aFilenamePhase2.Size());
   154 		TWsClCmdRegisterEffect params(aAction, aPurpose, aResourceDir.Size(), aFilenameOutgoing.Size(), aFilenameIncoming.Size(), aAppUid, aFlags);
   153 		// Here we just pass the length of combined strings so that it checks and does flush if needed.
   155 		// Here we just pass the length of combined strings so that it checks and does flush if needed.
   154 		// Then AppendData actually adds the data to buffer at the end
   156 		// Then AppendData actually adds the data to buffer at the end
   155 		Write(&params, sizeof(params), iCombSizePaded, EWsClOpRegisterTFXEffectBuf);
   157 		Write(&params, sizeof(params), iCombSizePaded, EWsClOpRegisterTFXEffectBuf);
   156 		if (iCombSizePaded > 0)
   158 		if (iCombSizePaded > 0)
   157 			AppendFileNameData(aResourceDir, aFilenamePhase1, aFilenamePhase2);
   159 			AppendFileNameData(aResourceDir, aFilenameOutgoing, aFilenameIncoming);
   158 		}
   160 		}
   159 	else
   161 	else
   160 		{
   162 		{
   161 		TWsClCmdRegisterEffect params(aAction, aAppUid, aResourceDir.Size(), 0, 0);
   163 		TWsClCmdRegisterEffect params(aAction, aPurpose, aResourceDir.Size(), 0, 0, aAppUid, aFlags);
   162 		WriteDataUsingIPC(&params, NULL, aResourceDir, aFilenamePhase1, aFilenamePhase2, ETFXSession);
   164 		WriteDataUsingIPC(&params, NULL, aResourceDir, aFilenameOutgoing, aFilenameIncoming, ETFXSession);
   163 		}
   165 		}
   164 	}
   166 	}
   165 
   167 
   166 /**
   168 /**
   167 Checks the length of sent variables and does as explained in
   169 Checks the length of sent variables and does as explained in
   168 RTFXEffect::RegisterTFXEffect() API description
   170 RTFXEffect::RegisterTFXEffect() API description
   169 
   171 
   170 @param aOneShot A flag to see if the specified override should be applied once or on an ongoing basis
       
   171 @param aAction The particular transition to set the animation for.
   172 @param aAction The particular transition to set the animation for.
       
   173 @param aPurpose This override only effects the window/layers owned by the application that have the specified purpose.
   172 @param aResourceDir The name of the directory that contains the animation description files.
   174 @param aResourceDir The name of the directory that contains the animation description files.
   173 @param aFilenamePhase1 The file containing the description of the animation for the first phase(Phase1) of the transition.
   175 @param aFilenameOutgoing The file containing the description of the animation for the outgoing phase of the transition. 
   174 					   Specify KNullDesC for no Phase1 effect.
   176 						 Specify KNullDesC for no outgoing phase effect.
   175 @param aFilenamePhase2 The file containing the description of the animation for the second phase(Phase2) of the transition.
   177 @param aFilenameIncoming The file containing the description of the animation for the incoming phase of the transition. 
   176 					   Specify KNullDesC for no Phase2 effect.
   178 						 Specify KNullDesC for no incoming phase effect.
       
   179 @param aFlags Flag for the effect. Please see TTfxFlags for values this flag parameter can use.
   177 */
   180 */
   178 void RTFXEffect::OverrideTFXEffect(TBool aOneShot, TInt aAction, const TFileName& aResourceDir, 
   181 void RTFXEffect::OverrideTFXEffect(TFXEffect aCalledFrom, TInt aAction, TInt aPurpose, const TFileName& aResourceDir, 
   179 		const TFileName& aFilenamePhase1, const TFileName& aFilenamePhase2, TFXEffect aCalledFrom)
   182 		const TFileName& aFilenameOutgoing, const TFileName& aFilenameIncoming, TBitFlags aFlags)
   180 	{
   183 	{
   181 	CheckFileNameAndSetSizes(aResourceDir, aFilenamePhase1, aFilenamePhase2);
   184 	CheckFileNameAndSetSizes(aResourceDir, aFilenameOutgoing, aFilenameIncoming);
   182 	if (CheckCombinedSizeWithCurrentBuffer(sizeof(TWsClCmdOverrideEffect)))
   185 	if (CheckCombinedSizeWithCurrentBuffer(sizeof(TWsClCmdOverrideEffect)))
   183 		{
   186 		{
   184 		TWsClCmdOverrideEffect params(aOneShot, aAction, aResourceDir.Size(), aFilenamePhase1.Size(), aFilenamePhase2.Size());
   187 		TWsClCmdOverrideEffect params(aAction, aPurpose, aResourceDir.Size(), aFilenameOutgoing.Size(), aFilenameIncoming.Size(), aFlags);
   185 		Write(&params, sizeof(params), iCombSizePaded, (aCalledFrom == ETFXSession ? EWsClOpOverrideEffectBuf : EWsWinOpOverrideEffectBuf));
   188 		Write(&params, sizeof(params), iCombSizePaded, (aCalledFrom == ETFXSession ? EWsClOpOverrideEffectBuf : EWsWinOpOverrideEffectBuf));
   186 		if (iCombSizePaded > 0)
   189 		if (iCombSizePaded > 0)
   187 			AppendFileNameData(aResourceDir, aFilenamePhase1, aFilenamePhase2);
   190 			AppendFileNameData(aResourceDir, aFilenameOutgoing, aFilenameIncoming);
   188 		}
   191 		}
   189 	else
   192 	else
   190 		{
   193 		{
   191 		TWsClCmdOverrideEffect params(aOneShot, aAction, aResourceDir.Size(), 0, 0);
   194 		TWsClCmdOverrideEffect params(aAction, aPurpose, aResourceDir.Size(), 0, 0, aFlags);
   192 		WriteDataUsingIPC(NULL, &params, aResourceDir, aFilenamePhase1, aFilenamePhase2, aCalledFrom);
   195 		WriteDataUsingIPC(NULL, &params, aResourceDir, aFilenameOutgoing, aFilenameIncoming, aCalledFrom);
   193 		}
   196 		}
   194 	}
   197 	}