textinput/peninputarc/src/peninputserverapp/peninputserver.cpp
branchRCL_3
changeset 20 ebd48d2de13c
parent 19 ac7e4d1d9209
child 21 ecbabf52600f
equal deleted inserted replaced
19:ac7e4d1d9209 20:ebd48d2de13c
    45 #include <AknDef.h>
    45 #include <AknDef.h>
    46 #include <aknfeppeninputenums.h>
    46 #include <aknfeppeninputenums.h>
    47 #include <aknappui.h> 
    47 #include <aknappui.h> 
    48 
    48 
    49 #include "peninputcrpclient.h"
    49 #include "peninputcrpclient.h"
    50 #include <avkondomainpskeys.h>
       
    51 //#define __WND_TEST_
    50 //#define __WND_TEST_
    52 
    51 
    53 // CONSTANTS
    52 // CONSTANTS
    54 const TSize KInitialPeninputSize= TSize( 10, 10 );
    53 const TSize KInitialPeninputSize= TSize( 10, 10 );
    55 const TInt KMsgQueueLen = 1000;
    54 const TInt KMsgQueueLen = 1000;
    56 const TInt KMsgResponseQueueLen = 10;
    55 const TInt KMsgResponseQueueLen = 10;
    57 
    56 
    58 const TInt KWsSessionFlushPerioid = 50000;//50ms
    57 const TInt KWsSessionFlushPerioid = 50000;//50ms
    59 const TInt KInvalidValue = -1;
    58 const TInt KInvalidValue = -1;
    60 // Layout UID for portrait FSQ.  Used for distinguish between 
       
    61 // landscape and portrait FSQ for EPluginInputModeFSQ, which 
       
    62 // is used for both orientation in Pen Input server side code.
       
    63 const TInt KPenInputSrvPrtFsqUiId = 0x20026837;
       
    64 
       
    65 
    59 
    66 enum TActivationFlag
    60 enum TActivationFlag
    67 	{
    61 	{
    68 	ECmdDeactivate = EFalse,
    62 	ECmdDeactivate = EFalse,
    69 	ECmdActivate = ETrue,
    63 	ECmdActivate = ETrue,
   190     iSpriteSize = KInitialPeninputSize;
   184     iSpriteSize = KInitialPeninputSize;
   191     iSpritePosition = TPoint(0,0);    
   185     iSpritePosition = TPoint(0,0);    
   192     //iDispMode = iDispModeForMask= CCoeEnv::Static()->WsSession().GetDefModeMaxNumColors(col,grey);    
   186     //iDispMode = iDispModeForMask= CCoeEnv::Static()->WsSession().GetDefModeMaxNumColors(col,grey);    
   193     iPreNonGloebalNotesWndGrpId = -1;
   187     iPreNonGloebalNotesWndGrpId = -1;
   194     iNoNeedClean = EFalse;
   188     iNoNeedClean = EFalse;
   195 	iEnablePriorityChangeOnOriChange = ETrue;
       
   196     }
   189     }
   197 
   190 
   198 
   191 
   199 // ---------------------------------------------------------------------------
   192 // ---------------------------------------------------------------------------
   200 // CPeninputServer::NewL
   193 // CPeninputServer::NewL
   216 // ---------------------------------------------------------------------------
   209 // ---------------------------------------------------------------------------
   217 //
   210 //
   218 void CPeninputServer::ConstructL( )
   211 void CPeninputServer::ConstructL( )
   219     {
   212     {
   220 #ifdef RD_TACTILE_FEEDBACK     
   213 #ifdef RD_TACTILE_FEEDBACK     
       
   214 	//KS: QUICK FIX FOR EGSN-7BCBWS 
   221 	FeatureManager::InitializeLibL();
   215 	FeatureManager::InitializeLibL();
       
   216 	//KS: QUICK FIX FOR EGSN-7BCBWS 
   222    	iSupportFeedback = FeatureManager::FeatureSupported( KFeatureIdTactileFeedback );
   217    	iSupportFeedback = FeatureManager::FeatureSupported( KFeatureIdTactileFeedback );
   223 
   218 
   224 #endif //RD_TACTILE_FEEDBACK   
   219 #endif //RD_TACTILE_FEEDBACK   
   225     
   220     
   226     // start server, leaves if server already running
   221     // start server, leaves if server already running
   267 #endif
   262 #endif
   268     
   263     
   269     iCurScrMode = CCoeEnv::Static()->ScreenDevice()->CurrentScreenMode();
   264     iCurScrMode = CCoeEnv::Static()->ScreenDevice()->CurrentScreenMode();
   270     iCrpService = CPenInputCrpServiceClient::NewL();
   265     iCrpService = CPenInputCrpServiceClient::NewL();
   271     iSensorRepository = CRepository::NewL(KCRUidSensorSettings);
   266     iSensorRepository = CRepository::NewL(KCRUidSensorSettings);
   272     User::LeaveIfError(iDiscreetPopProperty.Attach(KPSUidAvkonDomain, 
       
   273                                          KAknGlobalDiscreetPopupNumChanged));
       
   274     iDiscreetPopSubscriber = new (ELeave) CSubscriber(
       
   275             TCallBack( DiscreetPopChangeNotification, this), 
       
   276             iDiscreetPopProperty);
       
   277     iDiscreetPopSubscriber->SubscribeL();
       
   278     // Get the pop area
       
   279     User::LeaveIfError(iAknUiSrv.Connect());
       
   280     iDiscreetPopArea = iAknUiSrv.GetInUseGlobalDiscreetPopupRect();
       
   281     if(iDiscreetPopArea.Size().iWidth > 0)
       
   282         {
       
   283         HandleDiscreetPopNotification();
       
   284         }
       
   285     }
   267     }
   286 
   268 
   287 void CPeninputServer::CleanAll()
   269 void CPeninputServer::CleanAll()
   288     {
   270     {
   289     if(iNoNeedClean)
   271     if(iNoNeedClean)
   335         delete iFlushTimer;
   317         delete iFlushTimer;
   336         }
   318         }
   337         
   319         
   338 
   320 
   339 #ifdef RD_TACTILE_FEEDBACK
   321 #ifdef RD_TACTILE_FEEDBACK
       
   322 	//KS: QUICK FIX FOR EGSN-7BCBWS 
   340 	FeatureManager::UnInitializeLib();
   323 	FeatureManager::UnInitializeLib();
       
   324 	//KS: QUICK FIX FOR EGSN-7BCBWS 
   341     iFeedbackAreaArray.Close();
   325     iFeedbackAreaArray.Close();
   342 #endif // RD_TACTILE_FEEDBACK    
   326 #endif // RD_TACTILE_FEEDBACK    
   343     delete iPenUiCtrl;
   327     delete iPenUiCtrl;
   344     delete iInternalBackgroundCtrl;
   328     delete iInternalBackgroundCtrl;
   345 
   329 
   346     iClientProcess.Close();
   330     iClientProcess.Close();
   347     iClientLayouts.Close();
   331     iClientLayouts.Close();
   348 #ifdef __LOG_WNDGROU__    
   332 #ifdef __LOG_WNDGROU__    
   349     iLogFile.Close();    
   333     iLogFile.Close();    
   350 #endif
   334 #endif
   351     if (iDiscreetPopSubscriber)
       
   352 	    {
       
   353 	    iDiscreetPopSubscriber->StopSubscribe();
       
   354 	    }
       
   355     iDiscreetPopProperty.Close();
       
   356     delete iDiscreetPopSubscriber;
       
   357     iAknUiSrv.Close();
       
   358     delete iAnimObj;
   335     delete iAnimObj;
   359     iAnimObj = NULL;
   336     iAnimObj = NULL;
   360     
   337     
   361     iNoNeedClean = ETrue;
   338     iNoNeedClean = ETrue;
   362     
   339     
   431 // Activate sprite
   408 // Activate sprite
   432 // ---------------------------------------------------------------------------
   409 // ---------------------------------------------------------------------------
   433 //
   410 //
   434 void CPeninputServer::ActivateSpriteInGlobalNotesL()
   411 void CPeninputServer::ActivateSpriteInGlobalNotesL()
   435     {
   412     {
   436     TBool notDraw = EFalse;
       
   437     
       
   438     if(iUiLayout)
       
   439         {
       
   440         iUiLayout->HandleCommand( ECmdPeninputDisableLayoutDrawing, 
       
   441                                  (unsigned char*)&notDraw );  
       
   442         }
       
   443 
       
   444     // [[[ temporary solution for Virtual keyboard becomes corrupted after several rotations
       
   445     if(!iUiLayout)
       
   446     	{
       
   447         return;
       
   448     	}
       
   449     
       
   450     // we should not be able to activate and show pen ui if this mode is disabled currently
       
   451     TInt inputType = iUiLayout->PenInputType();
       
   452     if( inputType == EPluginInputModeFSQ && iLayoutId.iUid == KPenInputSrvPrtFsqUiId )
       
   453         {
       
   454         inputType = EPluginInputModePortraitFSQ;
       
   455         }
       
   456     if( inputType & DisabledByOrientation() )
       
   457 
       
   458         {
       
   459         // we have activate the animation otherwise we will see the penui but not reponse
       
   460         // when clicking on it in the case we rotating the screen quickly and continously
       
   461         if(iAnimObj)
       
   462             {
       
   463             iAnimObj->AddActivationCmd(ECmdActivate,EFalse);                
       
   464             }
       
   465         return;
       
   466         }
       
   467     // ]]] temporary solution for Virtual keyboard becomes corrupted after several rotations
       
   468     
       
   469     if(iActive)
   413     if(iActive)
   470         {
   414         {
   471         if(iUseWindowCtrl)
   415 	    if(iUseWindowCtrl)
   472             {
   416 	        {
   473 /*            RWsSession &ws = CCoeEnv::Static()->WsSession();
   417 /*            RWsSession &ws = CCoeEnv::Static()->WsSession();
   474             TInt wgId =ws.GetFocusWindowGroup();
   418             TInt wgId =ws.GetFocusWindowGroup();
   475             //TInt wgHandle = ws.GetWindowGroupHandle(wgId);
   419             //TInt wgHandle = ws.GetWindowGroupHandle(wgId);
   476 
   420 
   477       
   421       
   478             TInt priority;
   422     		TInt priority;
   479             //TInt pos;
   423     		//TInt pos;
   480             //wg.Construct(wgHandle);
   424             //wg.Construct(wgHandle);
   481             //pos = wg.FullOrdinalPosition();
   425             //pos = wg.FullOrdinalPosition();
   482             priority = ws.GetWindowGroupOrdinalPriority(wgId);*/
   426             priority = ws.GetWindowGroupOrdinalPriority(wgId);*/
   483             //wg.Close();           
   427             //wg.Close();           
   484             //iPenUiCtrl->ShowPenUi();
   428             //iPenUiCtrl->ShowPenUi();
   485             ActivatePenUiLayout(EFalse);
   429             ActivatePenUiLayout(EFalse);
   486             iDimmed = EFalse;
   430             iDimmed = EFalse;
   487             iPenUiCtrl->ShowPenUiL(iDimmed);            
   431             iPenUiCtrl->ShowPenUiL(iDimmed);            
   488             }
   432 	        }
   489         return;
   433 	    return;
   490         }
   434         }
   491 
   435 
   492     TBool bNeedWait = AnimOpNeedWaiting(ESignalPenUiActivated);
   436         TBool bNeedWait = AnimOpNeedWaiting(ESignalPenUiActivated);
   493     //add animation command
   437         //add animation command
   494         
   438         
   495     /*
   439         /*
   496     if(iAnimObj->AddActivationCmd(ECmdActivate,bNeedWait))
   440         if(iAnimObj->AddActivationCmd(ECmdActivate,bNeedWait))
   497             {
   441         	{
   498             if(bNeedWait)
   442         	if(bNeedWait)
   499                 iForegroundUiHandler->AddDelayedCmd();
   443         		iForegroundUiHandler->AddDelayedCmd();
   500             //iUiLayout->OnActivate();                  
   444 	        //iUiLayout->OnActivate();                  
   501             ActivatePenUiLayout();
   445             ActivatePenUiLayout();
   502             
   446 	        
   503             DrawSprite();        
   447 	        DrawSprite();        
   504             
   448 	        
   505             iEventBufferQueue->GetEvent();
   449 	        iEventBufferQueue->GetEvent();
   506             
   450 	        
   507             iActive = ETrue;                
   451 	        iActive = ETrue;                
   508             
   452 	        
   509             if(iUseWindowCtrl)
   453 	        if(iUseWindowCtrl)
   510                 iPenUiCtrl->ShowPenUi();
   454                 iPenUiCtrl->ShowPenUi();
   511         }
   455             }
   512         */
   456             */
   513     if(ActivatePenUiLayout(bNeedWait))
   457         if(ActivatePenUiLayout(bNeedWait))
   514         {
   458             {
   515         if(bNeedWait)
   459         	if(bNeedWait)
   516             iForegroundUiHandler->AddDelayedCmd();
   460         		iForegroundUiHandler->AddDelayedCmd();
   517             
   461 	        
   518         DrawSprite();                    
   462 	        DrawSprite();        	        
   519             
   463 	        
   520         iActive = ETrue;                
   464 	        iActive = ETrue;                
   521             
   465 	        
   522         if(iUseWindowCtrl)
   466 	        if(iUseWindowCtrl)
   523             {
   467 	            {
   524             /*RWsSession &ws = CCoeEnv::Static()->WsSession();
   468                 /*RWsSession &ws = CCoeEnv::Static()->WsSession();
   525             TInt wgId =ws.GetFocusWindowGroup();
   469                 TInt wgId =ws.GetFocusWindowGroup();
   526             //TInt wgHandle = ws.GetWindowGroupHandle(wgId);
   470                 //TInt wgHandle = ws.GetWindowGroupHandle(wgId);
   527 
   471 
   528             TInt priority;
   472           
   529             //TInt pos;
   473         		TInt priority;
   530             //wg.Construct(wgHandle);
   474         		//TInt pos;
   531             //pos = wg.FullOrdinalPosition();
   475                 //wg.Construct(wgHandle);
   532             priority = ws.GetWindowGroupOrdinalPriority(wgId);*/
   476                 //pos = wg.FullOrdinalPosition();
   533             //wg.Close();           
   477                 priority = ws.GetWindowGroupOrdinalPriority(wgId);*/
   534             iPenUiCtrl->ShowPenUiL(iDimmed);                        
   478                 //wg.Close();           
   535             }
   479                 iPenUiCtrl->ShowPenUiL(iDimmed);            	        
   536         }
   480 	            }
   537     }
   481             }
   538 
   482         }
   539 // ---------------------------------------------------------------------------
   483 // ---------------------------------------------------------------------------
   540 // CPeninputServer::ActivateSprite
   484 // CPeninputServer::ActivateSprite
   541 // Activate sprite
   485 // Activate sprite
   542 // ---------------------------------------------------------------------------
   486 // ---------------------------------------------------------------------------
   543 //
   487 //
   566         iPreNonGloebalNotesWndGrpId = focusApp.iUid;         
   510         iPreNonGloebalNotesWndGrpId = focusApp.iUid;         
   567 
   511 
   568     if(!iUiLayout)
   512     if(!iUiLayout)
   569         return;
   513         return;
   570     
   514     
   571     // [[[ temporary solution for Virtual keyboard becomes corrupted after several rotations
       
   572     // we should not be able to activate and show pen ui if this mode is disabled currently
       
   573     TInt inputType = iUiLayout->PenInputType();
       
   574     if( inputType == EPluginInputModeFSQ && iLayoutId.iUid == KPenInputSrvPrtFsqUiId )
       
   575         {
       
   576         inputType = EPluginInputModePortraitFSQ;
       
   577         }
       
   578     if( inputType & DisabledByOrientation() )
       
   579         {
       
   580         // we have activate the animation otherwise we will see the penui but not reponse 
       
   581         // when clicking on it in the case we rotating the screen quickly and continously
       
   582         if(iAnimObj)
       
   583             {
       
   584             iAnimObj->AddActivationCmd(ECmdActivate,EFalse);
       
   585             }
       
   586         
       
   587         return;
       
   588         }
       
   589     // ]]] temporary solution for Virtual keyboard becomes corrupted after several rotations
       
   590 
       
   591     TBool notDraw = EFalse;
       
   592     iUiLayout->HandleCommand(ECmdPeninputDisableLayoutDrawing,(unsigned char*)&notDraw);
       
   593   
       
   594     // move it out from if(!iActive) to make sure that msg bubble can be 
   515     // move it out from if(!iActive) to make sure that msg bubble can be 
   595     // shown if fast swap from other application to msg application.
   516     // shown if fast swap from other application to msg application.
   596     TBool bNeedWait = AnimOpNeedWaiting(ESignalPenUiActivated);
   517     TBool bNeedWait = AnimOpNeedWaiting(ESignalPenUiActivated);
   597  
   518  
   598     if(!iActive)
   519     if(!iActive)
   610         //TBool bNeedWait = AnimOpNeedWaiting(ESignalPenUiActivated);
   531         //TBool bNeedWait = AnimOpNeedWaiting(ESignalPenUiActivated);
   611         //add animation command
   532         //add animation command
   612         
   533         
   613         /*
   534         /*
   614         if(iAnimObj->AddActivationCmd(ECmdActivate,bNeedWait))
   535         if(iAnimObj->AddActivationCmd(ECmdActivate,bNeedWait))
   615             {
   536         	{
   616             if(bNeedWait)
   537         	if(bNeedWait)
   617                 iForegroundUiHandler->AddDelayedCmd();
   538         		iForegroundUiHandler->AddDelayedCmd();
   618             //iUiLayout->OnActivate();                  
   539 	        //iUiLayout->OnActivate();                  
   619             ActivatePenUiLayout();
   540             ActivatePenUiLayout();
   620             
   541 	        
   621             DrawSprite();        
   542 	        DrawSprite();        
   622             
   543 	        
   623             iEventBufferQueue->GetEvent();
   544 	        iEventBufferQueue->GetEvent();
   624             
   545 	        
   625             iActive = ETrue;                
   546 	        iActive = ETrue;                
   626             
   547 	        
   627             if(iUseWindowCtrl)
   548 	        if(iUseWindowCtrl)
   628                 iPenUiCtrl->ShowPenUi();
   549                 iPenUiCtrl->ShowPenUi();
   629             }
   550             }
   630             */
   551             */
   631             
   552             
   632         if(ActivatePenUiLayout(bNeedWait, ETrue))
   553         if(ActivatePenUiLayout(bNeedWait, ETrue))
   633             {
   554             {
   634             if(bNeedWait)
   555         	if(bNeedWait)
   635                 iForegroundUiHandler->AddDelayedCmd();
   556         		iForegroundUiHandler->AddDelayedCmd();
   636             
   557 	        
   637             DrawSprite();                    
   558 	        DrawSprite();        	        
   638             
   559 	        
   639             iActive = ETrue;                
   560 	        iActive = ETrue;                
   640             
   561 	        
   641             if(iUseWindowCtrl)
   562 	        if(iUseWindowCtrl)
   642                 {
   563 	            {
   643                 TRAP_IGNORE( iPenUiCtrl->ShowPenUiL(iDimmed) );                        
   564                 TRAP_IGNORE( iPenUiCtrl->ShowPenUiL(iDimmed) );            	        
   644                                        
   565                            	        
   645                 if (iPreNonGloebalNotesWndGrpId != focusApp.iUid &&
   566 		        if (iPreNonGloebalNotesWndGrpId != focusApp.iUid &&
   646                     IsGlobalNotesApp(focusApp) && !iInGlobalEditorState )
   567 		            IsGlobalNotesApp(focusApp) && !iInGlobalEditorState )
   647                     {
   568 		            {
   648                     iDimmed = ETrue;
   569 	                iDimmed = ETrue;
   649                     DimPenUi();                
   570 	                DimPenUi();                
   650                     }
   571 		            }
   651                 }
   572 	            }
   652             }
   573             }
   653         iIsLayoutReDrawAllowWhenActive = EFalse;    
       
   654         }
   574         }
   655     else
   575     else
   656         {
   576         {
   657         //actived but dimmed by global notes
   577         //actived but dimmed by global notes
   658         if(iUseWindowCtrl)
   578         if(iUseWindowCtrl)
   659             {
   579             {
   660             /**
   580             ActivatePenUiLayout(EFalse);
   661             * 1. IF THE GLOBAL NOTES HAS BEEN OPENED UP, WE NEED TO REDRAW THE LAYOUT
       
   662             * 2. IF iIsLayoutReDrawAllowWhenActive was set to be ETrue. 
       
   663             *    if we did not put this condition guard, the layout
       
   664             *    redraw will be executed even if the layout is active. But if this flag is
       
   665             *    set to be ture, layout redraw will be carried out even if the layout is active, so
       
   666             *    it will leave this for layout to decide if it need set this flag to be ture or false
       
   667             *    in some special cases: for example for entering and exiting the spell mode.
       
   668             *    
       
   669             */
       
   670             if(iInGlobalNotesApp || iInGlobalEditorState || iIsLayoutReDrawAllowWhenActive )
       
   671                 {
       
   672                 ActivatePenUiLayout(EFalse);
       
   673                 if(iIsLayoutReDrawAllowWhenActive)
       
   674                     {
       
   675                     iIsLayoutReDrawAllowWhenActive = EFalse;    
       
   676                     }
       
   677                 }
       
   678             else
       
   679                 {
       
   680                 ActivatePenUiLayout(EFalse,ETrue);
       
   681                 }
       
   682 
   581 
   683             if (iDimmed && (iInGlobalNotesApp || iInGlobalEditorState))
   582             if (iDimmed && (iInGlobalNotesApp || iInGlobalEditorState))
   684                 {
   583                 {
   685                 DeactivatePenUiLayout(EFalse);                
   584                 DeactivatePenUiLayout(EFalse);                
   686                 return;
   585                 return;
   687                 }             
   586                 }             
   688             
   587             
   689             TRAP_IGNORE( iPenUiCtrl->ShowPenUiL(iDimmed) );
   588             TRAP_IGNORE( iPenUiCtrl->ShowPenUiL(iDimmed) );
   690             iDimmed = EFalse;
   589             iDimmed = EFalse;
   691             }
   590             }
   692         }                  
   591         }				  
   693     }
   592     }
   694 
   593 
   695 // ---------------------------------------------------------------------------
   594 // ---------------------------------------------------------------------------
   696 // CPeninputServer::ActivatePenUiLayout
   595 // CPeninputServer::ActivatePenUiLayout
   697 // ---------------------------------------------------------------------------
   596 // ---------------------------------------------------------------------------
   746     {
   645     {
   747     RecoverSimulatedKeyEventState();    
   646     RecoverSimulatedKeyEventState();    
   748     if(aFlag)
   647     if(aFlag)
   749         {
   648         {
   750         iEventBufferQueue->Cancel();                   
   649         iEventBufferQueue->Cancel();                   
   751         if( iUiLayout )
   650         iUiLayout->OnDeActivate(); 
   752         	{
       
   753 			iUiLayout->OnDeActivate(); 
       
   754         	}
       
   755         if(iUseWindowCtrl)
   651         if(iUseWindowCtrl)
   756             iPenUiCtrl->OnDeactivate(); //disable non fading                     
   652             iPenUiCtrl->OnDeactivate(); //disable non fading                     
   757         }
   653         }
   758     else
   654     else
   759         {
   655         {
   760         iEventBufferQueue->GetEvent();                   
   656         iEventBufferQueue->GetEvent();                   
   761         if( iUiLayout )
   657         iUiLayout->OnActivate(); 
   762         	{
       
   763 			iUiLayout->OnActivate(); 
       
   764         	}
       
   765         if(iUseWindowCtrl)
   658         if(iUseWindowCtrl)
   766             iPenUiCtrl->OnActivate(CPenUiWndCtrl::ENoremalEditor); //disable non fading                             
   659             iPenUiCtrl->OnActivate(CPenUiWndCtrl::ENoremalEditor); //disable non fading                             
   767         }
   660         }
   768     
   661     
   769     }
   662     }
  1198                 iPenUiCtrl->SetResourceChange(iResourceChange);                           
  1091                 iPenUiCtrl->SetResourceChange(iResourceChange);                           
  1199             } 
  1092             } 
  1200             break;
  1093             break;
  1201     	case EPeninputRequestSupportInputMode:
  1094     	case EPeninputRequestSupportInputMode:
  1202     	    {
  1095     	    {
  1203     	    TInt language = 0;
  1096             TInt supportMode = GetSupportModeL();
  1204     	    TPckg<TInt> msgLanguage( language );
  1097 
  1205     	    aMessage.ReadL( 1, msgLanguage );    	    
  1098             TPckg<TInt> msg(supportMode);
  1206     	    TInt supportMode = GetSupportModeByLanguageL( language );                      
  1099             
  1207             TPckg<TInt> msg(supportMode);           
       
  1208             aMessage.WriteL(0,msg);
  1100             aMessage.WriteL(0,msg);
  1209     	    }
  1101     	    }
  1210     	    break;            
  1102     	    break;            
  1211             
       
  1212     	case EPeninputRequestSetInputLanguage:
       
  1213     		{
       
  1214 			TPckg<TInt> msg(iInputLanguage);
       
  1215 			aMessage.ReadL(0,msg); 
       
  1216 			if(iUiLayout)
       
  1217 				{
       
  1218 				iUiLayout->HandleCommand(ECmdPenInputLanguage,
       
  1219 						                 (unsigned char*)&iInputLanguage);  
       
  1220 				}
       
  1221     	    }
       
  1222     	    break;
       
  1223         case EPeninputEnablePriorityChangeOnOriChange:
       
  1224             {
       
  1225 			TPckg<TBool> enablePriority( iEnablePriorityChangeOnOriChange );
       
  1226             aMessage.ReadL( 0, enablePriority );
       
  1227 			}
       
  1228         default: //Let user pluging handling the user command
  1103         default: //Let user pluging handling the user command
  1229             break;
  1104             break;
  1230         }
  1105         }
  1231     return err;
  1106     return err;
  1232     }
  1107     }
  1294 
  1169 
  1295     //clear sprite before delete ui layout
  1170     //clear sprite before delete ui layout
  1296     iUILayoutReady = EFalse;    
  1171     iUILayoutReady = EFalse;    
  1297     if(iUiLayout)
  1172     if(iUiLayout)
  1298         {
  1173         {
  1299         //if(!iUseWindowCtrl)
  1174 		ClearSpriteGc();
  1300         	//{
       
  1301 			//ClearSpriteGc();
       
  1302         	//}
       
  1303         DeactivateSprite();
  1175         DeactivateSprite();
  1304         iDestroyingLayout = ETrue;
  1176         iDestroyingLayout = ETrue;
  1305         if(iUseWindowCtrl)
       
  1306 		   {
       
  1307 		   if(iPenUiCtrl)
       
  1308 		       {
       
  1309 			   iPenUiCtrl->Clean();
       
  1310 			   }
       
  1311 		   }
       
  1312         iUiLayout->Destroy();
  1177         iUiLayout->Destroy();
  1313         iUiLayout = NULL;    
  1178         iUiLayout = NULL;    
  1314         iDestroyingLayout = EFalse;
  1179         iDestroyingLayout = EFalse;
  1315         if(iAnimObj)
  1180         if(iAnimObj)
  1316             {
  1181             {
  1410         {        
  1275         {        
  1411         iOpaqueUi = ETrue;
  1276         iOpaqueUi = ETrue;
  1412         iUseWindowCtrl = ETrue;
  1277         iUseWindowCtrl = ETrue;
  1413 
  1278 
  1414         if(iUseWindowCtrl)
  1279         if(iUseWindowCtrl)
  1415             {
  1280             {            
  1416 #ifdef FIX_FOR_NGA
  1281         iPenUiCtrl->SetExtent(layoutRect.iTl,layoutSize);
  1417             TBool flag = ETrue;
       
  1418             iUiLayout->HandleCommand(ECmdPeninputEnableOwnBitmap,reinterpret_cast<TUint8*>(&flag));
       
  1419 #endif            
       
  1420             iPenUiCtrl->SetExtent(layoutRect.iTl,layoutSize);
       
  1421             if(iAnimObj)
  1282             if(iAnimObj)
  1422                 {
  1283                 {
  1423                 iAnimObj->AddEnalbeSpriteCmd(EFalse);
  1284                 iAnimObj->AddEnalbeSpriteCmd(EFalse);
  1424                 }
  1285                 }
  1425         //must swap back when using window background
  1286         //must swap back when using window background
  1638 // ---------------------------------------------------------------------------
  1499 // ---------------------------------------------------------------------------
  1639 //
  1500 //
  1640 void CPeninputServer::DrawSprite()
  1501 void CPeninputServer::DrawSprite()
  1641     {
  1502     {
  1642 
  1503 
  1643     if(!iUiLayout || iActive)
  1504     if(!iUiLayout)
  1644         return;
  1505         return;
  1645     ClearSpriteGc();
  1506     ClearSpriteGc();
  1646     
  1507     
  1647     iUiLayout->Draw();
  1508     iUiLayout->Draw();
  1648 
  1509 
  1684     if (!iActive) //only update when sprite is active
  1545     if (!iActive) //only update when sprite is active
  1685         return;
  1546         return;
  1686     
  1547     
  1687     if(iUseWindowCtrl)
  1548     if(iUseWindowCtrl)
  1688         {        
  1549         {        
  1689 #ifdef FIX_FOR_NGA
  1550         iPenUiCtrl->Invalidate(aRect,EFalse);
  1690 		iPenUiCtrl->Invalidate(TRect( TPoint(0,0), LayoutRect().Size()),EFalse);
       
  1691 #else
       
  1692 		iPenUiCtrl->Invalidate(aRect,EFalse);
       
  1693 #endif
       
  1694         return;
  1551         return;
  1695         } 
  1552         } 
  1696 	
  1553 	
  1697 	        TRect rect;
  1554 	        TRect rect;
  1698         if(aRect.IsEmpty())
  1555         if(aRect.IsEmpty())
  1767         {
  1624         {
  1768         DeactivateSprite();
  1625         DeactivateSprite();
  1769         }
  1626         }
  1770     else
  1627     else
  1771         {
  1628         {
  1772         if(!iActive)
  1629         ActivateSprite();
  1773             {
       
  1774             ActivateSprite();
       
  1775             }
       
  1776         }
  1630         }
  1777     }
  1631     }
  1778 
  1632 
  1779 // ---------------------------------------------------------------------------
  1633 // ---------------------------------------------------------------------------
  1780 // CPeninputServer::LayoutSizeChanged
  1634 // CPeninputServer::LayoutSizeChanged
  2006             	    
  1860             	    
  2007             	    iPenUiCtrl->ShowPopup( rectInScreen, rectInLayout, rectTrimLayout );
  1861             	    iPenUiCtrl->ShowPopup( rectInScreen, rectInLayout, rectTrimLayout );
  2008             	    }
  1862             	    }
  2009         	    }
  1863         	    }
  2010         	    break;
  1864         	    break;
  2011             case ESignalEnableLayoutRedrawWhenActive:
  1865 
  2012                 {
  1866         	case ESignalPopupWndClosed:
  2013 				TUint16* buf = const_cast<TUint16* >( aEventData.Ptr() );    
  1867         	    {        	    
  2014                 TBool* retVal = reinterpret_cast< TBool* > ( buf );
  1868         	    if(iUseWindowCtrl)
  2015 				iIsLayoutReDrawAllowWhenActive = *retVal;
  1869         	        {
  2016 				}
  1870         	        iPenUiCtrl->ClosePopup();
  2017 				break;	
  1871         	        }
  2018 
  1872         	    }
       
  1873         	    break;
  2019         	default:
  1874         	default:
  2020         	    if(iUseWindowCtrl)                    
       
  2021         	        {
       
  2022                     iPenUiCtrl->HandleNGASpecificSignal(aEventType, aEventData);
       
  2023         	        }
       
  2024         		break;
  1875         		break;
  2025         	}
  1876         	}
  2026         }
  1877         }
  2027 
  1878 
  2028     }
  1879     }
  2121 // CPeninputServer::HandleResourceChange
  1972 // CPeninputServer::HandleResourceChange
  2122 // Handle application resource change
  1973 // Handle application resource change
  2123 // ---------------------------------------------------------------------------
  1974 // ---------------------------------------------------------------------------
  2124 //    
  1975 //    
  2125 void CPeninputServer::HandleResourceChange(TInt aType)
  1976 void CPeninputServer::HandleResourceChange(TInt aType)
  2126     {
  1977     {   
  2127 	// Update the cursor color when resource is changed
  1978     if(iUiLayout && !(iUiLayout->PenInputType() & DisabledByOrientation()) )
  2128 	iPenUiCtrl->SetCursorColor();
  1979         {
  2129 	
  1980         //hide the layout if it's already shown
  2130 	#ifdef FIX_FOR_NGA 
       
  2131 	// iEnablePriorityChangeOnOriChange will be set to be EFalse, if some dialog in FEP end were opened and 
       
  2132 	// not close after rotation for example: Symbol Table, Writing Language list and Match Dialog on ITI
       
  2133 	if(iUiLayout && iActive && iEnablePriorityChangeOnOriChange && aType == KEikDynamicLayoutVariantSwitch)
       
  2134         {
       
  2135         TPixelsTwipsAndRotation size; 
       
  2136         CCoeEnv::Static()->ScreenDevice()->GetDefaultScreenSizeAndRotation(size);
       
  2137                 
       
  2138         TBool isPortrait = ( size.iPixelSize.iWidth < size.iPixelSize.iHeight );
       
  2139    
       
  2140         TBool needToLiftUp = EFalse;
       
  2141         TInt inputMode = 0; 
       
  2142         inputMode = iUiLayout->PenInputType();
       
  2143         
  1981         
  2144         // If input mode is either ITU-T or portrait FSQ, and if orientation 
  1982         iUiLayout->OnResourceChange(aType);
  2145         // is changed to landscape, highest priority is given to Pen UI to avoid 
       
  2146         // flickering problem while drawing landscape FSQ layout.        
       
  2147         if( inputMode == EPluginInputModeItut ||
       
  2148           ( inputMode == EPluginInputModeFSQ && 
       
  2149             iLayoutId.iUid == KPenInputSrvPrtFsqUiId ) )
       
  2150             {
       
  2151             if(!isPortrait)
       
  2152                 {
       
  2153                 needToLiftUp = ETrue;
       
  2154                 }
       
  2155             }
       
  2156         else if(inputMode == EPluginInputModeFSQ)
       
  2157             {
       
  2158             if(isPortrait)
       
  2159                 {
       
  2160                 needToLiftUp = ETrue;
       
  2161                 }
       
  2162             }
       
  2163     
       
  2164         else if(inputMode == EPluginInputModeFingerHwr)
       
  2165             {
       
  2166             ClearSpriteGc();
       
  2167             //Close the UI immediately, without notify UI handler 
       
  2168             DeactivateSprite(ETrue, ETrue);
       
  2169             }
       
  2170         if(needToLiftUp)
       
  2171             {
       
  2172             if(iPenUiCtrl)
       
  2173                 {
       
  2174                 
       
  2175                 // must lift up the wnd group priority otherwise when rotating screen, the underling application will show first and then
       
  2176                 // our PEN UI, but we should keep an eye on this issue. If NGA will fix the fliker assigned on them, we will check if it will
       
  2177                 // work if we remove this line of code. 
       
  2178                 iPenUiCtrl->LiftUpPriority();				
       
  2179                 }
       
  2180             }
       
  2181         }
       
  2182 	#endif	
       
  2183     if( iUiLayout )
       
  2184         {
       
  2185         TInt inputType = iUiLayout->PenInputType();
       
  2186         if( inputType == EPluginInputModeFSQ && iLayoutId.iUid == KPenInputSrvPrtFsqUiId )
       
  2187             {
       
  2188             inputType = EPluginInputModePortraitFSQ;
       
  2189             }
       
  2190         if( !( inputType & DisabledByOrientation() ) )
       
  2191             {
       
  2192             //hide the layout if it's already shown
       
  2193         
       
  2194             if ( iActive )
       
  2195                 {
       
  2196                 iUiLayout->OnActivate();  
       
  2197                 }  
       
  2198         
       
  2199             iUiLayout->OnResourceChange(aType);
       
  2200         
       
  2201             if(iUseWindowCtrl)
       
  2202                 {
       
  2203                 iPenUiCtrl->DrawNow();
       
  2204                 }
       
  2205             }
       
  2206             
       
  2207         //show the layout if it's active
  1983         //show the layout if it's active
  2208         }
  1984         }
  2209     }
  1985     }
  2210 
  1986 
  2211 // ---------------------------------------------------------------------------
  1987 // ---------------------------------------------------------------------------
  2301             iPenUiCtrl->ClosePenUi(ETrue);
  2077             iPenUiCtrl->ClosePenUi(ETrue);
  2302             iActive = EFalse;
  2078             iActive = EFalse;
  2303             }
  2079             }
  2304         return;    
  2080         return;    
  2305         }
  2081         }
  2306 */    
  2082 */    if(iActive && !iPrevActive && 
  2307     TInt inputMode = iUiLayout ? iUiLayout->PenInputType() : EPluginInputModeNone;
  2083        iUiLayout->PenInputType() != EPluginInputModeFSQ && 
  2308 	
  2084        iBackgroudDefaultOri == CAknAppUiBase::EAppUiOrientationUnspecified )
  2309     TBool isArabicFingerInput = (inputMode == EPluginInputModeFingerHwr && iInputLanguage == ELangArabic);
  2085         {
  2310     
  2086         
  2311     if(isArabicFingerInput)
       
  2312         {
       
  2313         return;
       
  2314         }
       
  2315     
       
  2316     // Both landscape and portrait FSQs are handled as EPluginInputModeFSQ
       
  2317     // in Pen Input server. iLayoutId can be used to check it's landscape or
       
  2318     // portrait.
       
  2319     TBool isLandscapeFSQ = 
       
  2320         ( inputMode == EPluginInputModeFSQ && 
       
  2321           iLayoutId.iUid != KPenInputSrvPrtFsqUiId )
       
  2322          ? ETrue : EFalse;
       
  2323     
       
  2324     if ( iActive && !iPrevActive && !isLandscapeFSQ && 
       
  2325          iBackgroudDefaultOri == CAknAppUiBase::EAppUiOrientationUnspecified )
       
  2326         {
       
  2327         #ifdef FIX_FOR_NGA
       
  2328         if(inputMode == EPluginInputModeFingerHwr)
       
  2329             {
       
  2330             iPrevActive = ETrue;
       
  2331             ClearSpriteGc();
       
  2332             //Close the UI immediately, without notify UI handler 
       
  2333             DeactivateSprite(ETrue, ETrue);
       
  2334             }
       
  2335         else
       
  2336             {// for other input mode: we are not going to cose UI, since it will cause
       
  2337              // serious fliker: which will have the mixed ui(with other app ui) on pen input ui
       
  2338             
       
  2339 			if(iUiLayout)
       
  2340 			    {
       
  2341 				//TBool notDraw = ETrue;
       
  2342 	            //iUiLayout->HandleCommand(ECmdPeninputDisableLayoutDrawing,(unsigned char*)&notDraw);
       
  2343 	            iUiLayout->OnDeActivate();
       
  2344 			    }
       
  2345             }       
       
  2346         #else
       
  2347         iPrevActive = ETrue;
  2087         iPrevActive = ETrue;
  2348         ClearSpriteGc();
  2088         ClearSpriteGc();
  2349         //Close the UI immediately, without notify UI handler 
  2089 	    //Close the UI immediately, without notify UI handler 
  2350         DeactivateSprite(ETrue, ETrue);
  2090 	    DeactivateSprite(ETrue, ETrue);
  2351         #endif
       
  2352         }    
  2091         }    
  2353     }
  2092     }
  2354     
  2093     
  2355 // ---------------------------------------------------------------------------
  2094 // ---------------------------------------------------------------------------
  2356 // CPeninputServer::SetDisabledLayouts
  2095 // CPeninputServer::SetDisabledLayouts
  2359 //    
  2098 //    
  2360 TInt CPeninputServer::SetDisabledLayouts( TInt aDisabledLayouts )
  2099 TInt CPeninputServer::SetDisabledLayouts( TInt aDisabledLayouts )
  2361     {
  2100     {
  2362     // No spcified logic now, so just store the disabled layout in the CFepUiLayoutBase class.
  2101     // No spcified logic now, so just store the disabled layout in the CFepUiLayoutBase class.
  2363     TInt allowedPlugin = EPluginInputModeNone;// EPluginInputModeHwr | EPluginInputModeVkb | EPluginInputModeItut | EPluginInputModeFSc;
  2102     TInt allowedPlugin = EPluginInputModeNone;// EPluginInputModeHwr | EPluginInputModeVkb | EPluginInputModeItut | EPluginInputModeFSc;
  2364     TInt curLanguage = iInputLanguage;
  2103     
       
  2104     CRepository* repository = NULL;
       
  2105     TRAPD(ret, repository = CRepository::NewL(KCRUidAknFep));
       
  2106     if (ret != KErrNone)
       
  2107         {
       
  2108         return EPluginInputModeAll;
       
  2109         }
       
  2110     TInt curLanguage ;
       
  2111     repository->Get(KAknFepInputTxtLang, curLanguage);
       
  2112     delete repository;
  2365     
  2113     
  2366     if (curLanguage == 401) curLanguage = 102;
  2114     if (curLanguage == 401) curLanguage = 102;
  2367     if (curLanguage == 402) curLanguage = 103;
  2115     if (curLanguage == 402) curLanguage = 103;
  2368 
  2116 
  2369     
  2117     
  2470 void CPeninputServer::HandleRawEventL(const TRawEvent& aEvent)
  2218 void CPeninputServer::HandleRawEventL(const TRawEvent& aEvent)
  2471     {
  2219     {
  2472     if(iActive)
  2220     if(iActive)
  2473         { 
  2221         { 
  2474         if( aEvent.Type() == TRawEvent::ENone && 
  2222         if( aEvent.Type() == TRawEvent::ENone && 
  2475         	aEvent.IsTip() 
  2223         	aEvent.IsTip() &&
  2476         	&& iCrpService && iCrpService->IsDsaActive() )
  2224         	iCrpService->IsDsaActive() )
  2477             {
  2225             {
  2478             SignalOwner( ESignalLayoutClosed, KNullDesC );    
  2226             SignalOwner( ESignalLayoutClosed, KNullDesC );    
  2479             }
  2227             }
  2480                    
  2228                    
  2481         TBool handled = iUiLayout ? iUiLayout->HandleEventL(ERawEvent,&aEvent)
  2229         TBool handled = iUiLayout->HandleEventL(ERawEvent,&aEvent);
  2482         		        : EFalse;
       
  2483 
  2230 
  2484         if (TRawEvent::EButton1Down == aEvent.Type())
  2231         if (TRawEvent::EButton1Down == aEvent.Type())
  2485             {
  2232             {
  2486             iLastRawEvent = aEvent;     
  2233             iLastRawEvent = aEvent;     
  2487             }
  2234             }
  2541                     DeactivatePenUiLayout(EFalse);
  2288                     DeactivatePenUiLayout(EFalse);
  2542                     iPenUiCtrl->DimPenUiForMenu();
  2289                     iPenUiCtrl->DimPenUiForMenu();
  2543                     break;
  2290                     break;
  2544                     }
  2291                     }
  2545                 */
  2292                 */
  2546                 if( IsGlobalNotesApp(focusApp) )
  2293                 if(IsGlobalNotesApp(focusApp))
  2547                     {
  2294                         {
  2548                     iInGlobalNotesState = ETrue;
  2295                         iInGlobalNotesState = ETrue; 	             
  2549                     // add this to enable global dim   
  2296                         break;            
  2550                     DeactivatePenUiLayout(EFalse);           
  2297                         }
  2551                     break;            
       
  2552                     }
       
  2553                     
  2298                     
  2554 /*                else if (focusApp.iUid == 0x102750f0)
  2299 /*                else if (focusApp.iUid == 0x102750f0)
  2555                     {
  2300                     {
  2556                     DeactivateSprite();    
  2301                     DeactivateSprite();    
  2557                     }
  2302                     }
  2558 */               else
  2303 */                else
  2559                     {
  2304                     {
  2560                     if(iInGlobalNotesState)
  2305                         if(iInGlobalNotesState)
  2561                         {			  
  2306                             {			  
  2562                         //fix for fast swap case
  2307                             //fix for fast swap case
  2563                         iInGlobalNotesState = EFalse;                        
  2308                         iInGlobalNotesState = EFalse;                        
  2564                         if(iPreNonGloebalNotesWndGrpId != focusApp.iUid )
  2309                         if(iPreNonGloebalNotesWndGrpId != focusApp.iUid)
  2565                             {                            
  2310                             {                            
  2566                             iPreNonGloebalNotesWndGrpId = focusApp.iUid;
  2311                             iPreNonGloebalNotesWndGrpId = focusApp.iUid;    
       
  2312              
  2567                             DeactivateSprite(ETrue);//hide pen ui immediately if switched to another application
  2313                             DeactivateSprite(ETrue);//hide pen ui immediately if switched to another application
  2568                             // Notify FEP to close touch input window.
  2314                             iForegroundSession = NULL;
  2569                             // Under this case, touch input window can't be closed without norifying FEP side.
       
  2570                             // After close touch input window, FEP must change some states.
       
  2571                             SignalOwner( ESignalDeactivateSprite, KNullDesC );                            
       
  2572                             }
  2315                             }
  2573                         }
  2316                         }
  2574                     else
  2317                     else
  2575                         {
  2318                         {
  2576                         DeactivateSprite(ETrue);
  2319                         DeactivateSprite(ETrue);
  2577                         }
  2320                         }
  2578                     }
  2321                     }
  2579                 break;                            
  2322                         break;                            
  2580                 }   
  2323                 }   
  2581             DeactivateSprite(ETrue);//hide pen ui immediately
  2324             DeactivateSprite(ETrue);//hide pen ui immediately
  2582     	    }
  2325     	    }
  2583         break;		    
  2326         break;		    
  2584         default:
  2327         default:
  2674         {
  2417         {
  2675         return EFalse;
  2418         return EFalse;
  2676         }
  2419         }
  2677     if(iForegroundUiHandler)
  2420     if(iForegroundUiHandler)
  2678         {
  2421         {
  2679 		TInt uiType = iUiLayout  ? iUiLayout->PenInputType() : EPluginInputModeNone;
  2422         TInt uiType = iUiLayout->PenInputType();
  2680         bNeedWait = iForegroundUiHandler->SignalUiActivationObserver(
  2423         bNeedWait = iForegroundUiHandler->SignalUiActivationObserver(
  2681                                             			aSignalCode,uiType);
  2424                                             			aSignalCode,uiType);
  2682         }	
  2425         }	
  2683     return bNeedWait;
  2426     return bNeedWait;
  2684 	}
  2427 	}
  2702         }
  2445         }
  2703     }
  2446     }
  2704 
  2447 
  2705 void CPeninputServer::RecoverButtonEventState()
  2448 void CPeninputServer::RecoverButtonEventState()
  2706     {
  2449     {
  2707 	if(!iUiLayout)
       
  2708 		{
       
  2709 		return;
       
  2710 		}
       
  2711 	
       
  2712         if (TRawEvent::EButton1Down == iLastRawEvent.Type())
  2450         if (TRawEvent::EButton1Down == iLastRawEvent.Type())
  2713             {
  2451             {
  2714             iLastRawEvent.Set(TRawEvent::EButton1Up);//,iLastSimulatedKeyEvent.ScanCode()
  2452             iLastRawEvent.Set(TRawEvent::EButton1Up);//,iLastSimulatedKeyEvent.ScanCode()
  2715             TRAP_IGNORE( iUiLayout->HandleEventL(ERawEvent,&iLastRawEvent) ); 
  2453             TRAP_IGNORE( iUiLayout->HandleEventL(ERawEvent,&iLastRawEvent) ); 
  2716             }
  2454             }
  2933                     {
  2671                     {
  2934                     return disabled |= EPluginInputModeFSQ;
  2672                     return disabled |= EPluginInputModeFSQ;
  2935                     }
  2673                     }
  2936                 if( size.iPixelSize.iWidth > size.iPixelSize.iHeight )
  2674                 if( size.iPixelSize.iWidth > size.iPixelSize.iHeight )
  2937                     {
  2675                     {
  2938                     // Portrait input modes which are ITU-T and Portrait FSQ
  2676                     return disabled |= EPluginInputModeItut;
  2939                     // should be disabled in portrait orientation. 
       
  2940                     // Note: no need to check feature flag because if it is not
       
  2941                     // turned on, EPluginInputModePortraitFSQ will not be handled 
       
  2942                     // at all so adding it to "disabled" will take no effect.
       
  2943                     disabled |= EPluginInputModeItut | EPluginInputModePortraitFSQ;
       
  2944 
       
  2945                     return disabled;
       
  2946                     }
  2677                     }
  2947                 }
  2678                 }
  2948             }
  2679             }
  2949         }
  2680         }
  2950     return disabled;
  2681     return disabled;
  2951     }
  2682     }
  2952 
  2683 
  2953 TInt CPeninputServer::GetSupportModeL()
  2684 TInt CPeninputServer::GetSupportModeL()
  2954     {
  2685     {
  2955     TInt curLanguage = iInputLanguage;
  2686     CRepository* repository = NULL;
       
  2687     TRAPD(ret, repository = CRepository::NewL(KCRUidAknFep));
       
  2688     if (ret != KErrNone)
       
  2689         {
       
  2690         return ret;
       
  2691         }
       
  2692     TInt curLanguage ;
       
  2693     repository->Get(KAknFepInputTxtLang, curLanguage);
       
  2694     delete repository;
       
  2695     repository = NULL;
  2956     
  2696     
  2957     if (curLanguage == 401) curLanguage = 102;
  2697     if (curLanguage == 401) curLanguage = 102;
  2958     if (curLanguage == 402) curLanguage = 103;    	    
  2698     if (curLanguage == 402) curLanguage = 103;    	    
  2959     
  2699     
  2960     
  2700     
  2972             }
  2712             }
  2973         tempMode<<=1;
  2713         tempMode<<=1;
  2974         }    
  2714         }    
  2975     return supportMode;
  2715     return supportMode;
  2976     }
  2716     }
  2977 
  2717     
  2978 TInt CPeninputServer::GetSupportModeByLanguageL( TInt aInputLanguage )
       
  2979 	{
       
  2980     TInt curLanguage = aInputLanguage;
       
  2981     
       
  2982     if ( curLanguage == 401 )
       
  2983     	{
       
  2984         curLanguage = 102;
       
  2985     	}    
       
  2986     if (curLanguage == 402)
       
  2987     	{
       
  2988         curLanguage = 103;
       
  2989     	}        
       
  2990     TInt supportMode = EPluginInputModeNone;
       
  2991     TInt tempMode = EPluginInputModeHwr;
       
  2992     
       
  2993     iLayoutEng->InitializeL();
       
  2994     
       
  2995     while ( tempMode < EPluginInputModeAll )
       
  2996         {
       
  2997         if ( iLayoutEng->IsSupportPluginMode( ( TLanguage )curLanguage, 
       
  2998                                               ( TPluginInputMode )tempMode ) )
       
  2999             {
       
  3000             supportMode |= tempMode;
       
  3001             }
       
  3002         tempMode<<=1;
       
  3003         }    
       
  3004     return supportMode;	
       
  3005 	}
       
  3006 	
       
  3007 // ---------------------------------------------------------------------------
       
  3008 // CPeninputServer::DiscreetPopChangeNotification
       
  3009 // handle notification of discreept pop changing
       
  3010 // ---------------------------------------------------------------------------
       
  3011 // 
       
  3012 TInt CPeninputServer::DiscreetPopChangeNotification(TAny* aObj)
       
  3013     {
       
  3014     if (aObj)
       
  3015         {
       
  3016         static_cast<CPeninputServer*>(aObj)->HandleDiscreetPopNotification();
       
  3017         return KErrNone;
       
  3018         }
       
  3019     else
       
  3020         {
       
  3021         return KErrArgument;
       
  3022         }
       
  3023     }
       
  3024 // ---------------------------------------------------------------------------
       
  3025 // CPeninputServer::HandleDiscreetPopNotification
       
  3026 // handle notification of discreept pop changing
       
  3027 // ---------------------------------------------------------------------------
       
  3028 // 
       
  3029 void CPeninputServer::HandleDiscreetPopNotification()
       
  3030     {
       
  3031 	iDiscreetPopArea = iAknUiSrv.GetInUseGlobalDiscreetPopupRect();
       
  3032 	iAnimObj->SetDiscreetPopArea(iDiscreetPopArea);
       
  3033     }
       
  3034 // ======== class CEventQueue========
  2718 // ======== class CEventQueue========
  3035 //
  2719 //
  3036 // ---------------------------------------------------------------------------
  2720 // ---------------------------------------------------------------------------
  3037 // CEventQueue::CEventQueue
  2721 // CEventQueue::CEventQueue
  3038 // Constructor. Adds the active object to the active scheduler
  2722 // Constructor. Adds the active object to the active scheduler
  3238 //
  2922 //
  3239 GLDEF_C void PanicServer(TPeninputServerPanic aPanic)
  2923 GLDEF_C void PanicServer(TPeninputServerPanic aPanic)
  3240     {
  2924     {
  3241     User::Panic( KPeninputServerName, aPanic );
  2925     User::Panic( KPeninputServerName, aPanic );
  3242     } 
  2926     } 
  3243 	
       
  3244 // ======== class CSubscriber========
       
  3245 //
       
  3246 CSubscriber::CSubscriber(TCallBack aCallBack, RProperty& aProperty)
       
  3247     :
       
  3248     CActive(EPriorityNormal), iCallBack(aCallBack), iProperty(aProperty)
       
  3249     {
       
  3250     CActiveScheduler::Add(this);
       
  3251     }
       
  3252 
       
  3253 CSubscriber::~CSubscriber()
       
  3254     {
       
  3255     Cancel();
       
  3256     }
       
  3257 
       
  3258 void CSubscriber::SubscribeL()
       
  3259     {
       
  3260     if (!IsActive())
       
  3261         {
       
  3262         iProperty.Subscribe(iStatus);
       
  3263         SetActive();
       
  3264         }
       
  3265     }
       
  3266 
       
  3267 void CSubscriber::StopSubscribe()
       
  3268     {
       
  3269     Cancel();
       
  3270     }
       
  3271 
       
  3272 void CSubscriber::RunL()
       
  3273     {
       
  3274     if (iStatus.Int() == KErrNone)
       
  3275         {
       
  3276         iCallBack.CallBack();
       
  3277         SubscribeL();
       
  3278         }
       
  3279     }
       
  3280 
       
  3281 void CSubscriber::DoCancel()
       
  3282     {
       
  3283     iProperty.Cancel();
       
  3284     }
       
  3285 // End of File
  2927 // End of File
  3286 
  2928