|
1 // Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "mediaclientextdisplayhandler.h" |
|
17 #include "mediaclientvideotrace.h" |
|
18 |
|
19 CMediaClientExtDisplayHandler* CMediaClientExtDisplayHandler::NewL(TInt aDisplayId) |
|
20 { |
|
21 DEBUG_PRINTF("CMediaClientExtDisplayHandler::NewL +++"); |
|
22 CMediaClientExtDisplayHandler* self = new (ELeave) CMediaClientExtDisplayHandler(aDisplayId); |
|
23 CleanupStack::PushL(self); |
|
24 self->ConstructL(); |
|
25 CleanupStack::Pop(self); |
|
26 DEBUG_PRINTF("CMediaClientExtDisplayHandler::NewL ---"); |
|
27 return self; |
|
28 } |
|
29 |
|
30 CMediaClientExtDisplayHandler::CMediaClientExtDisplayHandler(TInt aDisplayId) |
|
31 : iDisplayId(aDisplayId) |
|
32 { |
|
33 DEBUG_PRINTF("CMediaClientExtDisplayHandler::CMediaClientExtDisplayHandler +++"); |
|
34 DEBUG_PRINTF("CMediaClientExtDisplayHandler::CMediaClientExtDisplayHandler ---"); |
|
35 } |
|
36 |
|
37 void CMediaClientExtDisplayHandler::ConstructL() |
|
38 { |
|
39 DEBUG_PRINTF("CMediaClientExtDisplayHandler::ConstructL +++"); |
|
40 |
|
41 DEBUG_PRINTF("CMediaClientExtDisplayHandler::ConstructL RWsSession Connect"); |
|
42 TInt err = iWs.Connect(); |
|
43 if (err != KErrNone) |
|
44 { |
|
45 DEBUG_PRINTF("CMediaClientExtDisplayHandler::ConstructL Windows Server unavailable"); |
|
46 User::Leave(err); |
|
47 } |
|
48 |
|
49 DEBUG_PRINTF("CMediaClientExtDisplayHandler::ConstructL CWsScreenDevice Create"); |
|
50 iScreen = new (ELeave) CWsScreenDevice(iWs); |
|
51 User::LeaveIfError(iScreen->Construct(iDisplayId)); |
|
52 |
|
53 DEBUG_PRINTF("CMediaClientExtDisplayHandler::ConstructL RWindowGroup Create"); |
|
54 iRootWindow = RWindowGroup(iWs); |
|
55 User::LeaveIfError(iRootWindow.Construct((TUint32)this, ETrue)); |
|
56 |
|
57 DEBUG_PRINTF("CMediaClientExtDisplayHandler::ConstructL RWindow Create"); |
|
58 iExternalDisplayWindow = RWindow(iWs); |
|
59 User::LeaveIfError(iExternalDisplayWindow.Construct(iRootWindow,((TUint32)(this)) + 1)); |
|
60 DEBUG_PRINTF2("CMediaClientExtDisplayHandler::ConstructL - iExternalDisplayWindow WsHandle 0x%X", iExternalDisplayWindow.WsHandle()); |
|
61 |
|
62 DEBUG_PRINTF("CMediaClientExtDisplayHandler::ConstructL Setup external window"); |
|
63 iExternalDisplayWindow.SetExtent(TPoint(0,0), iScreen->SizeInPixels()); |
|
64 iExternalDisplayWindow.SetVisible(ETrue); |
|
65 iExternalDisplayWindow.Activate(); |
|
66 iWs.Flush(); |
|
67 |
|
68 DEBUG_PRINTF("CMediaClientExtDisplayHandler::ConstructL ---"); |
|
69 } |
|
70 |
|
71 CMediaClientExtDisplayHandler::~CMediaClientExtDisplayHandler() |
|
72 { |
|
73 DEBUG_PRINTF("CMediaClientExtDisplayHandler::~CMediaClientExtDisplayHandler +++"); |
|
74 |
|
75 iExternalDisplayWindow.Close(); |
|
76 iRootWindow.Close(); |
|
77 delete iScreen; |
|
78 iScreen = NULL; |
|
79 iWs.Close(); |
|
80 |
|
81 DEBUG_PRINTF("CMediaClientExtDisplayHandler::~CMediaClientExtDisplayHandler ---"); |
|
82 } |
|
83 |
|
84 RWindowBase* CMediaClientExtDisplayHandler::Window() |
|
85 { |
|
86 DEBUG_PRINTF("CMediaClientExtDisplayHandler::Window +++"); |
|
87 DEBUG_PRINTF("CMediaClientExtDisplayHandler::Window ---"); |
|
88 return &iExternalDisplayWindow; |
|
89 } |
|
90 |
|
91 TSize CMediaClientExtDisplayHandler::DisplaySizeInPixels() |
|
92 { |
|
93 DEBUG_PRINTF("CMediaClientExtDisplayHandler::DisplaySizeInPixels +++"); |
|
94 DEBUG_PRINTF("CMediaClientExtDisplayHandler::DisplaySizeInPixels ---"); |
|
95 return iScreen->SizeInPixels(); |
|
96 } |