0
|
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_PRINTF2("CMediaClientExtDisplayHandler::ConstructL RWindowGroupId %d", iRootWindow.WindowGroupId());
|
|
58 |
|
|
59 |
DEBUG_PRINTF("CMediaClientExtDisplayHandler::ConstructL RWindow Create");
|
|
60 |
iExternalDisplayWindow = RWindow(iWs);
|
|
61 |
User::LeaveIfError(iExternalDisplayWindow.Construct(iRootWindow,((TUint32)(this)) + 1));
|
|
62 |
DEBUG_PRINTF2("CMediaClientExtDisplayHandler::ConstructL - iExternalDisplayWindow WsHandle 0x%X", iExternalDisplayWindow.WsHandle());
|
|
63 |
|
|
64 |
DEBUG_PRINTF("CMediaClientExtDisplayHandler::ConstructL Setup external window");
|
|
65 |
iExternalDisplayWindow.SetExtent(TPoint(0,0), iScreen->SizeInPixels());
|
|
66 |
iExternalDisplayWindow.SetVisible(ETrue);
|
|
67 |
iExternalDisplayWindow.Activate();
|
|
68 |
iWs.Flush();
|
|
69 |
|
|
70 |
DEBUG_PRINTF("CMediaClientExtDisplayHandler::ConstructL ---");
|
|
71 |
}
|
|
72 |
|
|
73 |
CMediaClientExtDisplayHandler::~CMediaClientExtDisplayHandler()
|
|
74 |
{
|
|
75 |
DEBUG_PRINTF("CMediaClientExtDisplayHandler::~CMediaClientExtDisplayHandler +++");
|
|
76 |
|
|
77 |
iExternalDisplayWindow.Close();
|
|
78 |
iRootWindow.Close();
|
|
79 |
delete iScreen;
|
|
80 |
iScreen = NULL;
|
|
81 |
iWs.Close();
|
|
82 |
|
|
83 |
DEBUG_PRINTF("CMediaClientExtDisplayHandler::~CMediaClientExtDisplayHandler ---");
|
|
84 |
}
|
|
85 |
|
|
86 |
RWindowBase* CMediaClientExtDisplayHandler::Window()
|
|
87 |
{
|
|
88 |
DEBUG_PRINTF("CMediaClientExtDisplayHandler::Window +++");
|
|
89 |
DEBUG_PRINTF("CMediaClientExtDisplayHandler::Window ---");
|
|
90 |
return &iExternalDisplayWindow;
|
|
91 |
}
|
|
92 |
|
|
93 |
TSize CMediaClientExtDisplayHandler::DisplaySizeInPixels()
|
|
94 |
{
|
|
95 |
DEBUG_PRINTF("CMediaClientExtDisplayHandler::DisplaySizeInPixels +++");
|
|
96 |
DEBUG_PRINTF("CMediaClientExtDisplayHandler::DisplaySizeInPixels ---");
|
|
97 |
return iScreen->SizeInPixels();
|
|
98 |
}
|
|
99 |
|
|
100 |
void CMediaClientExtDisplayHandler::UpdateWindow()
|
|
101 |
{
|
|
102 |
DEBUG_PRINTF("CMediaClientExtDisplayHandler::UpdateWindow +++");
|
|
103 |
iExternalDisplayWindow.SetExtent(TPoint(0,0), iScreen->SizeInPixels());
|
|
104 |
DEBUG_PRINTF("CMediaClientExtDisplayHandler::UpdateWindow ---");
|
|
105 |
}
|