60 { |
61 { |
61 DEBUG_PRINTF("CMediaClientVideoDisplayBody::ConstructL +++"); |
62 DEBUG_PRINTF("CMediaClientVideoDisplayBody::ConstructL +++"); |
62 |
63 |
63 SetWindowArrayPtr2Client(); |
64 SetWindowArrayPtr2Client(); |
64 |
65 |
65 CreateExtDisplayPluginL(); |
66 // External display switching and wserv events are only possible if there is |
66 |
67 // an active scheduler in client thread |
67 // Try and enable display switching by default. If this leaves then do so quietly. |
68 if(CActiveScheduler::Current()) |
68 // Either the client has no scheduler installed or the device does not support external |
69 { |
69 // switching (i.e. no plugin was found) |
70 CreateExtDisplayPluginL(); |
70 TRAPD(err, SetExternalDisplaySwitchingL(aExtDisplaySwitchingControl)); |
71 iWsEventObserver = CMediaClientWsEventObserver::NewL(*this); |
71 err = err; // remove compile warning |
72 |
72 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::ConstructL SetExternalDisplaySwitchingL returned with %d", err); |
73 iServerClient = CMediaClientPolicyServerClient::NewL(); |
73 |
74 if(iServerClient->Connect() != KErrNone) |
|
75 { |
|
76 delete iServerClient; |
|
77 iServerClient = NULL; |
|
78 } |
|
79 |
|
80 if(IsSurfaceCreated() && iServerClient) |
|
81 { |
|
82 iServerClient->SetSurface(iSurfaceId); |
|
83 } |
|
84 |
|
85 // Try and enable display switching by default. If this leaves then do so quietly. |
|
86 // Either the client has no scheduler installed or the device does not support external |
|
87 // switching (i.e. no plugin was found) |
|
88 TRAPD(err, SetExternalDisplaySwitchingL(aExtDisplaySwitchingControl)); |
|
89 err = err; // remove compile warning |
|
90 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::ConstructL SetExternalDisplaySwitchingL returned with %d", err); |
|
91 } |
|
92 else |
|
93 { |
|
94 DEBUG_PRINTF("CMediaClientVideoDisplayBody::ConstructL No CActiveScheduler - ext display and focus features disabled "); |
|
95 } |
74 DEBUG_PRINTF("CMediaClientVideoDisplayBody::ConstructL ---"); |
96 DEBUG_PRINTF("CMediaClientVideoDisplayBody::ConstructL ---"); |
75 } |
97 } |
76 |
98 |
77 CMediaClientVideoDisplayBody::CMediaClientVideoDisplayBody(TInt aDisplayId, const TSurfaceId& aSurfaceId, |
99 CMediaClientVideoDisplayBody::CMediaClientVideoDisplayBody(TInt aDisplayId, const TSurfaceId& aSurfaceId, |
78 const TRect& aCropRect, TVideoAspectRatio aAspectRatio) : |
100 const TRect& aCropRect, TVideoAspectRatio aAspectRatio) : |
127 } |
153 } |
128 |
154 |
129 void CMediaClientVideoDisplayBody::AddDisplayWindowL(const RWindowBase* aWindow, const TRect& aClipRect, const TRect& aCropRegion, const TRect& aVideoExtent, |
155 void CMediaClientVideoDisplayBody::AddDisplayWindowL(const RWindowBase* aWindow, const TRect& aClipRect, const TRect& aCropRegion, const TRect& aVideoExtent, |
130 TReal32 aScaleWidth, TReal32 aScaleHeight, TVideoRotation aRotation, |
156 TReal32 aScaleWidth, TReal32 aScaleHeight, TVideoRotation aRotation, |
131 TAutoScaleType aAutoScaleType, TInt aHorizPos, TInt aVertPos, RWindow* aWindow2) |
157 TAutoScaleType aAutoScaleType, TInt aHorizPos, TInt aVertPos, RWindow* aWindow2) |
132 { |
158 { |
133 DEBUG_PRINTF("CMediaClientVideoDisplayBody::AddDisplayWindowL +++"); |
159 DEBUG_PRINTF("CMediaClientVideoDisplayBody::AddDisplayWindowL +++"); |
134 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::AddDisplayWindowL - aWindow WsHandle 0x%X", aWindow->WsHandle()); |
160 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::AddDisplayWindowL - aWindow WsHandle 0x%X", aWindow->WsHandle()); |
135 DEBUG_PRINTF5("CMediaClientVideoDisplayBody::AddDisplayWindowL - aClipRect %d,%d - %d,%d", aClipRect.iTl.iX, aClipRect.iTl.iY, aClipRect.iBr.iX, aClipRect.iBr.iY); |
161 DEBUG_PRINTF5("CMediaClientVideoDisplayBody::AddDisplayWindowL - aClipRect %d,%d - %d,%d", aClipRect.iTl.iX, aClipRect.iTl.iY, aClipRect.iBr.iX, aClipRect.iBr.iY); |
136 DEBUG_PRINTF5("CMediaClientVideoDisplayBody::AddDisplayWindowL - aCropRegion %d,%d - %d,%d", aCropRegion.iTl.iX, aCropRegion.iTl.iY, aCropRegion.iBr.iX, aCropRegion.iBr.iY); |
162 DEBUG_PRINTF5("CMediaClientVideoDisplayBody::AddDisplayWindowL - aCropRegion %d,%d - %d,%d", aCropRegion.iTl.iX, aCropRegion.iTl.iY, aCropRegion.iBr.iX, aCropRegion.iBr.iY); |
137 DEBUG_PRINTF5("CMediaClientVideoDisplayBody::AddDisplayWindowL - aVideoExtent %d,%d - %d,%d", aVideoExtent.iTl.iX, aVideoExtent.iTl.iY, aVideoExtent.iBr.iX, aVideoExtent.iBr.iY); |
163 DEBUG_PRINTF5("CMediaClientVideoDisplayBody::AddDisplayWindowL - aVideoExtent %d,%d - %d,%d", aVideoExtent.iTl.iX, aVideoExtent.iTl.iY, aVideoExtent.iBr.iX, aVideoExtent.iBr.iY); |
150 TWindowData winData(aWindow, aClipRect, aVideoExtent, aScaleWidth, aScaleHeight, aRotation, aAutoScaleType, aHorizPos, aVertPos, aWindow2); |
176 TWindowData winData(aWindow, aClipRect, aVideoExtent, aScaleWidth, aScaleHeight, aRotation, aAutoScaleType, aHorizPos, aVertPos, aWindow2); |
151 iClientWindows.AppendL(winData); |
177 iClientWindows.AppendL(winData); |
152 |
178 |
153 iCropRegion = aCropRegion; |
179 iCropRegion = aCropRegion; |
154 |
180 |
|
181 TBool prevClientWindowIsInFocus = iClientWindowIsInFocus; |
|
182 UpdateFocus(); |
|
183 |
155 if (IsSurfaceCreated()) |
184 if (IsSurfaceCreated()) |
156 { |
185 { |
157 // first client window just added |
186 // if first window was just added OR the new window has moved us from out of focus to in focus |
158 if((iClientWindows.Count() == 1) && iClientRequestedExtDisplaySwitching) |
187 if(((iClientWindows.Count() == 1) || !prevClientWindowIsInFocus) && iClientRequestedExtDisplaySwitching && |
159 { |
188 iClientWindowIsInFocus && iExtDisplayConnected) |
160 if(iExtDisplayConnected) |
189 { |
|
190 TRAPD(err, CreateExtDisplayHandlerL()); |
|
191 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::AddDisplayWindowL CreateExtDisplayHandlerL error %d", err); |
|
192 if(err == KErrNone) |
161 { |
193 { |
162 TRAPD(err, CreateExtDisplayHandlerL()); |
194 SetWindowArrayPtr2Ext(); |
163 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::AddDisplayWindowL CreateExtDisplayHandlerL error %d", err); |
195 User::LeaveIfError(RedrawWindows(aCropRegion)); |
164 if(err == KErrNone) |
|
165 { |
|
166 SetWindowArrayPtr2Ext(); |
|
167 User::LeaveIfError(RedrawWindows(aCropRegion)); |
|
168 } |
|
169 } |
196 } |
170 } |
197 } |
171 |
198 |
172 if(!iExtDisplayConnected || !iExtDisplayHandler) |
199 if(!iSwitchedToExternalDisplay) |
173 { |
200 { |
174 User::LeaveIfError(SetBackgroundSurface(winData, aCropRegion)); |
201 User::LeaveIfError(SetBackgroundSurface(winData, aCropRegion)); |
175 } |
202 } |
176 } |
203 } |
177 DEBUG_PRINTF("CMediaClientVideoDisplayBody::AddDisplayWindowL ---"); |
204 DEBUG_PRINTF("CMediaClientVideoDisplayBody::AddDisplayWindowL ---"); |
188 { |
215 { |
189 DEBUG_PRINTF("CMediaClientVideoDisplayBody::RemoveDisplayWindow +++"); |
216 DEBUG_PRINTF("CMediaClientVideoDisplayBody::RemoveDisplayWindow +++"); |
190 TInt pos = iClientWindows.Find(aWindow.WsHandle(), TWindowData::CompareByWsHandle); |
217 TInt pos = iClientWindows.Find(aWindow.WsHandle(), TWindowData::CompareByWsHandle); |
191 |
218 |
192 if (pos >= 0) |
219 if (pos >= 0) |
193 { |
220 { |
194 if (IsSurfaceCreated() && (!iExtDisplayConnected || !iExtDisplayHandler)) |
221 if(IsSurfaceCreated() && !iSwitchedToExternalDisplay) |
195 { |
222 { |
196 iClientWindows[pos].iWindow->RemoveBackgroundSurface(ETrue); |
223 iClientWindows[pos].iWindow->RemoveBackgroundSurface(ETrue); |
197 // Make sure all window rendering has completed before proceeding |
224 // Make sure all window rendering has completed before proceeding |
198 RWsSession* ws = iClientWindows[pos].iWindow->Session(); |
225 RWsSession* ws = iClientWindows[pos].iWindow->Session(); |
199 if (ws) |
226 if (ws) |
200 { |
227 { |
201 ws->Finish(); |
228 ws->Finish(); |
202 } |
229 } |
203 } |
230 } |
204 iClientWindows.Remove(pos); |
231 |
205 |
232 iClientWindows.Remove(pos); |
206 if(iClientWindows.Count() == 0 && iExtDisplayConnected && iExtDisplayHandler) |
233 |
207 { |
234 TBool prevClientWindowIsInFocus = iClientWindowIsInFocus; |
208 RemoveBackgroundSurface(ETrue); |
235 UpdateFocus(); |
209 SetWindowArrayPtr2Client(); |
236 |
210 RemoveExtDisplayHandler(); |
237 // if only window was just removed OR removal has moved us from in focus to out of focus |
211 } |
238 if((iClientWindows.Count() == 0 || prevClientWindowIsInFocus) && iSwitchedToExternalDisplay && |
|
239 !iClientWindowIsInFocus) |
|
240 { |
|
241 RemoveBackgroundSurface(ETrue); |
|
242 SetWindowArrayPtr2Client(); |
|
243 RemoveExtDisplayHandler(); |
|
244 RedrawWindows(iCropRegion); |
|
245 } |
212 } |
246 } |
213 |
247 |
214 DEBUG_PRINTF("CMediaClientVideoDisplayBody::RemoveDisplayWindow ---"); |
248 DEBUG_PRINTF("CMediaClientVideoDisplayBody::RemoveDisplayWindow ---"); |
215 return pos; |
249 return pos; |
216 } |
250 } |
233 iSurfaceId = aSurfaceId; |
267 iSurfaceId = aSurfaceId; |
234 iCropRect = aCropRect; |
268 iCropRect = aCropRect; |
235 iAspectRatio = aAspectRatio; |
269 iAspectRatio = aAspectRatio; |
236 iCropRegion = aCropRegion; |
270 iCropRegion = aCropRegion; |
237 |
271 |
|
272 if(iServerClient) |
|
273 { |
|
274 iServerClient->SetSurface(iSurfaceId); |
|
275 } |
|
276 |
238 if (emitEvent && iEventHandler) |
277 if (emitEvent && iEventHandler) |
239 { |
278 { |
240 iEventHandler->MmsehSurfaceCreated(iDisplayId, iSurfaceId, iCropRect, iAspectRatio); |
279 iEventHandler->MmsehSurfaceCreated(iDisplayId, iSurfaceId, iCropRect, iAspectRatio); |
241 } |
280 } |
242 |
281 |
243 TInt err = KErrNone; |
282 TInt err = KErrNone; |
244 if((iClientWindows.Count() > 0) && iClientRequestedExtDisplaySwitching) |
283 if((iClientWindows.Count() > 0) && iClientRequestedExtDisplaySwitching && iClientWindowIsInFocus) |
245 { |
284 { |
246 if(iExtDisplayConnected && !iExtDisplayHandler) |
285 if(iExtDisplayConnected && !iExtDisplayHandler) |
247 { |
286 { |
248 TRAP(err, CreateExtDisplayHandlerL()); |
287 TRAP(err, CreateExtDisplayHandlerL()); |
249 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SurfaceCreated CreateExtDisplayHandlerL error %d", err); |
288 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SurfaceCreated CreateExtDisplayHandlerL error %d", err); |
484 for (TInt i = 0; i < count; ++i) |
523 for (TInt i = 0; i < count; ++i) |
485 { |
524 { |
486 iClientWindows[i].iAutoScaleType = aScaleType; |
525 iClientWindows[i].iAutoScaleType = aScaleType; |
487 iClientWindows[i].iHorizPos = aHorizPos; |
526 iClientWindows[i].iHorizPos = aHorizPos; |
488 iClientWindows[i].iVertPos = aVertPos; |
527 iClientWindows[i].iVertPos = aVertPos; |
489 if (IsSurfaceCreated() && (!iExtDisplayConnected || !iExtDisplayHandler)) |
528 if (IsSurfaceCreated() && !iSwitchedToExternalDisplay) |
490 { |
529 { |
491 User::LeaveIfError(SetBackgroundSurface(iClientWindows[i], aCropRegion)); |
530 User::LeaveIfError(SetBackgroundSurface(iClientWindows[i], aCropRegion)); |
492 } |
531 } |
493 } |
532 } |
494 |
533 |
495 if (IsSurfaceCreated() && iExtDisplayConnected && iExtDisplayHandler && (aCropRegion != prevCropRegion)) |
534 if (IsSurfaceCreated() && iSwitchedToExternalDisplay && (aCropRegion != prevCropRegion)) |
496 { |
535 { |
497 User::LeaveIfError(RedrawWindows(aCropRegion)); |
536 User::LeaveIfError(RedrawWindows(aCropRegion)); |
498 } |
537 } |
499 DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetAutoScaleL ---"); |
538 DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetAutoScaleL ---"); |
500 } |
539 } |
511 TInt count = iClientWindows.Count(); |
550 TInt count = iClientWindows.Count(); |
512 |
551 |
513 for (TInt i = 0; i < count; ++i) |
552 for (TInt i = 0; i < count; ++i) |
514 { |
553 { |
515 iClientWindows[i].iRotation = aRotation; |
554 iClientWindows[i].iRotation = aRotation; |
516 if (IsSurfaceCreated() && (!iExtDisplayConnected || !iExtDisplayHandler)) |
555 if (IsSurfaceCreated() && !iSwitchedToExternalDisplay) |
517 { |
556 { |
518 User::LeaveIfError(SetBackgroundSurface(iClientWindows[i], aCropRegion)); |
557 User::LeaveIfError(SetBackgroundSurface(iClientWindows[i], aCropRegion)); |
519 } |
558 } |
520 } |
559 } |
521 |
560 |
522 if (IsSurfaceCreated() && iExtDisplayConnected && iExtDisplayHandler && (aCropRegion != prevCropRegion)) |
561 if (IsSurfaceCreated() && iSwitchedToExternalDisplay && (aCropRegion != prevCropRegion)) |
523 { |
562 { |
524 User::LeaveIfError(RedrawWindows(aCropRegion)); |
563 User::LeaveIfError(RedrawWindows(aCropRegion)); |
525 } |
564 } |
526 |
565 |
527 DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetRotationL ---"); |
566 DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetRotationL ---"); |
545 for (TInt i = 0; i < count; ++i) |
584 for (TInt i = 0; i < count; ++i) |
546 { |
585 { |
547 iClientWindows[i].iScaleWidth = aWidthPercentage; |
586 iClientWindows[i].iScaleWidth = aWidthPercentage; |
548 iClientWindows[i].iScaleHeight = aHeightPercentage; |
587 iClientWindows[i].iScaleHeight = aHeightPercentage; |
549 iClientWindows[i].iAutoScaleType = EAutoScaleNone; |
588 iClientWindows[i].iAutoScaleType = EAutoScaleNone; |
550 if (IsSurfaceCreated() && (!iExtDisplayConnected || !iExtDisplayHandler)) |
589 if (IsSurfaceCreated() && !iSwitchedToExternalDisplay) |
551 { |
590 { |
552 User::LeaveIfError(SetBackgroundSurface(iClientWindows[i], aCropRegion)); |
591 User::LeaveIfError(SetBackgroundSurface(iClientWindows[i], aCropRegion)); |
553 } |
592 } |
554 } |
593 } |
555 |
594 |
556 if (IsSurfaceCreated() && iExtDisplayConnected && iExtDisplayHandler && (aCropRegion != prevCropRegion)) |
595 if (IsSurfaceCreated() && iSwitchedToExternalDisplay && (aCropRegion != prevCropRegion)) |
557 { |
596 { |
558 User::LeaveIfError(RedrawWindows(aCropRegion)); |
597 User::LeaveIfError(RedrawWindows(aCropRegion)); |
559 } |
598 } |
560 |
599 |
561 DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetScaleFactorL ---"); |
600 DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetScaleFactorL ---"); |
976 User::Leave(KErrNotReady); |
1015 User::Leave(KErrNotReady); |
977 } |
1016 } |
978 |
1017 |
979 if(iClientRequestedExtDisplaySwitching != aControl) |
1018 if(iClientRequestedExtDisplaySwitching != aControl) |
980 { |
1019 { |
981 iClientRequestedExtDisplaySwitching = aControl; |
1020 iClientRequestedExtDisplaySwitching = aControl; |
982 |
1021 SwitchSurface(); |
983 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SetExternalDisplaySwitchingL SurfaceCreated %d", IsSurfaceCreated()); |
|
984 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SetExternalDisplaySwitchingL Client window count %d", iClientWindows.Count()); |
|
985 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SetExternalDisplaySwitchingL External Display Connected %d", iExtDisplayConnected); |
|
986 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SetExternalDisplaySwitchingL Client Requested Ext Display Switching %d", iClientRequestedExtDisplaySwitching); |
|
987 |
|
988 if(IsSurfaceCreated() && (iClientWindows.Count() > 0) && iExtDisplayConnected) |
|
989 { |
|
990 if(iClientRequestedExtDisplaySwitching) |
|
991 { |
|
992 TRAPD(err, CreateExtDisplayHandlerL()); |
|
993 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SetExternalDisplaySwitchingL CreateExtDisplayHandlerL error %d", err); |
|
994 if(err == KErrNone) |
|
995 { |
|
996 RemoveBackgroundSurface(ETrue); |
|
997 SetWindowArrayPtr2Ext(); |
|
998 RedrawWindows(iCropRegion); |
|
999 } |
|
1000 } |
|
1001 else if(iExtDisplayHandler) |
|
1002 { |
|
1003 RemoveBackgroundSurface(ETrue); |
|
1004 RemoveExtDisplayHandler(); |
|
1005 SetWindowArrayPtr2Client(); |
|
1006 RedrawWindows(iCropRegion); |
|
1007 } |
|
1008 } |
|
1009 } |
1022 } |
1010 |
1023 |
1011 DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetExternalDisplaySwitchingL ---"); |
1024 DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetExternalDisplaySwitchingL ---"); |
1012 } |
1025 } |
1013 |
1026 |
1016 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::MedcpcExtDisplayNotifyConnected +++ aExtDisplayConnected=%d", aExtDisplayConnected); |
1029 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::MedcpcExtDisplayNotifyConnected +++ aExtDisplayConnected=%d", aExtDisplayConnected); |
1017 |
1030 |
1018 if(iExtDisplayConnected != aExtDisplayConnected) |
1031 if(iExtDisplayConnected != aExtDisplayConnected) |
1019 { |
1032 { |
1020 iExtDisplayConnected = aExtDisplayConnected; |
1033 iExtDisplayConnected = aExtDisplayConnected; |
1021 |
1034 SwitchSurface(); |
1022 if(IsSurfaceCreated() && (iClientWindows.Count() > 0) && iClientRequestedExtDisplaySwitching) |
|
1023 { |
|
1024 if(iExtDisplayConnected) |
|
1025 { |
|
1026 TRAPD(err, CreateExtDisplayHandlerL()); |
|
1027 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::MedcpcExtDisplayNotifyConnected CreateExtDisplayHandlerL error %d", err); |
|
1028 if(err == KErrNone) |
|
1029 { |
|
1030 RemoveBackgroundSurface(ETrue); |
|
1031 SetWindowArrayPtr2Ext(); |
|
1032 RedrawWindows(iCropRegion); |
|
1033 } |
|
1034 } |
|
1035 else if(iExtDisplayHandler) |
|
1036 { |
|
1037 RemoveBackgroundSurface(ETrue); |
|
1038 RemoveExtDisplayHandler(); |
|
1039 SetWindowArrayPtr2Client(); |
|
1040 RedrawWindows(iCropRegion); |
|
1041 } |
|
1042 } |
|
1043 } |
1035 } |
1044 else |
1036 else |
1045 { |
1037 { |
1046 DEBUG_PRINTF("CMediaClientVideoDisplayBody::MedcpcExtDisplayNotifyConnected No change in ext display connection status"); |
1038 DEBUG_PRINTF("CMediaClientVideoDisplayBody::MedcpcExtDisplayNotifyConnected No change in ext display connection status"); |
1047 } |
1039 } |
1052 void CMediaClientVideoDisplayBody::SetWindowArrayPtr2Client() |
1044 void CMediaClientVideoDisplayBody::SetWindowArrayPtr2Client() |
1053 { |
1045 { |
1054 DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetWindowArrayPtr2Client +++"); |
1046 DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetWindowArrayPtr2Client +++"); |
1055 |
1047 |
1056 iWindowsArrayPtr = &iClientWindows; |
1048 iWindowsArrayPtr = &iClientWindows; |
|
1049 iSwitchedToExternalDisplay = EFalse; |
1057 |
1050 |
1058 DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetWindowArrayPtr2Client ---"); |
1051 DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetWindowArrayPtr2Client ---"); |
1059 } |
1052 } |
1060 |
1053 |
1061 void CMediaClientVideoDisplayBody::SetWindowArrayPtr2Ext() |
1054 void CMediaClientVideoDisplayBody::SetWindowArrayPtr2Ext() |
1062 { |
1055 { |
1063 DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetWindowArrayPtr2Ext +++"); |
1056 DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetWindowArrayPtr2Ext +++"); |
1064 |
1057 |
1065 iWindowsArrayPtr = &iExtDisplayWindows; |
1058 iWindowsArrayPtr = &iExtDisplayWindows; |
|
1059 iSwitchedToExternalDisplay = ETrue; |
1066 |
1060 |
1067 DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetWindowArrayPtr2Ext ---"); |
1061 DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetWindowArrayPtr2Ext ---"); |
1068 } |
1062 } |
1069 |
1063 |
1070 void CMediaClientVideoDisplayBody::CreateExtDisplayHandlerL() |
1064 void CMediaClientVideoDisplayBody::CreateExtDisplayHandlerL() |
1134 iExtDisplaySwitchingSupported = EFalse; |
1128 iExtDisplaySwitchingSupported = EFalse; |
1135 iExtDisplayConnected = EFalse; |
1129 iExtDisplayConnected = EFalse; |
1136 } |
1130 } |
1137 DEBUG_PRINTF("CMediaClientVideoDisplayBody::RemoveExtDisplayPlugin ---"); |
1131 DEBUG_PRINTF("CMediaClientVideoDisplayBody::RemoveExtDisplayPlugin ---"); |
1138 } |
1132 } |
|
1133 |
|
1134 void CMediaClientVideoDisplayBody::MmcweoFocusWindowGroupChanged() |
|
1135 { |
|
1136 DEBUG_PRINTF("CMediaClientVideoDisplayBody::MweocFocusWindowGroupChanged +++"); |
|
1137 |
|
1138 TBool prevClientWindowIsInFocus = iClientWindowIsInFocus; |
|
1139 UpdateFocus(); |
|
1140 |
|
1141 if(prevClientWindowIsInFocus != iClientWindowIsInFocus) |
|
1142 { |
|
1143 SwitchSurface(); |
|
1144 } |
|
1145 |
|
1146 DEBUG_PRINTF("CMediaClientVideoDisplayBody::MweocFocusWindowGroupChanged ---"); |
|
1147 } |
|
1148 |
|
1149 TBool CMediaClientVideoDisplayBody::MmcweoIgnoreProcess(TSecureId aId) |
|
1150 { |
|
1151 DEBUG_PRINTF("CMediaClientVideoDisplayBody::MmcweoIgnoreProcess +++"); |
|
1152 |
|
1153 TBool ignore = ETrue; |
|
1154 if (iServerClient) |
|
1155 { |
|
1156 ignore = iServerClient->IgnoreProcess(aId); |
|
1157 } |
|
1158 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::MmcweoIgnoreProcess --- return %d", ignore); |
|
1159 return ignore; |
|
1160 } |
|
1161 |
|
1162 void CMediaClientVideoDisplayBody::UpdateFocus() |
|
1163 { |
|
1164 DEBUG_PRINTF("CMediaClientVideoDisplayBody::UpdateFocus +++"); |
|
1165 |
|
1166 if(!iWsEventObserver) |
|
1167 { |
|
1168 iClientWindowIsInFocus = ETrue; |
|
1169 DEBUG_PRINTF("CMediaClientVideoDisplayBody::UpdateFocus Event Observer is NULL"); |
|
1170 DEBUG_PRINTF("CMediaClientVideoDisplayBody::UpdateFocus ---"); |
|
1171 return; |
|
1172 } |
|
1173 |
|
1174 TBool prevClientWindowIsInFocus = iClientWindowIsInFocus; |
|
1175 |
|
1176 TInt focusGroupId; |
|
1177 if(iWsEventObserver->FocusWindowGroupId(focusGroupId) == KErrNone) |
|
1178 { |
|
1179 iClientWindowIsInFocus = EFalse; |
|
1180 TInt count = iClientWindows.Count(); |
|
1181 for(TInt i = 0; i < count; i++) |
|
1182 { |
|
1183 if(iClientWindows[i].iWindow->WindowGroupId() == focusGroupId) |
|
1184 { |
|
1185 iClientWindowIsInFocus = ETrue; |
|
1186 break; |
|
1187 } |
|
1188 } |
|
1189 } |
|
1190 else |
|
1191 { |
|
1192 DEBUG_PRINTF("CMediaClientVideoDisplayBody::UpdateFocus Error retrieving focus WgId from observer"); |
|
1193 iClientWindowIsInFocus = ETrue; |
|
1194 } |
|
1195 |
|
1196 if(iServerClient && (prevClientWindowIsInFocus != iClientWindowIsInFocus)) |
|
1197 { |
|
1198 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::MweocFocusWindowGroupChanged calling server, focus %d", iClientWindowIsInFocus); |
|
1199 iServerClient->FocusChanged(iClientWindowIsInFocus); |
|
1200 } |
|
1201 |
|
1202 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::UpdateFocus Client window in focus %d", iClientWindowIsInFocus); |
|
1203 DEBUG_PRINTF("CMediaClientVideoDisplayBody::UpdateFocus ---"); |
|
1204 } |
|
1205 |
|
1206 void CMediaClientVideoDisplayBody::SwitchSurface() |
|
1207 { |
|
1208 DEBUG_PRINTF("CMediaClientVideoDisplayBody::SwitchSurface +++"); |
|
1209 |
|
1210 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SwitchSurface SurfaceCreated %d", IsSurfaceCreated()); |
|
1211 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SwitchSurface Client window count %d", iClientWindows.Count()); |
|
1212 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SwitchSurface Client Requested Ext Display Switching %d", iClientRequestedExtDisplaySwitching); |
|
1213 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SwitchSurface Client Window in Focus %d", iClientWindowIsInFocus); |
|
1214 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SwitchSurface External Display Connected %d", iExtDisplayConnected); |
|
1215 |
|
1216 if(IsSurfaceCreated() && (iClientWindows.Count() > 0) && iClientRequestedExtDisplaySwitching && |
|
1217 iClientWindowIsInFocus && iExtDisplayConnected) |
|
1218 { |
|
1219 TRAPD(err, CreateExtDisplayHandlerL()); |
|
1220 DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SwitchSurface CreateExtDisplayHandlerL error %d", err); |
|
1221 if(err == KErrNone) |
|
1222 { |
|
1223 RemoveBackgroundSurface(ETrue); |
|
1224 SetWindowArrayPtr2Ext(); |
|
1225 RedrawWindows(iCropRegion); |
|
1226 } |
|
1227 } |
|
1228 else if(iSwitchedToExternalDisplay) |
|
1229 { |
|
1230 RemoveBackgroundSurface(ETrue); |
|
1231 RemoveExtDisplayHandler(); |
|
1232 SetWindowArrayPtr2Client(); |
|
1233 RedrawWindows(iCropRegion); |
|
1234 } |
|
1235 |
|
1236 DEBUG_PRINTF("CMediaClientVideoDisplayBody::SwitchSurface ---"); |
|
1237 } |