|
1 /* |
|
2 * Copyright (c) 2007-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: Compatibility mode keyboard UI component |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <AknsUtils.h> |
|
21 #include <AknsSkinInstance.h> |
|
22 #include <AknsDrawUtils.h> |
|
23 #include <AknsBasicBackgroundControlContext.h> |
|
24 #include <centralrepository.h> |
|
25 #include <AvkonInternalCRKeys.h> |
|
26 #include <pslninternalcrkeys.h> |
|
27 #include <aknlayoutscalable_avkon.cdl.h> |
|
28 |
|
29 #include "akncompakb.h" |
|
30 #include "akncompaside.h" |
|
31 |
|
32 // -------------------------------------------------------------------------- |
|
33 // |
|
34 // -------------------------------------------------------------------------- |
|
35 CAknCompaKb* CAknCompaKb::NewL(TInt aCompaScreenMode, TBool aMakeVisible) |
|
36 { |
|
37 CAknCompaKb* self = new (ELeave) CAknCompaKb(aCompaScreenMode); |
|
38 CleanupStack::PushL(self); |
|
39 self->ConstructL(aMakeVisible); |
|
40 CleanupStack::Pop(self); |
|
41 return self; |
|
42 } |
|
43 |
|
44 // -------------------------------------------------------------------------- |
|
45 // |
|
46 // -------------------------------------------------------------------------- |
|
47 void CAknCompaKb::ConstructL(TBool aMakeVisible) |
|
48 { |
|
49 // Connect to key server is not delayed until buttons are pressed |
|
50 // as we don't want application to fail while it's executing due |
|
51 // to a key press. |
|
52 // Optimization: akncapserver/aknnfysrv/eiksrv have compakeyboard |
|
53 // always instantiated. akncapserver/aknnfysrv simulate raw events |
|
54 // without compakeysrv. Eikon server doesn't have capability to |
|
55 // simulate raw events directly. In this case connection to the key |
|
56 // server press is delayed until a key is pressed. This way key server |
|
57 // is not running all the time. |
|
58 RProcess process; |
|
59 TSecureId secureId = process.SecureId(); |
|
60 iFlags.iInEikSrv = AknCompaUtils::IsEikSrv(secureId); |
|
61 iFlags.iInAknCapSrv = AknCompaUtils::IsAknCapSrv(secureId); |
|
62 iFlags.iInGlobalUiSrv = AknCompaUtils::IsGlobalUiSrv(secureId); |
|
63 if (!iFlags.iInGlobalUiSrv) |
|
64 { |
|
65 User::LeaveIfError(iCompaSrvSession.Connect()); |
|
66 iThemesCenRep = CRepository::NewL(KCRUidThemes); |
|
67 } |
|
68 |
|
69 // Transition effects do not work in compa-mode (centered window). They |
|
70 // are disabled when screen mode is compa-mode. In case device was |
|
71 // powered off while effects were disabled, restore transition effects |
|
72 // state. |
|
73 if (iFlags.iInAknCapSrv) |
|
74 { |
|
75 // Enable transition effects if device was powered off while |
|
76 // we had them disabled. |
|
77 if (iCompaSrvSession.Connect() == KErrNone) |
|
78 { |
|
79 iCompaSrvSession.RestoreTransEffects(); |
|
80 iCompaSrvSession.Close(); |
|
81 } |
|
82 } |
|
83 |
|
84 CreateWindowL(); |
|
85 RWindow& window = Window(); |
|
86 // Prevent fading when application displays a dialog |
|
87 window.SetNonFading(ETrue); |
|
88 // Ordinal priority is not usually set for application windows |
|
89 // (only for window groups). Compa keyboard is set to high ordinary |
|
90 // priority. This keeps it always at front and prevents other windows |
|
91 // (eg. menus, dialogs) capturing pointer events. |
|
92 // If an application would set one it's own windows to higher |
|
93 // priority, it could capture pointer events but menus and dialogs |
|
94 // wouldn't work either in that case. |
|
95 const TInt KOrdinalPriority = ECoeWinPriorityAlwaysAtFront + 1; |
|
96 window.SetOrdinalPosition(window.OrdinalPosition(), KOrdinalPriority); |
|
97 // Request pointer up event event if stylus is dragged out of this window |
|
98 window.SetPointerGrab(ETrue); |
|
99 // Capture pointer events from this window group. This prevents |
|
100 // touch working in application window even when the application |
|
101 // doesn't observe layout's PenEnabled. |
|
102 window.SetPointerCapture(RWindowBase::TCaptureEnabled); |
|
103 |
|
104 iBgContext = CAknsBasicBackgroundControlContext::NewL( |
|
105 KAknsIIDQsnBgScreen, Rect(), ETrue); |
|
106 |
|
107 // Get skin background, this method is used to update it also |
|
108 SkinChanged(); |
|
109 |
|
110 // Construct buttons |
|
111 AknCompaUtils::ReadButtonsL(iButtons, iPenButtonIndex, *iCoeEnv); |
|
112 for(TInt i = 0; i < iButtons.Count(); i++) |
|
113 { |
|
114 CAknCompaButton* button = iButtons[i]; |
|
115 button->SetContainerWindowL(*this); |
|
116 button->SetObserver(button); |
|
117 } |
|
118 |
|
119 iLeftSide = CAknCompaSide::NewL(); |
|
120 iRightSide = CAknCompaSide::NewL(); |
|
121 |
|
122 // Set constrol and buttons size and position. If control is left |
|
123 // invisible, screen mode is not compa-mode and layout is postponed |
|
124 // until screen mode is compa-mode. |
|
125 if (aMakeVisible) |
|
126 { |
|
127 LayoutControl(); |
|
128 } |
|
129 |
|
130 // Add to control stack to receive KEikDynamicLayoutVariantSwitch |
|
131 // events |
|
132 iCoeEnv->AppUi()->AddToStackL(this, ECoeStackPriorityDefault, |
|
133 ECoeStackFlagRefusesAllKeys); |
|
134 |
|
135 iCoeEnv->AddForegroundObserverL(*this); |
|
136 |
|
137 // Compa-mode keyboard is made visible in the case of a normal |
|
138 // applications. Compa-keyboard is also created for servers |
|
139 // that display global/notes notifications but left invisible. |
|
140 // Visibility of the keyboard is controlled according to current |
|
141 // screen mode. It's visible only in compa screen mode. Note: |
|
142 // It's also possible for a screen mode to change (e.g. due to |
|
143 // some application exiting) while a global note is on display. |
|
144 if (aMakeVisible) |
|
145 { |
|
146 ActivateL(); |
|
147 } |
|
148 } |
|
149 |
|
150 // -------------------------------------------------------------------------- |
|
151 // Constructor |
|
152 // -------------------------------------------------------------------------- |
|
153 CAknCompaKb::CAknCompaKb(TInt aCompaScreenMode): |
|
154 iButtons(EButtonsGranularity) |
|
155 { |
|
156 iCompaScreenMode = aCompaScreenMode; |
|
157 } |
|
158 |
|
159 // -------------------------------------------------------------------------- |
|
160 // Destructor |
|
161 // -------------------------------------------------------------------------- |
|
162 CAknCompaKb::~CAknCompaKb() |
|
163 { |
|
164 iCoeEnv->AppUi()->RemoveFromStack(this); |
|
165 iCoeEnv->RemoveForegroundObserver(*this); |
|
166 |
|
167 iButtons.ResetAndDestroy(); |
|
168 delete iLeftSide; |
|
169 delete iRightSide; |
|
170 |
|
171 delete iBgContext; |
|
172 |
|
173 // Keyserver sends up events if client has any keys in down state |
|
174 // when session is closed |
|
175 iCompaSrvSession.Close(); |
|
176 |
|
177 delete iThemesCenRep; |
|
178 } |
|
179 |
|
180 // -------------------------------------------------------------------------- |
|
181 // Simulate a key press to application |
|
182 // -------------------------------------------------------------------------- |
|
183 void CAknCompaKb::SimulateKeyPressL(TInt aScanCode, TBool aDown) |
|
184 { |
|
185 if (!iFlags.iInGlobalUiSrv) |
|
186 { |
|
187 // Key press is simulated via a server as SwEvent capability |
|
188 // is needed |
|
189 iCompaSrvSession.SimulateKeyEventL(aScanCode, aDown); |
|
190 } |
|
191 else if (iFlags.iInEikSrv) |
|
192 { |
|
193 // Eikon server. Connect to key server only when needed. |
|
194 // Connection to key server should succeed as it is already |
|
195 // started by an application that set screen mode to compa. |
|
196 if (iCompaSrvSession.Handle() == KNullHandle) |
|
197 { |
|
198 User::LeaveIfError( iCompaSrvSession.Connect() ); |
|
199 } |
|
200 if (iCompaSrvSession.Handle() != KNullHandle) |
|
201 { |
|
202 iCompaSrvSession.SimulateKeyEventL(aScanCode, aDown); |
|
203 } |
|
204 } |
|
205 else |
|
206 { |
|
207 // akncapserver and aknnfysrv don't use compakeysrv |
|
208 TRawEvent rawEvent; |
|
209 rawEvent.Set( |
|
210 aDown ? TRawEvent::EKeyDown:TRawEvent::EKeyUp, aScanCode); |
|
211 RWsSession& wsSession = iCoeEnv->WsSession(); |
|
212 wsSession.SimulateRawEvent(rawEvent); |
|
213 wsSession.Flush(); |
|
214 } |
|
215 } |
|
216 |
|
217 // -------------------------------------------------------------------------- |
|
218 // Set "pen" button to up state |
|
219 // -------------------------------------------------------------------------- |
|
220 void CAknCompaKb::SetPenButtonUpL() |
|
221 { |
|
222 if (iPenButtonIndex != KErrNotFound) |
|
223 { |
|
224 CAknCompaButton* compaButton = iButtons[iPenButtonIndex]; |
|
225 if (compaButton->IsPressed()) |
|
226 { |
|
227 compaButton->SetButtonUpL(); |
|
228 } |
|
229 } |
|
230 } |
|
231 |
|
232 // -------------------------------------------------------------------------- |
|
233 // Set buttons to up state |
|
234 // -------------------------------------------------------------------------- |
|
235 void CAknCompaKb::SetButtonsUpL() |
|
236 { |
|
237 TInt cnt = iButtons.Count(); |
|
238 for(TInt i = 0; i < cnt; i++) |
|
239 { |
|
240 CAknCompaButton* compaButton = iButtons[i]; |
|
241 if (compaButton->IsPressed()) |
|
242 { |
|
243 compaButton->SetButtonUpL(); |
|
244 } |
|
245 } |
|
246 } |
|
247 |
|
248 // -------------------------------------------------------------------------- |
|
249 // Check is compa-mode application is on foreground |
|
250 // -------------------------------------------------------------------------- |
|
251 TBool CAknCompaKb::IsForeground() |
|
252 { |
|
253 // Voice command application is launched on top of foreground application |
|
254 // in QHD mode. If it is launched on top of compa-mode application |
|
255 // the screen gets messed up. Compa-mode app is showing behind voice |
|
256 // dialer but wserv right shifting is lost. Workaround for this is to |
|
257 // switch idle screen to foreground before voice commander is launched. |
|
258 // Switch to idle screen if this is a regular application or if global |
|
259 // note is showing on top of compa-mode application. |
|
260 return !iFlags.iInGlobalUiSrv || InCompaScreenMode(); |
|
261 } |
|
262 |
|
263 // -------------------------------------------------------------------------- |
|
264 // Disable transition effects in compa-mode |
|
265 // -------------------------------------------------------------------------- |
|
266 void CAknCompaKb::DisaTransEffects(bool aDisable) |
|
267 { |
|
268 // Transition effects cannot be disabled per application. They can be |
|
269 // disabled globally from central repository. Transition effects are |
|
270 // disabled whenever screen mode changes to compa-mode by AknCapServer. |
|
271 if (iFlags.iInAknCapSrv && iFlags.iEffectsDisa != aDisable) |
|
272 { |
|
273 if (iCompaSrvSession.Handle() == KNullHandle) |
|
274 { |
|
275 User::LeaveIfError( iCompaSrvSession.Connect() ); |
|
276 } |
|
277 if (iCompaSrvSession.Handle() != KNullHandle) |
|
278 { |
|
279 if (aDisable) |
|
280 { |
|
281 iCompaSrvSession.DisaTransEffects(); |
|
282 } |
|
283 else |
|
284 { |
|
285 iCompaSrvSession.RestoreTransEffects(); |
|
286 iCompaSrvSession.Close(); |
|
287 } |
|
288 iFlags.iEffectsDisa = aDisable; |
|
289 } |
|
290 } |
|
291 } |
|
292 |
|
293 // --------------------------------------------------------------------------- |
|
294 // Return wanted layout rectangle |
|
295 // --------------------------------------------------------------------------- |
|
296 TRect CAknCompaKb::RectFromLayout( const TRect& aParent, |
|
297 const TAknWindowComponentLayout& aComponentLayout ) |
|
298 { |
|
299 TAknLayoutRect layoutRect; |
|
300 layoutRect.LayoutRect(aParent, aComponentLayout.LayoutLine()); |
|
301 |
|
302 return layoutRect.Rect(); |
|
303 } |
|
304 |
|
305 // -------------------------------------------------------------------------- |
|
306 // Layout compamode controls |
|
307 // -------------------------------------------------------------------------- |
|
308 void CAknCompaKb::LayoutControl() |
|
309 { |
|
310 TPoint origin = |
|
311 iCoeEnv->ScreenDevice()->GetScreenModeOrigin(iCompaScreenMode); |
|
312 |
|
313 TRect screenRect; |
|
314 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EScreen, screenRect); |
|
315 |
|
316 // parent rect for all compamode components |
|
317 iCompaRect = RectFromLayout(screenRect, |
|
318 AknLayoutScalable_Avkon::compa_mode_pane()); |
|
319 |
|
320 TRect compaKbRect = RectFromLayout(iCompaRect, |
|
321 AknLayoutScalable_Avkon::compa_mode_pane_g3()); |
|
322 |
|
323 AknCompaUtils::ScaleRect(compaKbRect, -origin.iX, 0); |
|
324 SetRect(compaKbRect); |
|
325 |
|
326 // side controls |
|
327 TRect leftSide = RectFromLayout(iCompaRect, |
|
328 AknLayoutScalable_Avkon::compa_mode_pane_g1()); |
|
329 |
|
330 TRect rightSide = RectFromLayout(iCompaRect, |
|
331 AknLayoutScalable_Avkon::compa_mode_pane_g2()); |
|
332 |
|
333 AknCompaUtils::ScaleRect(rightSide, -origin.iX, 0); |
|
334 iRightSide->SetRect(rightSide); |
|
335 |
|
336 // Support for not centered compa window. |
|
337 // Left side control has to be moved to other side if not centered |
|
338 if(origin.iX == 0) |
|
339 { |
|
340 origin.iX -= screenRect.Width(); |
|
341 } |
|
342 |
|
343 AknCompaUtils::ScaleRect(leftSide, -origin.iX, 0); |
|
344 iLeftSide->SetRect(leftSide); |
|
345 |
|
346 LayoutButtonControls(); |
|
347 SetSkinBackground(); |
|
348 iFlags.iLayoutDone = ETrue; |
|
349 } |
|
350 |
|
351 // -------------------------------------------------------------------------- |
|
352 // Layout button controls |
|
353 // -------------------------------------------------------------------------- |
|
354 void CAknCompaKb::LayoutButtonControls() |
|
355 { |
|
356 TRect rockerRect = RectFromLayout(iCompaRect, |
|
357 AknLayoutScalable_Avkon::main_comp_mode_rocker_pane_cp()); |
|
358 |
|
359 TRect ituRect = RectFromLayout(iCompaRect, |
|
360 AknLayoutScalable_Avkon::main_comp_mode_itu_pane_cp()); |
|
361 |
|
362 if (iButtons.Count() > 0) |
|
363 { |
|
364 TAknLayoutScalableParameterLimits buttonLimits = |
|
365 AknLayoutScalable_Avkon::cell_cmode_rocker_pane_cp_ParamLimits(); |
|
366 |
|
367 // Calculating number of rocker pane buttons |
|
368 iRockerGridSize = ((buttonLimits.LastRow() + 1) * |
|
369 (buttonLimits.LastColumn() + 1)); |
|
370 |
|
371 TInt buttonCount = 0; |
|
372 |
|
373 LayoutButtonGrid(rockerRect, buttonCount, buttonLimits.LastRow(), |
|
374 buttonLimits.LastColumn()); |
|
375 |
|
376 buttonLimits = |
|
377 AknLayoutScalable_Avkon::cell_cmode_itu_pane_cp_ParamLimits(); |
|
378 |
|
379 LayoutButtonGrid(ituRect, buttonCount, buttonLimits.LastRow(), |
|
380 buttonLimits.LastColumn()); |
|
381 |
|
382 for(TInt i = 0; i < iButtons.Count(); i++) |
|
383 { |
|
384 CAknCompaButton* button = iButtons[i]; |
|
385 TRect rect = button->Rect(); |
|
386 AknCompaUtils::ScaleRect(rect, 0, -iCompaRect.Height()); |
|
387 |
|
388 button->SetRect(rect); |
|
389 button->UpdateColors(); |
|
390 button->LayoutIconAndText(); |
|
391 } |
|
392 } |
|
393 } |
|
394 |
|
395 |
|
396 // -------------------------------------------------------------------------- |
|
397 // Layout grid of buttons |
|
398 // -------------------------------------------------------------------------- |
|
399 void CAknCompaKb::LayoutButtonGrid(TRect aParentRect, TInt& aButtonCount, |
|
400 TInt aRows, TInt aColumns) |
|
401 { |
|
402 for(TInt row = 0; row <= aRows; row++) |
|
403 { |
|
404 for(TInt col = 0; col <= aColumns; col++) |
|
405 { |
|
406 if(aButtonCount < iRockerGridSize) |
|
407 { |
|
408 AknLayoutUtils::LayoutControl(iButtons[aButtonCount], |
|
409 aParentRect, AknLayoutScalable_Avkon:: |
|
410 cell_cmode_rocker_pane_cp(0,col,row)); |
|
411 } |
|
412 else |
|
413 { |
|
414 AknLayoutUtils::LayoutControl(iButtons[aButtonCount], |
|
415 aParentRect, AknLayoutScalable_Avkon:: |
|
416 cell_cmode_itu_pane_cp(0,col,row)); |
|
417 } |
|
418 aButtonCount++; |
|
419 } |
|
420 } |
|
421 } |
|
422 |
|
423 // -------------------------------------------------------------------------- |
|
424 // |
|
425 // -------------------------------------------------------------------------- |
|
426 void CAknCompaKb::SetSkinBackground() |
|
427 { |
|
428 TPoint origin = |
|
429 iCoeEnv->ScreenDevice()->GetScreenModeOrigin(iCompaScreenMode); |
|
430 |
|
431 TPoint origo(0, 0); |
|
432 |
|
433 // Skin background context |
|
434 iBgContext->SetParentPos(origo); |
|
435 AknCompaUtils::ScaleRect(iCompaRect, -origin.iX, 0); |
|
436 iBgContext->SetRect(iCompaRect); |
|
437 |
|
438 iLeftSide->SetBackground(origin); |
|
439 iRightSide->SetBackground(origin); |
|
440 |
|
441 } |
|
442 |
|
443 // -------------------------------------------------------------------------- |
|
444 // Check if current screen mode is compa-mode |
|
445 // -------------------------------------------------------------------------- |
|
446 TBool CAknCompaKb::InCompaScreenMode() |
|
447 { |
|
448 return iCoeEnv->ScreenDevice()->CurrentScreenMode() == |
|
449 iCompaScreenMode; |
|
450 } |
|
451 |
|
452 // -------------------------------------------------------------------------- |
|
453 // |
|
454 // -------------------------------------------------------------------------- |
|
455 TInt CAknCompaKb::CountComponentControls() const |
|
456 { |
|
457 return iButtons.Count(); |
|
458 } |
|
459 |
|
460 // -------------------------------------------------------------------------- |
|
461 // |
|
462 // -------------------------------------------------------------------------- |
|
463 CCoeControl* CAknCompaKb::ComponentControl(TInt aIndex) const |
|
464 { |
|
465 return iButtons[aIndex]; |
|
466 } |
|
467 |
|
468 // -------------------------------------------------------------------------- |
|
469 // |
|
470 // -------------------------------------------------------------------------- |
|
471 void CAknCompaKb::Draw(const TRect& aRect) const |
|
472 { |
|
473 CWindowGc& gc = SystemGc(); |
|
474 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
475 |
|
476 // If skin background draw fails, flat color will be used |
|
477 if(!AknsDrawUtils::Background(skin, iBgContext, this, gc, aRect)) |
|
478 { |
|
479 gc.SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
480 gc.SetPenColor(iSkinColor); |
|
481 gc.SetBrushColor(iSkinColor); |
|
482 gc.DrawRect(Rect()); |
|
483 } |
|
484 |
|
485 gc.SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
486 gc.SetPenColor(iSkinColor); |
|
487 gc.SetBrushColor(iSkinColor); |
|
488 |
|
489 // Draw background rects for rocker buttons. |
|
490 // These are drawn under the buttons to achieve transparency effect. |
|
491 for(TInt i = 0; i < iButtons.Count(); i++) |
|
492 { |
|
493 CAknCompaButton* button = iButtons[i]; |
|
494 |
|
495 if (button->IsRocker()) |
|
496 { |
|
497 gc.DrawRect(button->Rect()); |
|
498 } |
|
499 } |
|
500 } |
|
501 |
|
502 // -------------------------------------------------------------------------- |
|
503 // |
|
504 // -------------------------------------------------------------------------- |
|
505 void CAknCompaKb::HandleResourceChange(TInt aType) |
|
506 { |
|
507 switch(aType) |
|
508 { |
|
509 // Compa-mode application is fixed to QVGA layout and cannot change. |
|
510 // When Avkon notify server is displaying a global note, it's |
|
511 // possible for layout to change. Compa-keyboard is hidden if |
|
512 // screen mode changes out of compa-mode. |
|
513 case KEikDynamicLayoutVariantSwitch: |
|
514 { |
|
515 TBool isScreenModeCompa = InCompaScreenMode(); |
|
516 if (isScreenModeCompa && !iFlags.iLayoutDone) |
|
517 { |
|
518 // In global UI-servers, buttons size and position is set |
|
519 // only when compa-mode is entered first time. |
|
520 if (!iFlags.iLayoutDone) |
|
521 { |
|
522 LayoutControl(); |
|
523 // In practise ActivateL() will not leave as it allocates |
|
524 // no resources |
|
525 TRAP_IGNORE(ActivateL()); |
|
526 } |
|
527 } |
|
528 else |
|
529 { |
|
530 if (iFlags.iLayoutDone && iFlags.iInGlobalUiSrv) |
|
531 { |
|
532 MakeVisible(isScreenModeCompa); |
|
533 } |
|
534 } |
|
535 } |
|
536 break; |
|
537 case KAknsMessageSkinChange: |
|
538 SkinChanged(); |
|
539 break; |
|
540 default: |
|
541 break; |
|
542 } |
|
543 CCoeControl::HandleResourceChange(aType); |
|
544 } |
|
545 |
|
546 // -------------------------------------------------------------------------- |
|
547 // |
|
548 // -------------------------------------------------------------------------- |
|
549 void CAknCompaKb::ActivateL() |
|
550 { |
|
551 iLeftSide->ActivateL(); |
|
552 iRightSide->ActivateL(); |
|
553 CCoeControl::ActivateL(); |
|
554 } |
|
555 |
|
556 // -------------------------------------------------------------------------- |
|
557 // |
|
558 // -------------------------------------------------------------------------- |
|
559 void CAknCompaKb::MakeVisible(TBool aVisible) |
|
560 { |
|
561 CCoeControl::MakeVisible(aVisible); |
|
562 iLeftSide->MakeVisible(aVisible); |
|
563 iRightSide->MakeVisible(aVisible); |
|
564 } |
|
565 |
|
566 // -------------------------------------------------------------------------- |
|
567 // |
|
568 // -------------------------------------------------------------------------- |
|
569 void CAknCompaKb::HandleGainingForeground() |
|
570 { |
|
571 iFlags.iForeground = ETrue; |
|
572 |
|
573 // Wait for transition effects to go into disabled. This is needed |
|
574 // in WINSCW as effects use CFbsBitGc::SetClippingRegion() which |
|
575 // panics. Global ui-servers may also be in foreground when screen |
|
576 // mode changes to foreground. For example when screen saver deactivates. |
|
577 // In this case they disable effects in KEikDynamicLayoutVariantSwitch |
|
578 // event and rely on timing of there being no draw events before effects |
|
579 // are disabled. |
|
580 if (!iFlags.iInGlobalUiSrv) |
|
581 { |
|
582 AknCompaUtils::WaitTransEffectsOff(*iThemesCenRep); |
|
583 } |
|
584 } |
|
585 |
|
586 // -------------------------------------------------------------------------- |
|
587 // |
|
588 // -------------------------------------------------------------------------- |
|
589 void CAknCompaKb::HandleLosingForeground() |
|
590 { |
|
591 iFlags.iForeground = EFalse; |
|
592 |
|
593 // AknAppUi filters stylus up events even if app leaves foreground. |
|
594 // Bring all buttons up to prevent them being left down. |
|
595 TRAP_IGNORE(SetButtonsUpL()); |
|
596 |
|
597 // If running in eikon server, close connection to key server in |
|
598 // order to allow it to exit if no compa mode applications are |
|
599 // running |
|
600 if (iFlags.iInEikSrv) |
|
601 { |
|
602 iCompaSrvSession.Close(); |
|
603 } |
|
604 } |
|
605 |
|
606 // -------------------------------------------------------------------------- |
|
607 // Handle skin change event |
|
608 // -------------------------------------------------------------------------- |
|
609 void CAknCompaKb::SkinChanged() |
|
610 { |
|
611 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
612 |
|
613 // Update color for rocker button backgrounds |
|
614 AknsUtils::GetCachedColor(skin, iSkinColor, KAknsIIDQsnTextColors, |
|
615 EAknsCIQsnTextColorsCG20); |
|
616 } |