|
1 /* |
|
2 * Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0"" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Implementation for peninput server application UI |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "peninputserverappui.h" |
|
22 #include <peninputserver.rsg> |
|
23 #include <AknDef.h> |
|
24 #include <avkon.hrh> |
|
25 #include <apgwgnam.h> |
|
26 #include "peninputserver.h" |
|
27 #include "peninputclientserver.h" |
|
28 #include "peninputserverapp.h" |
|
29 #include <eiktbar.h> |
|
30 #include <AknSgcc.h> |
|
31 #include <AknsUtils.h> |
|
32 #include <peninputcmd.h> |
|
33 |
|
34 const TInt KPenInputServerReady = ESignalServerReady; |
|
35 //global function |
|
36 //Hide window gropu |
|
37 void HideWindowGroupL(const RWsSession& aWs,const RWindowGroup& aGroup) |
|
38 { |
|
39 CApaWindowGroupName* wg = CApaWindowGroupName::NewLC(aWs, |
|
40 aGroup.Identifier()); |
|
41 wg->SetHidden(ETrue); |
|
42 wg->SetSystem(ETrue); |
|
43 wg->SetWindowGroupName(const_cast<RWindowGroup&>(aGroup)); |
|
44 CleanupStack::PopAndDestroy(wg); |
|
45 } |
|
46 // ================= MEMBER FUNCTIONS ======================= |
|
47 // |
|
48 // --------------------------------------------------------------------------- |
|
49 // CPeninputServerAppUi::ConstructL() |
|
50 // --------------------------------------------------------------------------- |
|
51 // |
|
52 void CPeninputServerAppUi::ConstructL() |
|
53 { |
|
54 SetFullScreenApp( EFalse ); |
|
55 //BaseConstructL(/*ENoAppResourceFile|ENoScreenFurniture*/EAknEnableSkin); |
|
56 //StatusPane()->MakeVisible(EFalse); |
|
57 BaseConstructL(ENoAppResourceFile|ENoScreenFurniture); |
|
58 //RAknUiServer* client = CAknSgcClient::AknSrv(); |
|
59 //client->HideApplicationFromFsw(ETrue,KUidPeninputserver.iUid); |
|
60 CEikonEnv::Static()->SetSystem(ETrue); |
|
61 HideApplicationFromFSW( ETrue ); |
|
62 //new pen input server |
|
63 iPeninputServer = CPeninputServer::NewL(); |
|
64 |
|
65 // naming the server thread after the server helps to debug panics |
|
66 User::LeaveIfError( RThread().RenameMe( KPeninputServerName ) ); |
|
67 iIdle = CIdle::NewL(CActive::EPriorityIdle ); |
|
68 iIdle ->Start(TCallBack(BackgroundTaskL,this)); |
|
69 //RProcess::Rendezvous(KErrNone); |
|
70 RProcess::Rendezvous(KPenInputServerReady); |
|
71 RProcess proc; |
|
72 proc.SetPriority(EPriorityHigh); |
|
73 RWindowGroup& rootWin = CCoeEnv::Static()->RootWin(); |
|
74 rootWin.SetOrdinalPosition(-1,-1); |
|
75 rootWin.EnableReceiptOfFocus(EFalse); |
|
76 |
|
77 // to make sure that wserv does not change our priority even we lose foreground |
|
78 iEikonEnv->WsSession().ComputeMode(RWsSession::EPriorityControlDisabled); |
|
79 AknsUtils::SetAvkonSkinEnabledL(ETrue); |
|
80 } |
|
81 |
|
82 // --------------------------------------------------------------------------- |
|
83 // CPeninputServerAppUi::~CPeninputServerAppUi() |
|
84 // Destructor |
|
85 // Frees reserved resources |
|
86 // --------------------------------------------------------------------------- |
|
87 // |
|
88 CPeninputServerAppUi::~CPeninputServerAppUi() |
|
89 { |
|
90 delete iPeninputServer; |
|
91 delete iIdle; |
|
92 } |
|
93 |
|
94 // --------------------------------------------------------------------------- |
|
95 // CPeninputServerAppUi::BackgroundConstructL |
|
96 // Do background construct. |
|
97 // --------------------------------------------------------------------------- |
|
98 // |
|
99 TInt CPeninputServerAppUi::BackgroundTaskL(TAny* aPtr) |
|
100 { |
|
101 CPeninputServerAppUi* self = static_cast<CPeninputServerAppUi*>(aPtr); |
|
102 self->DoBackgroundTaskL(); |
|
103 return EFalse; // only run once |
|
104 } |
|
105 |
|
106 // --------------------------------------------------------------------------- |
|
107 // CPeninputServerAppUi::DoBackgroundTaskL |
|
108 // Hide window group. |
|
109 // --------------------------------------------------------------------------- |
|
110 // |
|
111 void CPeninputServerAppUi::DoBackgroundTaskL() |
|
112 { |
|
113 //hide application from task list. |
|
114 //HideWindowGroupL(CCoeEnv::Static()->WsSession(),CCoeEnv::Static()->RootWin()); |
|
115 //let pen input server do the idle consruction |
|
116 iPeninputServer->DoIdleConstructL(); |
|
117 } |
|
118 |
|
119 // --------------------------------------------------------------------------- |
|
120 // CPeninputServerAppUi::HandleResourceChangeL |
|
121 // Handle system resource change |
|
122 // --------------------------------------------------------------------------- |
|
123 // |
|
124 void CPeninputServerAppUi::HandleResourceChangeL(TInt aType) |
|
125 { |
|
126 CAknAppUi::HandleResourceChangeL(aType); |
|
127 if(iPeninputServer) |
|
128 iPeninputServer->HandleResourceChange(aType); |
|
129 } |
|
130 |
|
131 void CPeninputServerAppUi::HandleWsEventL(const TWsEvent &aEvent, CCoeControl *aDestination) |
|
132 { |
|
133 if(iPeninputServer) |
|
134 { |
|
135 iPeninputServer->HandleWsEventL(aEvent,aDestination); |
|
136 } |
|
137 CAknAppUi::HandleWsEventL(aEvent, aDestination); |
|
138 } |
|
139 |
|
140 void CPeninputServerAppUi::HandleCommandL(TInt aCommand) |
|
141 { |
|
142 if(EEikCmdExit == aCommand) |
|
143 { |
|
144 iPeninputServer->PrepareExit(); |
|
145 Exit(); |
|
146 } |
|
147 else |
|
148 CAknAppUi::HandleCommandL(aCommand); |
|
149 } |
|
150 |
|
151 // End of File |