20 #include <barsread.h> |
20 #include <barsread.h> |
21 #include <apgwgnam.h> |
21 #include <apgwgnam.h> |
22 #include <e32property.h> |
22 #include <e32property.h> |
23 #include <UikonInternalPSKeys.h> // KUikLayoutState, KUikFlipStatus |
23 #include <UikonInternalPSKeys.h> // KUikLayoutState, KUikFlipStatus |
24 #include <AvkonInternalCRKeys.h> // KAknQwertyInputModeActive |
24 #include <AvkonInternalCRKeys.h> // KAknQwertyInputModeActive |
25 #include <eikpriv.rsg> |
25 #include <EIKPRIV.rsg> |
26 #include <AknDef.h> |
26 #include <AknDef.h> |
27 #include <AknSgcc.h> |
27 #include <AknSgcc.h> |
28 #include <aknenv.h> |
28 #include <aknenv.h> |
29 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
29 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
30 #include <uikon/eikenvinterface.h> |
30 #include <uikon/eikenvinterface.h> |
290 TApaTaskList appList( ws ); |
290 TApaTaskList appList( ws ); |
291 TApaTask task = appList.FindApp( aViewId.iAppUid ); |
291 TApaTask task = appList.FindApp( aViewId.iAppUid ); |
292 |
292 |
293 if ( task.Exists() ) |
293 if ( task.Exists() ) |
294 { |
294 { |
|
295 TVwsViewId idleView = TVwsViewId(); |
|
296 AknDef::GetPhoneIdleViewId( idleView ); |
295 // If the task already exists, bring it to foreground. |
297 // If the task already exists, bring it to foreground. |
296 if ( aViewId.iAppUid == iHomeViewId.iAppUid ) |
298 if ( aViewId.iAppUid == iHomeViewId.iAppUid ) |
297 { |
299 { |
298 // special process for appshell |
300 // special process for appshell |
299 RThread menuThread; |
301 RThread thread; |
300 TInt error = menuThread.Open(task.ThreadId()); |
302 TInt error = thread.Open(task.ThreadId()); |
301 if ( error == KErrNone ) |
303 if ( error == KErrNone ) |
302 { |
304 { |
303 menuThread.SetProcessPriority(EPriorityForeground); |
305 thread.SetProcessPriority(EPriorityForeground); |
304 } |
306 } |
305 |
307 |
306 //start different fullscreen effect when launching appshell |
308 // start different fullscreen effect when launching app by KUidApaMessageSwitchOpenFile |
307 GfxTransEffect::BeginFullScreen( |
309 GfxTransEffect::BeginFullScreen( |
308 AknTransEffect::EApplicationActivate, |
310 AknTransEffect::EApplicationActivate, |
309 TRect(), |
311 TRect(), |
310 AknTransEffect::EParameterType, |
312 AknTransEffect::EParameterType, |
311 AknTransEffect::GfxTransParam( iHomeViewId.iAppUid ) ); |
313 AknTransEffect::GfxTransParam( aViewId.iAppUid ) ); |
312 |
314 |
313 // matrix menu will bring itself foreground when getting the message below |
315 // matrix menu will bring itself foreground when getting the message below |
314 task.SendMessage( KUidApaMessageSwitchOpenFile , KNullDesC8 ); |
316 task.SendMessage( KUidApaMessageSwitchOpenFile , KNullDesC8 ); |
|
317 } |
|
318 else if ( aViewId.iAppUid == idleView.iAppUid ) |
|
319 { |
|
320 // special process for idle |
|
321 RThread thread; |
|
322 TInt error = thread.Open( task.ThreadId() ); |
|
323 if ( error == KErrNone ) |
|
324 { |
|
325 thread.SetProcessPriority( EPriorityForeground ); |
|
326 } |
|
327 |
|
328 // idle will bring itself foreground when getting the message below |
|
329 task.SendMessage( KUidApaMessageSwitchOpenFile , KNullDesC8 ); |
|
330 |
315 } |
331 } |
316 else |
332 else |
317 { |
333 { |
318 CAknSgcClient::MoveApp(task.WgId(), ESgcMoveAppToForeground); |
334 CAknSgcClient::MoveApp(task.WgId(), ESgcMoveAppToForeground); |
319 } |
335 } |
390 iHomeTimer->Cancel(); |
406 iHomeTimer->Cancel(); |
391 delete iHomeTimer; |
407 delete iHomeTimer; |
392 iHomeTimer = NULL; |
408 iHomeTimer = NULL; |
393 if ( !iAppUi->HandleShortAppsKeyPressL() ) |
409 if ( !iAppUi->HandleShortAppsKeyPressL() ) |
394 { |
410 { |
395 RWsSession& ws = iEikonEnv->WsSession(); |
|
396 TApaTaskList apList( ws ); |
|
397 TApaTask task = apList.FindApp( iHomeViewId.iAppUid ); |
|
398 if( task.Exists() && task.WgId() == ws.GetFocusWindowGroup() ) |
|
399 { |
|
400 GfxTransEffect::BeginFullScreen( |
|
401 AknTransEffect::EApplicationExit, |
|
402 TRect(), |
|
403 AknTransEffect::EParameterType, |
|
404 AknTransEffect::GfxTransParam( iHomeViewId.iAppUid ) ); |
|
405 } |
|
406 |
|
407 ToggleShellL(); |
411 ToggleShellL(); |
408 } |
412 } |
409 |
413 |
410 return EKeyWasConsumed; |
414 return EKeyWasConsumed; |
411 } |
415 } |
501 { |
505 { |
502 // Initialise the hardware state shared data key, so that a value exists, |
506 // Initialise the hardware state shared data key, so that a value exists, |
503 // use a state that results in screen mode zero for normal apps. |
507 // use a state that results in screen mode zero for normal apps. |
504 CAknLayoutConfig::THardwareStateArray hwStates = |
508 CAknLayoutConfig::THardwareStateArray hwStates = |
505 CAknSgcClient::LayoutConfig().HardwareStates(); |
509 CAknSgcClient::LayoutConfig().HardwareStates(); |
|
510 |
|
511 TBool changed; |
506 TInt count = hwStates.Count(); |
512 TInt count = hwStates.Count(); |
507 for ( TInt ii = 0; ii < count; ii++ ) |
513 for ( TInt ii = 0; ii < count; ii++ ) |
508 { |
514 { |
509 const CAknLayoutConfig::THardwareState& hwState = hwStates.At( ii ); |
515 const CAknLayoutConfig::THardwareState& hwState = hwStates.At( ii ); |
510 if ( hwState.ScreenMode() == 0 ) |
516 if ( hwState.ScreenMode() == 0 ) |
511 { |
517 { |
512 SetHardwareStateL( hwState.StateNumber() ); |
518 SetHardwareStateL( hwState.StateNumber(), changed ); |
513 return; |
519 return; |
514 } |
520 } |
515 } |
521 } |
516 |
522 |
517 // Fall back to state 0. |
523 // Fall back to state 0. |
518 SetHardwareStateL( 0 ); |
524 SetHardwareStateL( 0, changed); |
519 } |
525 } |
520 |
526 |
521 |
527 |
522 // --------------------------------------------------------------------------- |
528 // --------------------------------------------------------------------------- |
523 // CAknServKeyFilter::HandleHardwareStateKeyL |
529 // CAknServKeyFilter::HandleHardwareStateKeyL |
537 for ( TInt ii = 0; ii < count; ii++ ) |
543 for ( TInt ii = 0; ii < count; ii++ ) |
538 { |
544 { |
539 const CAknLayoutConfig::THardwareState& hwState = hwStates.At( ii ); |
545 const CAknLayoutConfig::THardwareState& hwState = hwStates.At( ii ); |
540 if ( hwState.KeyCode() == aCode ) |
546 if ( hwState.KeyCode() == aCode ) |
541 { |
547 { |
|
548 // Found the state |
542 iSensorOrientation = hwState.StateNumber(); |
549 iSensorOrientation = hwState.StateNumber(); |
543 if( !iSlideOpen ) |
550 if( !iSlideOpen ) |
544 { |
551 { |
545 RotateScreenL( hwState.StateNumber() ); |
552 UpdateStateAndNotifyL( hwState.StateNumber() ); |
546 #ifdef RD_INTELLIGENT_TEXT_INPUT |
553 #ifdef RD_INTELLIGENT_TEXT_INPUT |
547 #if defined(__WINS__) |
554 #if defined(__WINS__) |
548 |
555 |
549 TInt keyboardLayout = HwKeyToKeyBoardType(aCode); |
556 TInt keyboardLayout = HwKeyToKeyBoardType(aCode); |
550 TInt curkeyLayout = 0; |
557 TInt curkeyLayout = 0; |
637 // --------------------------------------------------------------------------- |
644 // --------------------------------------------------------------------------- |
638 // CAknServKeyFilter::SetHardwareStateL |
645 // CAknServKeyFilter::SetHardwareStateL |
639 // Updates the hardware state P&S key. |
646 // Updates the hardware state P&S key. |
640 // --------------------------------------------------------------------------- |
647 // --------------------------------------------------------------------------- |
641 // |
648 // |
642 void CAknServKeyFilter::SetHardwareStateL( TInt aState ) |
649 void CAknServKeyFilter::SetHardwareStateL( TInt aState, TBool& aChanged ) |
643 { |
650 { |
644 TInt err = RProperty::Set( KPSUidUikon, KUikLayoutState, aState ); |
651 TInt currentState(-1); |
|
652 RProperty::Get( KPSUidUikon, KUikLayoutState, currentState ); |
|
653 aChanged = currentState != aState; |
|
654 if ( aChanged ) |
|
655 { |
|
656 TInt err = RProperty::Set( KPSUidUikon, KUikLayoutState, aState ); |
645 |
657 |
646 #ifdef _DEBUG |
658 #ifdef _DEBUG |
647 _LIT( KDMsg1, "xxxx KUikLayoutState err=%d" ); |
659 _LIT( KDMsg1, "xxxx KUikLayoutState err=%d" ); |
648 RDebug::Print( KDMsg1, err ); |
660 RDebug::Print( KDMsg1, err ); |
649 #endif |
661 #endif |
789 // |
802 // |
790 void CAknServKeyFilter::RotateScreenL( TInt aState ) |
803 void CAknServKeyFilter::RotateScreenL( TInt aState ) |
791 { |
804 { |
792 CWsScreenDevice* screen = iEikonEnv->ScreenDevice(); |
805 CWsScreenDevice* screen = iEikonEnv->ScreenDevice(); |
793 TInt screenMode = screen->CurrentScreenMode(); |
806 TInt screenMode = screen->CurrentScreenMode(); |
794 SetHardwareStateL( aState ); |
807 TBool changed; |
795 |
808 SetHardwareStateL( aState, changed); |
796 // Update the setting cache and get SGCS to process the screen |
809 |
797 // mode change. This may broadcast a screen device change to |
810 // Update the setting cache and get SGCS to process the screen |
798 // the apps, to inform them of the update. |
811 // mode change. This may broadcast a screen device change to |
799 iAvkonEnv->SettingCache().Update( KAknHardwareLayoutSwitch ); |
812 // the apps, to inform them of the update. |
800 iAppUi->SgcServer()->HandleWindowGroupParamChangeL( |
813 iAvkonEnv->SettingCache().Update( KAknHardwareLayoutSwitch ); |
801 iEikonEnv->RootWin().Identifier(), |
814 iAppUi->SgcServer()->HandleWindowGroupParamChangeL( |
802 0, |
815 iEikonEnv->RootWin().Identifier(), |
803 0, |
816 0, |
804 0, |
817 0, |
805 KAknScreenModeUnset ); |
818 0, |
|
819 KAknScreenModeUnset ); |
806 |
820 |
807 if ( screenMode == screen->CurrentScreenMode() ) |
821 if ( screenMode == screen->CurrentScreenMode() ) |
808 { |
822 { |
809 // Apps will not have received a screen device changed event |
823 // Apps will not have received a screen device changed event |
810 // so send a KAknHardwareLayoutSwitch to the apps to ensure |
824 // so send a KAknHardwareLayoutSwitch to the apps to ensure |
813 event.SetType( KAknHardwareLayoutSwitch ); |
827 event.SetType( KAknHardwareLayoutSwitch ); |
814 event.SetHandle( 0 ); |
828 event.SetHandle( 0 ); |
815 iEikonEnv->WsSession().SendEventToAllWindowGroups( 0, event ); |
829 iEikonEnv->WsSession().SendEventToAllWindowGroups( 0, event ); |
816 } |
830 } |
817 } |
831 } |
|
832 |
|
833 // --------------------------------------------------------------------------- |
|
834 // CAknServKeyFilter::UpdateStateAndNotifyL |
|
835 // --------------------------------------------------------------------------- |
|
836 // |
|
837 void CAknServKeyFilter::UpdateStateAndNotifyL( TInt aState ) |
|
838 { |
|
839 CWsScreenDevice* screen = iEikonEnv->ScreenDevice(); |
|
840 TInt screenMode = screen->CurrentScreenMode(); |
|
841 TBool changed; |
|
842 SetHardwareStateL( aState, changed); |
|
843 |
|
844 //Do something only if anything changed |
|
845 if (changed) |
|
846 { |
|
847 // Update the setting cache and get SGCS to process the screen |
|
848 // mode change. This may broadcast a screen device change to |
|
849 // the apps, to inform them of the update. |
|
850 iAvkonEnv->SettingCache().Update( KAknHardwareLayoutSwitch ); |
|
851 iAppUi->SgcServer()->HandleWindowGroupParamChangeL( |
|
852 iEikonEnv->RootWin().Identifier(), |
|
853 0, |
|
854 0, |
|
855 0, |
|
856 KAknScreenModeUnset ); |
|
857 |
|
858 } |
|
859 |
|
860 if (screenMode == screen->CurrentScreenMode() ) |
|
861 { |
|
862 // Remember that there was at least one inhibited screen mode |
|
863 iAppUi->SgcServer()->SetBackgroundAppsStateChangeDeferred( ETrue ); |
|
864 } |
|
865 } |
818 |
866 |
819 // End of file |
867 // End of file |