554 CleanupClosePushL( wsSession ); |
553 CleanupClosePushL( wsSession ); |
555 User::LeaveIfError( wgCount = wsSession.NumWindowGroups() ); |
554 User::LeaveIfError( wgCount = wsSession.NumWindowGroups() ); |
556 RArray<RWsSession::TWindowGroupChainInfo> wgArray; |
555 RArray<RWsSession::TWindowGroupChainInfo> wgArray; |
557 CleanupClosePushL( wgArray ); |
556 CleanupClosePushL( wgArray ); |
558 User::LeaveIfError( wsSession.WindowGroupList( &wgArray ) ); |
557 User::LeaveIfError( wsSession.WindowGroupList( &wgArray ) ); |
559 TApaTask task( wsSession ); |
558 |
560 TBool brought( EFalse ); |
559 //TApaTask task( wsSession ); |
|
560 TBool brought = EFalse; |
561 TInt wgId( KErrNotFound ); |
561 TInt wgId( KErrNotFound ); |
562 TThreadId threadId; |
562 TThreadId threadId; |
563 |
563 |
564 TPckgBuf<TThreadId> id; |
564 TPckgBuf<TThreadId> id; |
565 aMessage.ReadL( 0, id ); |
565 aMessage.ReadL( 0, id ); |
569 { |
569 { |
570 wgId = wgArray[wgCount].iId; |
570 wgId = wgArray[wgCount].iId; |
571 User::LeaveIfError( wsSession.GetWindowGroupClientThreadId( wgId, threadId ) ); |
571 User::LeaveIfError( wsSession.GetWindowGroupClientThreadId( wgId, threadId ) ); |
572 if ( threadId == id() ) |
572 if ( threadId == id() ) |
573 { |
573 { |
574 CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC( wsSession, wgId ); |
574 TInt handle = wsSession.GetWindowGroupHandle( wgId ); |
575 task.SetWgId( wgId ); |
575 if( handle == KErrNone ) |
576 if ( !wgName->Hidden() && task.Exists() ) |
|
577 { |
576 { |
578 task.BringToForeground(); |
577 RWindowGroup* group = new (ELeave) RWindowGroup(); |
579 brought = ETrue; |
578 group->Construct( handle ); |
|
579 group->SetOrdinalPosition( 0 ); //foreground |
|
580 |
|
581 brought = ETrue; |
|
582 |
|
583 group->Close(); |
|
584 delete group; |
580 } |
585 } |
581 CleanupStack::PopAndDestroy( wgName ); |
586 } |
|
587 //task.SetWgId( wgId ); |
|
588 //if ( !wgName->Hidden() && task.Exists() ) |
|
589 // { |
|
590 // task.BringToForeground(); |
|
591 // brought = ETrue; |
|
592 // } |
582 } |
593 } |
583 } |
594 |
584 TPckgBuf<TBool> ret( brought ); |
595 TPckgBuf<TBool> ret( brought ); |
585 aMessage.WriteL( 1, ret ); |
596 aMessage.WriteL( 1, ret ); |
586 |
597 |
587 break; |
598 break; |
588 } |
599 } |
890 CMemSpyProcess* process = NULL; |
901 CMemSpyProcess* process = NULL; |
891 CMemSpyThread* thread = NULL; |
902 CMemSpyThread* thread = NULL; |
892 TInt error = iEngine.Container().ProcessAndThreadByThreadId( server.Id(), process, thread ); |
903 TInt error = iEngine.Container().ProcessAndThreadByThreadId( server.Id(), process, thread ); |
893 if (error == KErrNone && thread) |
904 if (error == KErrNone && thread) |
894 { |
905 { |
895 data.iId = thread->Process().Id(); |
906 data.iProcessId = thread->Process().Id(); |
|
907 data.iThreadId = thread->Id(); |
896 } |
908 } |
897 data.iName.Copy(server.Name().Left(KMaxFullName)); |
909 data.iName.Copy(server.Name().Left(KMaxFullName)); |
898 data.iSessionCount = server.SessionCount(); |
910 data.iSessionCount = server.SessionCount(); |
899 |
911 |
900 TPckgBuf<TMemSpyServerData> buffer(data); |
912 TPckgBuf<TMemSpyServerData> buffer(data); |
931 for(TInt i=0, offset = 0; i<realCount; i++, offset += sizeof(TMemSpyServerData)) |
943 for(TInt i=0, offset = 0; i<realCount; i++, offset += sizeof(TMemSpyServerData)) |
932 { |
944 { |
933 const CMemSpyEngineServerEntry& server = list->At(i); |
945 const CMemSpyEngineServerEntry& server = list->At(i); |
934 TMemSpyServerData data; |
946 TMemSpyServerData data; |
935 |
947 |
936 data.iId = server.Id(); |
948 CMemSpyProcess* process = NULL; |
|
949 CMemSpyThread* thread = NULL; |
|
950 TInt error = iEngine.Container().ProcessAndThreadByThreadId( server.Id(), process, thread ); |
|
951 if (error == KErrNone && thread) |
|
952 { |
|
953 data.iProcessId = thread->Process().Id(); |
|
954 data.iThreadId = thread->Id(); |
|
955 } |
937 data.iName.Copy(server.Name().Left(KMaxFullName)); |
956 data.iName.Copy(server.Name().Left(KMaxFullName)); |
938 data.iSessionCount = server.SessionCount(); |
957 data.iSessionCount = server.SessionCount(); |
939 |
958 |
940 TPckgBuf<TMemSpyServerData> buffer(data); |
959 TPckgBuf<TMemSpyServerData> buffer(data); |
941 aMessage.WriteL(1, buffer, offset); |
960 aMessage.WriteL(1, buffer, offset); |
1224 a0 = realCount; |
1243 a0 = realCount; |
1225 aMessage.WriteL(0, a0); |
1244 aMessage.WriteL(0, a0); |
1226 |
1245 |
1227 break; |
1246 break; |
1228 } |
1247 } |
|
1248 |
|
1249 case EMemSpyClientServerOpGetWindowGroupCount: |
|
1250 { |
|
1251 if (!iEngine.IsHelperWindowServerSupported()) |
|
1252 { |
|
1253 User::Leave(KErrNotSupported); |
|
1254 } |
|
1255 |
|
1256 RWsSession windowSession; |
|
1257 windowSession.Connect(); |
|
1258 TInt result = windowSession.NumWindowGroups(); |
|
1259 windowSession.Close(); |
|
1260 User::LeaveIfError(result); |
|
1261 |
|
1262 aMessage.WriteL(0, TPckgBuf<TInt>(result)); |
|
1263 break; |
|
1264 } |
|
1265 |
|
1266 case EMemSpyClientServerOpGetWindowGroups: |
|
1267 { |
|
1268 if (!iEngine.IsHelperWindowServerSupported()) |
|
1269 { |
|
1270 User::Leave(KErrNotSupported); |
|
1271 } |
|
1272 |
|
1273 RArray<TMemSpyEngineWindowGroupBasicInfo> groups; |
|
1274 CleanupClosePushL( groups ); |
|
1275 |
|
1276 iEngine.HelperWindowServer().GetWindowGroupListL( groups ); |
|
1277 |
|
1278 TPckgBuf<TInt> a0; |
|
1279 aMessage.ReadL(0, a0); |
|
1280 TInt realCount = Min(a0(), groups.Count()); |
|
1281 |
|
1282 for (TInt i=0, offset = 0; i<realCount; i++, offset += sizeof(TMemSpyEngineWindowGroupDetails)) |
|
1283 { |
|
1284 TMemSpyEngineWindowGroupDetails data; |
|
1285 |
|
1286 |
|
1287 iEngine.HelperWindowServer().GetWindowGroupDetailsL(groups[i].iId, data); |
|
1288 |
|
1289 TPckgBuf<TMemSpyEngineWindowGroupDetails> buffer(data); |
|
1290 aMessage.WriteL(1, buffer, offset); |
|
1291 } |
|
1292 |
|
1293 a0 = realCount; |
|
1294 aMessage.WriteL(0, a0); |
|
1295 |
|
1296 CleanupStack::PopAndDestroy( &groups ); |
|
1297 |
|
1298 break; |
|
1299 } |
|
1300 |
1229 |
1301 |
1230 } |
1302 } |
1231 } |
1303 } |
1232 |
1304 |
1233 // --------------------------------------------------------- |
1305 // --------------------------------------------------------- |