|
1 /* |
|
2 * Copyright (c) 2002-2008 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: Displays single startup screen. Animation not supported. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // SYSTEM INCLUDES |
|
20 #include <w32std.h> |
|
21 #include <coedef.h> |
|
22 #include <data_caging_path_literals.hrh> |
|
23 #include <splashscreen.mbg> |
|
24 #include <AknIconSrvClient.h> |
|
25 #include <startupdomainpskeys.h> |
|
26 |
|
27 // USER INCLUDES |
|
28 #include "SplashScreen.h" |
|
29 #include "SplashScreenDefines.h" |
|
30 |
|
31 |
|
32 // ==================== LOCAL FUNCTIONS ==================== |
|
33 LOCAL_C void DoItL(); |
|
34 |
|
35 GLDEF_C TInt E32Main() |
|
36 { |
|
37 TRACES("E32Main(): Start"); |
|
38 |
|
39 __UHEAP_MARK; |
|
40 CTrapCleanup* cleanup=CTrapCleanup::New(); // get clean-up stack |
|
41 |
|
42 TRAPD(error,DoItL()); // more initialization, then do Splash |
|
43 __ASSERT_ALWAYS(!error,User::Panic(KPanicMsg,error)); |
|
44 delete cleanup; // destroy clean-up stack |
|
45 __UHEAP_MARKEND; // check no memory leak |
|
46 TRACES("E32Main(): End"); |
|
47 return KErrNone; |
|
48 } |
|
49 |
|
50 // 120 seconds (the splash should have been killed |
|
51 // by the Starter before this runs out) |
|
52 const TInt KSplashTimeout=(2* 60 * 1000000); |
|
53 |
|
54 |
|
55 /////////////////////////////////////////////////////////////////////////////// |
|
56 ////////////////////////// CWindow implementation ///////////////////////////// |
|
57 /////////////////////////////////////////////////////////////////////////////// |
|
58 |
|
59 CWindow::CWindow(CWsClient* aClient) |
|
60 : iClient(aClient) |
|
61 { |
|
62 TRACES("CWindow::CWindow()"); |
|
63 } |
|
64 |
|
65 void CWindow::ConstructL (const TRect& aRect, CWindow* aParent) |
|
66 { |
|
67 TRACES("CWindow::ConstructL(): Start"); |
|
68 |
|
69 // If a parent window was specified, use it; if not, use the window group |
|
70 // (aParent defaults to 0). |
|
71 RWindowTreeNode* parent= aParent ? (RWindowTreeNode*) &(aParent->Window()) : &(iClient->iGroup); |
|
72 iWindow=RWindow(iClient->iWs); // use app's session to window server |
|
73 User::LeaveIfError(iWindow.Construct(*parent,(TUint32)this)); |
|
74 TRACES1("CWindow::ConstructL(): Start - window handle is: 0x%08x", this); |
|
75 iRect = aRect; |
|
76 iWindow.SetExtent(iRect.iTl, iRect.Size()); // set extent relative to group coords |
|
77 iWindow.Activate(); // window is now active |
|
78 TRACES("CWindow::ConstructL(): End"); |
|
79 } |
|
80 |
|
81 |
|
82 CWindow::~CWindow() |
|
83 { |
|
84 TRACES("CWindow::~CWindow(): Start"); |
|
85 iWindow.Close(); // close our window |
|
86 TRACES("CWindow::~CWindow(): End"); |
|
87 } |
|
88 |
|
89 RWindow& CWindow::Window() |
|
90 { |
|
91 TRACES("CWindow::Window()"); |
|
92 return iWindow; |
|
93 } |
|
94 |
|
95 CWindowGc* CWindow::SystemGc() |
|
96 { |
|
97 TRACES("CWindow::SystemGc()"); |
|
98 return iClient->iGc; |
|
99 } |
|
100 |
|
101 |
|
102 /////////////////////////////////////////////////////////////////////////////// |
|
103 ////////////////////////// CWsRedrawer implementation ///////////////////////// |
|
104 /////////////////////////////////////////////////////////////////////////////// |
|
105 |
|
106 CWsRedrawer::CWsRedrawer() |
|
107 : CActive(CActive::EPriorityLow) |
|
108 { |
|
109 TRACES("CWsRedrawer::CWsRedrawer()"); |
|
110 } |
|
111 |
|
112 void CWsRedrawer::ConstructL(CWsClient* aClient) |
|
113 { |
|
114 TRACES("CWsRedrawer::ConstructL(): Start"); |
|
115 iClient=aClient; // remember WsClient that owns us |
|
116 CActiveScheduler::Add(this); // add ourselves to the scheduler |
|
117 IssueRequest(); // issue request to draw |
|
118 TRACES("CWsRedrawer::ConstructL(): End"); |
|
119 } |
|
120 |
|
121 CWsRedrawer::~CWsRedrawer() |
|
122 { |
|
123 TRACES("CWsRedrawer::~CWsRedrawer(): Start"); |
|
124 Cancel(); |
|
125 TRACES("CWsRedrawer::~CWsRedrawer(): End"); |
|
126 } |
|
127 |
|
128 void CWsRedrawer::IssueRequest() |
|
129 { |
|
130 TRACES("CWsRedrawer::IssueRequest(): Start"); |
|
131 iClient->iWs.RedrawReady(&iStatus); |
|
132 SetActive(); |
|
133 TRACES("CWsRedrawer::IssueRequest(): End"); |
|
134 } |
|
135 |
|
136 void CWsRedrawer::DoCancel() |
|
137 { |
|
138 TRACES("CWsRedrawer::DoCancel(): Start"); |
|
139 iClient->iWs.RedrawReadyCancel(); |
|
140 TRACES("CWsRedrawer::DoCancel(): End"); |
|
141 } |
|
142 |
|
143 void CWsRedrawer::RunL() |
|
144 { |
|
145 TRACES("CWsRedrawer::RunL(): Start"); |
|
146 |
|
147 // find out what must be done |
|
148 TWsRedrawEvent redrawEvent; |
|
149 iClient->iWs.GetRedraw(redrawEvent); // get event |
|
150 CWindow* window=(CWindow*)(redrawEvent.Handle()); // get window |
|
151 if (window) |
|
152 { |
|
153 TRACES1("CWsRedrawer::RunL(): window - 0x%08x", window); |
|
154 TRect rect=redrawEvent.Rect(); // and rectangle that needs redrawing |
|
155 // now do drawing |
|
156 iClient->iGc->Activate(window->Window()); |
|
157 window->Window().BeginRedraw(rect); |
|
158 window->Draw(rect); |
|
159 window->Window().EndRedraw(); |
|
160 iClient->iGc->Deactivate(); |
|
161 } |
|
162 // maintain outstanding request |
|
163 IssueRequest(); |
|
164 TRACES("CWsRedrawer::RunL(): End"); |
|
165 } |
|
166 |
|
167 CTimeout::CTimeout() |
|
168 : CTimer(0) |
|
169 { |
|
170 TRACES("CTimeout::CTimeout()"); |
|
171 CActiveScheduler::Add(this); |
|
172 } |
|
173 |
|
174 void CTimeout::ConstructL(CMainWindow* aWindow) |
|
175 { |
|
176 TRACES("CTimeout::ConstructL(): Start"); |
|
177 CTimer::ConstructL(); |
|
178 SetMainWindow( aWindow ); |
|
179 TRACES("CTimeout::ConstructL(): End"); |
|
180 } |
|
181 |
|
182 void CTimeout::SetMainWindow( CMainWindow* aWindow ) |
|
183 { |
|
184 iWindow = aWindow; |
|
185 } |
|
186 |
|
187 void CTimeout::RunL() |
|
188 { |
|
189 TRACES("CTimeout::RunL(): Start"); |
|
190 CActiveScheduler::Stop(); |
|
191 if ( iWindow ) |
|
192 { |
|
193 iWindow ->Client()->Group().SetOrdinalPosition(0,ECoeWinPriorityNeverAtFront); // Background - so it's no more visible |
|
194 } |
|
195 TRACES("CTimeout::RunL(): End"); |
|
196 } |
|
197 |
|
198 |
|
199 ///////////////////////////////////////////////////////////////////////////////////// |
|
200 /////////////////////////// CWsClient implementation //////////////////////////////// |
|
201 ///////////////////////////////////////////////////////////////////////////////////// |
|
202 CWsClient::CWsClient() |
|
203 : CActive(CActive::EPriorityStandard), |
|
204 iPSRemoveSplashState( ESplashRunning ) |
|
205 { |
|
206 TRACES("CWsClient::CWsClient()"); |
|
207 } |
|
208 |
|
209 void CWsClient::ConstructL() |
|
210 { |
|
211 TRACES("CWsClient::ConstructL(): Start"); |
|
212 |
|
213 RProperty::Define(KPSUidStartup, |
|
214 KPSSplashShutdown, |
|
215 RProperty::EInt, |
|
216 KReadPolicy, |
|
217 KWritePolicy ); |
|
218 RProperty::Set( KPSUidStartup, KPSSplashShutdown, iPSRemoveSplashState ); |
|
219 CActiveScheduler::Install(new (ELeave) CActiveScheduler); |
|
220 CActiveScheduler::Add(this); |
|
221 iProperty.Attach( KPSUidStartup, KPSSplashShutdown ); |
|
222 iProperty.Subscribe( iStatus ); |
|
223 |
|
224 // get a session going |
|
225 User::LeaveIfError(iWs.Connect()); |
|
226 |
|
227 // construct screen device and graphics context |
|
228 iScreen=new (ELeave) CWsScreenDevice(iWs); // make device for this session |
|
229 User::LeaveIfError(iScreen->Construct( 0 )); // and complete its construction |
|
230 User::LeaveIfError(iScreen->CreateContext(iGc)); // create graphics context |
|
231 iLastScreenMode = iScreen->CurrentScreenMode(); |
|
232 TRACES1("CWsClient::ConstructL() - iLastScreenMode: %d", iLastScreenMode); |
|
233 |
|
234 // construct our one and only window group |
|
235 iGroup=RWindowGroup(iWs); |
|
236 User::LeaveIfError(iGroup.Construct( (TInt) this,ETrue)); // meaningless handle; enable focus |
|
237 // Set our name for sending commands via key-events |
|
238 iGroup.SetName(KSplashScreenWindowGroup); |
|
239 |
|
240 TInt error = iGroup.EnableScreenChangeEvents(); |
|
241 TRACES1("CWsClient::ConstructL() - enable screen change events: %d", error); |
|
242 |
|
243 // construct redrawer |
|
244 iRedrawer=new (ELeave) CWsRedrawer; |
|
245 iRedrawer->ConstructL(this); |
|
246 User::LeaveIfError( RAknIconSrvClient::Connect() ); |
|
247 // construct main window |
|
248 ConstructMainWindowL(); |
|
249 |
|
250 iWs.EventReady(&iStatus); // request an event |
|
251 SetActive(); // so we're now active |
|
252 // request first event and start scheduler |
|
253 |
|
254 TRACES("CWsClient::ConstructL(): About to start CActiveScheduler"); |
|
255 |
|
256 CActiveScheduler::Start(); // start the active scheduler |
|
257 |
|
258 TRACES("CWsClient::CWsClient(): End"); |
|
259 } |
|
260 |
|
261 CWsClient::~CWsClient() |
|
262 { |
|
263 TRACES("CWsClient::~CWsClient(): Start"); |
|
264 RAknIconSrvClient::Disconnect(); |
|
265 // neutralize us as an active object |
|
266 Deque(); // cancels and removes from scheduler |
|
267 // get rid of scheduler and all attached objects |
|
268 delete CActiveScheduler::Current(); // delete the scheduler |
|
269 // get rid of everything we allocated |
|
270 delete iGc; |
|
271 delete iScreen; |
|
272 delete iRedrawer; |
|
273 // destroy window group |
|
274 iGroup.Close(); |
|
275 // finish with window server |
|
276 Cancel(); |
|
277 iProperty.Close(); |
|
278 iWs.Close(); |
|
279 TRACES("CWsClient::~CWsClient(): End"); |
|
280 } |
|
281 |
|
282 void CWsClient::Exit() |
|
283 { |
|
284 TRACES("CWsClient::Exit(): Start"); |
|
285 CActiveScheduler::Stop(); |
|
286 TRACES("CWsClient::Exit(): End"); |
|
287 } |
|
288 |
|
289 void CWsClient::IssueRequest() |
|
290 { |
|
291 TRACES("CWsClient::IssueRequest(): Start"); |
|
292 iWs.EventReady(&iStatus); // request an event |
|
293 SetActive(); // so we're now active |
|
294 TRACES("CWsClient::IssueRequest(): End"); |
|
295 } |
|
296 |
|
297 void CWsClient::DoCancel() |
|
298 { |
|
299 TRACES("CWsClient::DoCancel(): Start"); |
|
300 iWs.EventReadyCancel(); // cancel event request |
|
301 TRACES("CWsClient::DoCancel(): End"); |
|
302 } |
|
303 |
|
304 void CWsClient::ConstructMainWindowL() |
|
305 { |
|
306 TRACES("CWsClient::ConstructMainWindowL()"); |
|
307 } |
|
308 |
|
309 |
|
310 |
|
311 ////////////////////////////////////////////////////////////////////////////// |
|
312 // Implementation for derived window classes |
|
313 ////////////////////////////////////////////////////////////////////////////// |
|
314 |
|
315 ////////////////////////////////////////////////////////////////////////////// |
|
316 // CMainWindow implementation // |
|
317 ////////////////////////////////////////////////////////////////////////////// |
|
318 |
|
319 /****************************************************************************\ |
|
320 | Function: Constructor/Destructor for CMainWindow |
|
321 | Doesn't do much, as most initialisation is done by the |
|
322 | CWindow base class. |
|
323 | Input: aClient Client application that owns the window |
|
324 \****************************************************************************/ |
|
325 CMainWindow::CMainWindow (CWsClient* aClient) |
|
326 : CWindow (aClient) |
|
327 { |
|
328 TRACES("CMainWindow::CMainWindow()"); |
|
329 } |
|
330 |
|
331 |
|
332 CMainWindow::~CMainWindow () |
|
333 { |
|
334 TRACES("CMainWindow::~CMainWindow(): Start"); |
|
335 delete iBitmap; |
|
336 TRACES("CMainWindow::~CMainWindow(): End"); |
|
337 } |
|
338 |
|
339 void CMainWindow::ConstructL (const TRect& aRect, CWindow* aParent) |
|
340 { |
|
341 TRACES("CMainWindow::ConstructL(): Start"); |
|
342 |
|
343 TInt err( KErrNone ); |
|
344 |
|
345 CWindow::ConstructL(aRect, aParent); |
|
346 |
|
347 TParse* fp = new(ELeave) TParse(); |
|
348 fp->Set(KSplashBitmapName, &KDC_APP_BITMAP_DIR, NULL); |
|
349 TRACES1("CMainWindow::ConstructL(): Load Bitmap from %S", &fp->FullName()); |
|
350 |
|
351 RFs fs; |
|
352 TInt thisTry = 0; |
|
353 while ( ( err = fs.Connect() ) != KErrNone && ( thisTry++ ) <= KTriesToConnectServer ) |
|
354 { |
|
355 User::After( KTimeBeforeRetryingServerConnection ); |
|
356 } |
|
357 |
|
358 TFindFile findFile( fs ); |
|
359 err = findFile.FindByPath( fp->FullName(), NULL ); |
|
360 fs.Close(); |
|
361 if ( !err ) |
|
362 { |
|
363 TRACES("CMainWindow::ConstructL(): Image found"); |
|
364 iBitmap = AknIconUtils::CreateIconL( fp->FullName(), EMbmSplashscreenQgn_startup_screen ); |
|
365 AknIconUtils::ExcludeFromCache(iBitmap); |
|
366 AknIconUtils::SetSize( iBitmap, iRect.Size(), EAspectRatioPreservedAndUnusedSpaceRemoved ); |
|
367 } |
|
368 else |
|
369 { |
|
370 TRACES("CMainWindow::ConstructL(): Image not found"); |
|
371 } |
|
372 |
|
373 delete fp; |
|
374 |
|
375 TRACES("CMainWindow::ConstructL(): End"); |
|
376 } |
|
377 |
|
378 |
|
379 /****************************************************************************\ |
|
380 | Function: CMainWindow::Draw |
|
381 | Purpose: Redraws the contents of CMainWindow within a given |
|
382 | rectangle. As CMainWindow has no contents, it simply |
|
383 | clears the redraw area. A blank window could be used here |
|
384 | instead. The Clear() is needed because a redraw should |
|
385 | always draw to every pixel in the redraw rectangle. |
|
386 | Input: aRect Rectangle that needs redrawing |
|
387 | Output: None |
|
388 \****************************************************************************/ |
|
389 void CMainWindow::Draw(const TRect& aRect) |
|
390 { |
|
391 TRACES("CMainWindow::Draw(): Start"); |
|
392 |
|
393 CWindowGc* gc=SystemGc(); // get a gc |
|
394 gc->SetClippingRect(aRect); // clip outside this rect |
|
395 TRACES2("CMainWindow::Draw(): Rect: X0=%d Y0=%d", aRect.iTl.iX, aRect.iTl.iY); |
|
396 TRACES2("CMainWindow::Draw(): Rect: X1=%d Y1=%d", aRect.iBr.iX, aRect.iBr.iY); |
|
397 |
|
398 TRACES1("CMainWindow::Draw(): iBitmap = %d", iBitmap); |
|
399 if (iBitmap) |
|
400 { |
|
401 TSize bmpSizeInPixels = iBitmap->SizeInPixels(); |
|
402 //center image to the center of the screen |
|
403 TInt xDelta = ( aRect.Width() - bmpSizeInPixels.iWidth ) / 2; |
|
404 TInt yDelta = ( aRect.Height() - bmpSizeInPixels.iHeight ) / 2; |
|
405 TPoint pos = TPoint( xDelta , yDelta ); // displacement vector |
|
406 TRACES2("CMainWindow::Draw(): Image top left corner: X=%d Y=%d", pos.iX, pos.iY); |
|
407 gc->Clear(); |
|
408 gc->BitBlt(pos, iBitmap); |
|
409 } |
|
410 else |
|
411 { |
|
412 TRACES("CMainWindow::Draw(): Image not available. Draw lines from corner to corner"); |
|
413 TRect rect(Window().Position(), Window().Size()); |
|
414 gc->DrawLine(rect.iTl, rect.iBr); |
|
415 gc->DrawLine(TPoint(rect.iTl.iX, rect.iBr.iY), TPoint(rect.iBr.iX, rect.iTl.iY)); |
|
416 } |
|
417 TRACES("CMainWindow::Draw(): End"); |
|
418 } |
|
419 |
|
420 /****************************************************************************\ |
|
421 | Function: CMainWindow::HandlePointerEvent |
|
422 | Purpose: Handles pointer events for CMainWindow. Doesn't do |
|
423 | anything except get the co-ordinates where the pointer |
|
424 | event occurred. |
|
425 | Input: aPointerEvent The pointer event |
|
426 | Output: None |
|
427 \****************************************************************************/ |
|
428 void CMainWindow::HandlePointerEvent (TPointerEvent& /*aPointerEvent*/) |
|
429 { |
|
430 TRACES("CMainWindow::HandlePointerEvent(): Start"); |
|
431 // TPoint point = aPointerEvent.iPosition; |
|
432 // (void)point; |
|
433 TRACES("CMainWindow::HandlePointerEvent(): End"); |
|
434 } |
|
435 |
|
436 ////////////////////////////////////////////////////////////////////////////// |
|
437 // CSplashWsClient implementation // |
|
438 ////////////////////////////////////////////////////////////////////////////// |
|
439 |
|
440 /****************************************************************************\ |
|
441 | Function: Constructor/Destructor for CSplashWsClient |
|
442 | Destructor deletes everything that was allocated by |
|
443 | ConstructMainWindowL() |
|
444 \****************************************************************************/ |
|
445 CSplashWsClient::CSplashWsClient() |
|
446 { |
|
447 TRACES("CSplashWsClient::CSplashWsClient()"); |
|
448 } |
|
449 |
|
450 CSplashWsClient::~CSplashWsClient () |
|
451 { |
|
452 TRACES("CSplashWsClient::~CSplashWsClient(): Start"); |
|
453 if ( iMainWindow ) |
|
454 { |
|
455 TRACES("CSplashWsClient::~CSplashWsClient(): To background"); |
|
456 iMainWindow->Client()->Group().SetOrdinalPosition(-1,ECoeWinPriorityNormal); // Back to the normal position |
|
457 iWs.Flush(); |
|
458 } |
|
459 delete iMainWindow; |
|
460 delete iTimeout; |
|
461 TRACES("CSplashWsClient::~CSplashWsClient(): End"); |
|
462 } |
|
463 |
|
464 /****************************************************************************\ |
|
465 | Function: CSplashWsClient::ConstructMainWindowL() |
|
466 | Called by base class's ConstructL |
|
467 | Purpose: Allocates and creates all the windows owned by this client |
|
468 | (See list of windows in CSplashWsCLient declaration). |
|
469 \****************************************************************************/ |
|
470 |
|
471 void CSplashWsClient::ConstructMainWindowL() |
|
472 { |
|
473 TRACES("CSplashWsClient::ConstructMainWindowL(): Start"); |
|
474 |
|
475 TSize windowSize=iScreen->SizeInPixels(); |
|
476 |
|
477 CMainWindow* window = new (ELeave) CMainWindow(this); |
|
478 CleanupStack::PushL( window ); |
|
479 window->ConstructL(TRect(TPoint(0,0), windowSize)); |
|
480 window->Client()->Group().SetOrdinalPosition(0,ECoeWinPriorityAlwaysAtFront + 1); // in front of the Status Bar |
|
481 delete iMainWindow; |
|
482 iMainWindow = window; |
|
483 CleanupStack::Pop( window ); |
|
484 |
|
485 if ( iTimeout == NULL ) |
|
486 { |
|
487 iTimeout = new (ELeave) CTimeout; |
|
488 iTimeout->ConstructL(iMainWindow); |
|
489 iTimeout->After(KSplashTimeout); |
|
490 } |
|
491 else |
|
492 { |
|
493 iTimeout->SetMainWindow( window ); |
|
494 } |
|
495 |
|
496 TRACES("CSplashWsClient::ConstructMainWindowL(): End"); |
|
497 } |
|
498 |
|
499 |
|
500 /****************************************************************************\ |
|
501 | Function: CSplashWsClient::RunL() |
|
502 | Called by active scheduler when an even occurs |
|
503 | Purpose: Processes events according to their type |
|
504 | For key events: calls HandleKeyEventL() (global to client) |
|
505 | For pointer event: calls HandlePointerEvent() for window |
|
506 | event occurred in. |
|
507 \****************************************************************************/ |
|
508 void CSplashWsClient::RunL() |
|
509 { |
|
510 TRACES("CSplashWsClient::RunL(): Start"); |
|
511 |
|
512 TInt state; |
|
513 RProperty::Get( KPSUidStartup, KPSSplashShutdown, state ); |
|
514 TRACES1("CSplashWsClient::RunL(): KPSSplashShutdown state = %d", state); |
|
515 |
|
516 if ( state != iPSRemoveSplashState ) |
|
517 { |
|
518 TRACES("CSplashWsClient::RunL(): KPSSplashShutdown state has changed -> PS event"); |
|
519 if ( state == ESplashShutdown ) |
|
520 { |
|
521 TRACES("CSplashWsClient::RunL(): Exit requested"); |
|
522 Exit(); |
|
523 } |
|
524 } |
|
525 else |
|
526 { |
|
527 TRACES("CSplashWsClient::RunL(): WS event"); |
|
528 |
|
529 // get the event |
|
530 iWs.GetEvent(iWsEvent); |
|
531 const TInt eventType = iWsEvent.Type(); |
|
532 |
|
533 // take action on it |
|
534 switch (eventType) |
|
535 { |
|
536 // window-group related event types |
|
537 case EEventKey: |
|
538 { |
|
539 TRACES("CSplashWsClient::RunL(): EEventKey"); |
|
540 TKeyEvent& keyEvent=*iWsEvent.Key(); // get key event |
|
541 HandleKeyEventL (keyEvent); |
|
542 break; |
|
543 } |
|
544 // window related events |
|
545 case EEventPointer: |
|
546 { |
|
547 TRACES("CSplashWsClient::RunL(): EEventPointer"); |
|
548 CWindow* window=(CWindow*)(iWsEvent.Handle()); // get window |
|
549 TPointerEvent& pointerEvent=*iWsEvent.Pointer(); |
|
550 window->HandlePointerEvent (pointerEvent); |
|
551 break; |
|
552 } |
|
553 case EEventScreenDeviceChanged: |
|
554 { |
|
555 const TInt currentScreenMode = iScreen->CurrentScreenMode(); |
|
556 TRACES2("CSplashWsClient::RunL() - EEventScreenDeviceChanged - iLastScreenMode: %d, currentScreenMode: %d", iLastScreenMode, currentScreenMode); |
|
557 if ( iLastScreenMode != currentScreenMode ) |
|
558 { |
|
559 RDebug::Printf("[SS] CSplashWsClient::RunL() - EEventScreenDeviceChanged - real screen mode change detected!!!!"); |
|
560 iScreen->SetAppScreenMode( currentScreenMode ); |
|
561 TPixelsTwipsAndRotation currentRot; |
|
562 iScreen->GetScreenModeSizeAndRotation( currentScreenMode, currentRot ); |
|
563 iMainWindow->Window().SetExtent( TPoint(0, 0), currentRot.iPixelSize ); |
|
564 iMainWindow->Client()->Group().SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront + 10000); // in front of the Status Bar |
|
565 iMainWindow->Window().Invalidate(); |
|
566 |
|
567 iLastScreenMode = currentScreenMode; |
|
568 } |
|
569 TRACES("CSplashWsClient::RunL() - EEventScreenDeviceChanged - done"); |
|
570 } |
|
571 break; |
|
572 default: |
|
573 TRACES("CSplashWsClient::RunL(): default"); |
|
574 break; |
|
575 } |
|
576 IssueRequest(); // maintain outstanding request |
|
577 } |
|
578 TRACES("CSplashWsClient::RunL(): End"); |
|
579 } |
|
580 |
|
581 |
|
582 /****************************************************************************\ |
|
583 | Function: CSplashWsClient::HandleKeyEventL() |
|
584 | |
|
585 | Purpose: Processes key events for CSplashWsClient |
|
586 | Gets the key code from the key event. Exits on 'Escape' |
|
587 \****************************************************************************/ |
|
588 void CSplashWsClient::HandleKeyEventL (TKeyEvent& /*aKeyEvent*/) |
|
589 { |
|
590 TRACES("CSplashWsClient::HandleKeyEventL(): Start"); |
|
591 TRACES("CSplashWsClient::HandleKeyEventL(): End"); |
|
592 } |
|
593 |
|
594 ////////////////////////////////////////////////////////////////////////////// |
|
595 ////////////////////////////////////////////////////////////////////////////// |
|
596 // Main program starts here // |
|
597 ////////////////////////////////////////////////////////////////////////////// |
|
598 ////////////////////////////////////////////////////////////////////////////// |
|
599 |
|
600 LOCAL_C void DoItL() |
|
601 { |
|
602 // make new client |
|
603 TRACES("DoItL(): Start"); |
|
604 |
|
605 CSplashWsClient* client=new (ELeave) CSplashWsClient; // allocate new client |
|
606 CleanupStack::PushL(client); // push, just in case |
|
607 client->ConstructL(); // construct and run |
|
608 CleanupStack::PopAndDestroy(); // destruct |
|
609 |
|
610 TRACES("DoItL(): End"); |
|
611 } |
|
612 |