textinput/peninputarc/src/peninputserverapp/peninputserver.cpp
branchRCL_3
changeset 15 6c2c2d3ab788
parent 12 5e18d8c489d6
child 16 857bebeecec0
equal deleted inserted replaced
12:5e18d8c489d6 15:6c2c2d3ab788
   185     iSpriteSize = KInitialPeninputSize;
   185     iSpriteSize = KInitialPeninputSize;
   186     iSpritePosition = TPoint(0,0);    
   186     iSpritePosition = TPoint(0,0);    
   187     //iDispMode = iDispModeForMask= CCoeEnv::Static()->WsSession().GetDefModeMaxNumColors(col,grey);    
   187     //iDispMode = iDispModeForMask= CCoeEnv::Static()->WsSession().GetDefModeMaxNumColors(col,grey);    
   188     iPreNonGloebalNotesWndGrpId = -1;
   188     iPreNonGloebalNotesWndGrpId = -1;
   189     iNoNeedClean = EFalse;
   189     iNoNeedClean = EFalse;
       
   190 	iEnablePriorityChangeOnOriChange = ETrue;
   190     }
   191     }
   191 
   192 
   192 
   193 
   193 // ---------------------------------------------------------------------------
   194 // ---------------------------------------------------------------------------
   194 // CPeninputServer::NewL
   195 // CPeninputServer::NewL
   425 // Activate sprite
   426 // Activate sprite
   426 // ---------------------------------------------------------------------------
   427 // ---------------------------------------------------------------------------
   427 //
   428 //
   428 void CPeninputServer::ActivateSpriteInGlobalNotesL()
   429 void CPeninputServer::ActivateSpriteInGlobalNotesL()
   429     {
   430     {
       
   431     TBool notDraw = EFalse;
       
   432     iUiLayout->HandleCommand( ECmdPeninputDisableLayoutDrawing, 
       
   433     		                 (unsigned char*)&notDraw );    
   430     if(iActive)
   434     if(iActive)
   431         {
   435         {
   432 	    if(iUseWindowCtrl)
   436 	    if(iUseWindowCtrl)
   433 	        {
   437 	        {
   434 /*            RWsSession &ws = CCoeEnv::Static()->WsSession();
   438 /*            RWsSession &ws = CCoeEnv::Static()->WsSession();
   589 	                iDimmed = ETrue;
   593 	                iDimmed = ETrue;
   590 	                DimPenUi();                
   594 	                DimPenUi();                
   591 		            }
   595 		            }
   592 	            }
   596 	            }
   593             }
   597             }
       
   598         iIsLayoutReDrawAllowWhenActive = EFalse;    
   594         }
   599         }
   595     else
   600     else
   596         {
   601         {
   597         //actived but dimmed by global notes
   602         //actived but dimmed by global notes
   598         if(iUseWindowCtrl)
   603         if(iUseWindowCtrl)
   599             {
   604             {
   600             ActivatePenUiLayout(EFalse);
   605             /**
       
   606             * 1. IF THE GLOBAL NOTES HAS BEEN OPENED UP, WE NEED TO REDRAW THE LAYOUT
       
   607             * 2. IF iIsLayoutReDrawAllowWhenActive was set to be ETrue. 
       
   608             *    if we did not put this condition guard, the layout
       
   609             *    redraw will be executed even if the layout is active. But if this flag is
       
   610             *    set to be ture, layout redraw will be carried out even if the layout is active, so
       
   611             *    it will leave this for layout to decide if it need set this flag to be ture or false
       
   612             *    in some special cases: for example for entering and exiting the spell mode.
       
   613             *    
       
   614             */
       
   615             if(iInGlobalNotesApp || iInGlobalEditorState || iIsLayoutReDrawAllowWhenActive )
       
   616                 {
       
   617                 ActivatePenUiLayout(EFalse);
       
   618                 if(iIsLayoutReDrawAllowWhenActive)
       
   619                     {
       
   620                     iIsLayoutReDrawAllowWhenActive = EFalse;    
       
   621                     }
       
   622                 }
       
   623             else
       
   624 			    {
       
   625 				ActivatePenUiLayout(EFalse,ETrue);
       
   626 				}
   601 
   627 
   602             if (iDimmed && (iInGlobalNotesApp || iInGlobalEditorState))
   628             if (iDimmed && (iInGlobalNotesApp || iInGlobalEditorState))
   603                 {
   629                 {
   604                 DeactivatePenUiLayout(EFalse);                
   630                 DeactivatePenUiLayout(EFalse);                
   605                 return;
   631                 return;
  1130 				{
  1156 				{
  1131 				iUiLayout->HandleCommand(ECmdPenInputLanguage,
  1157 				iUiLayout->HandleCommand(ECmdPenInputLanguage,
  1132 						                 (unsigned char*)&iInputLanguage);  
  1158 						                 (unsigned char*)&iInputLanguage);  
  1133 				}
  1159 				}
  1134     	    }
  1160     	    }
  1135     	    break;            
  1161     	    break;
       
  1162         case EPeninputEnablePriorityChangeOnOriChange:
       
  1163             {
       
  1164 			TPckg<TBool> enablePriority( iEnablePriorityChangeOnOriChange );
       
  1165             aMessage.ReadL( 0, enablePriority );
       
  1166 			}
  1136         default: //Let user pluging handling the user command
  1167         default: //Let user pluging handling the user command
  1137             break;
  1168             break;
  1138         }
  1169         }
  1139     return err;
  1170     return err;
  1140     }
  1171     }
  1202 
  1233 
  1203     //clear sprite before delete ui layout
  1234     //clear sprite before delete ui layout
  1204     iUILayoutReady = EFalse;    
  1235     iUILayoutReady = EFalse;    
  1205     if(iUiLayout)
  1236     if(iUiLayout)
  1206         {
  1237         {
  1207 		ClearSpriteGc();
  1238         //if(!iUseWindowCtrl)
       
  1239         	//{
       
  1240 			//ClearSpriteGc();
       
  1241         	//}
  1208         DeactivateSprite();
  1242         DeactivateSprite();
  1209         iDestroyingLayout = ETrue;
  1243         iDestroyingLayout = ETrue;
  1210         if(iUseWindowCtrl)
  1244         if(iUseWindowCtrl)
  1211 		   {
  1245 		   {
  1212 		   if(iPenUiCtrl)
  1246 		   if(iPenUiCtrl)
  1543 // ---------------------------------------------------------------------------
  1577 // ---------------------------------------------------------------------------
  1544 //
  1578 //
  1545 void CPeninputServer::DrawSprite()
  1579 void CPeninputServer::DrawSprite()
  1546     {
  1580     {
  1547 
  1581 
  1548     if(!iUiLayout)
  1582     if(!iUiLayout || iActive)
  1549         return;
  1583         return;
  1550     ClearSpriteGc();
  1584     ClearSpriteGc();
  1551     
  1585     
  1552     iUiLayout->Draw();
  1586     iUiLayout->Draw();
  1553 
  1587 
  1672         {
  1706         {
  1673         DeactivateSprite();
  1707         DeactivateSprite();
  1674         }
  1708         }
  1675     else
  1709     else
  1676         {
  1710         {
  1677         ActivateSprite();
  1711         if(!iActive)
       
  1712             {
       
  1713             ActivateSprite();
       
  1714             }
  1678         }
  1715         }
  1679     }
  1716     }
  1680 
  1717 
  1681 // ---------------------------------------------------------------------------
  1718 // ---------------------------------------------------------------------------
  1682 // CPeninputServer::LayoutSizeChanged
  1719 // CPeninputServer::LayoutSizeChanged
  1908             	    
  1945             	    
  1909             	    iPenUiCtrl->ShowPopup( rectInScreen, rectInLayout, rectTrimLayout );
  1946             	    iPenUiCtrl->ShowPopup( rectInScreen, rectInLayout, rectTrimLayout );
  1910             	    }
  1947             	    }
  1911         	    }
  1948         	    }
  1912         	    break;
  1949         	    break;
       
  1950             case ESignalEnableLayoutRedrawWhenActive:
       
  1951                 {
       
  1952 				TUint16* buf = const_cast<TUint16* >( aEventData.Ptr() );    
       
  1953                 TBool* retVal = reinterpret_cast< TBool* > ( buf );
       
  1954 				iIsLayoutReDrawAllowWhenActive = *retVal;
       
  1955 				}
       
  1956 				break;	
  1913 
  1957 
  1914         	default:
  1958         	default:
  1915         	    if(iUseWindowCtrl)                    
  1959         	    if(iUseWindowCtrl)                    
  1916         	        {
  1960         	        {
  1917                     iPenUiCtrl->HandleNGASpecificSignal(aEventType, aEventData);
  1961                     iPenUiCtrl->HandleNGASpecificSignal(aEventType, aEventData);
  2016 // CPeninputServer::HandleResourceChange
  2060 // CPeninputServer::HandleResourceChange
  2017 // Handle application resource change
  2061 // Handle application resource change
  2018 // ---------------------------------------------------------------------------
  2062 // ---------------------------------------------------------------------------
  2019 //    
  2063 //    
  2020 void CPeninputServer::HandleResourceChange(TInt aType)
  2064 void CPeninputServer::HandleResourceChange(TInt aType)
  2021     {   
  2065     {
       
  2066 	#ifdef FIX_FOR_NGA 
       
  2067 	// iEnablePriorityChangeOnOriChange will be set to be EFalse, if some dialog in FEP end were opened and 
       
  2068 	// not close after rotation for example: Symbol Table, Writing Language list and Match Dialog on ITI
       
  2069 	if(iUiLayout && iActive && iEnablePriorityChangeOnOriChange && aType == KEikDynamicLayoutVariantSwitch)
       
  2070         {
       
  2071         TPixelsTwipsAndRotation size; 
       
  2072         CCoeEnv::Static()->ScreenDevice()->GetDefaultScreenSizeAndRotation(size);
       
  2073                 
       
  2074         TBool isPortrait = ( size.iPixelSize.iWidth < size.iPixelSize.iHeight );
       
  2075    
       
  2076         TBool needToLiftUp = EFalse;
       
  2077         TInt inputMode = 0; 
       
  2078         inputMode = iUiLayout->PenInputType();
       
  2079         if(inputMode == EPluginInputModeItut)
       
  2080             {
       
  2081             if(!isPortrait)
       
  2082                 {
       
  2083                 needToLiftUp = ETrue;
       
  2084                 }
       
  2085             }
       
  2086         else if(inputMode == EPluginInputModeFSQ)
       
  2087             {
       
  2088             if(isPortrait)
       
  2089                 {
       
  2090                 needToLiftUp = ETrue;
       
  2091                 }
       
  2092             }
       
  2093     
       
  2094         else if(inputMode == EPluginInputModeFingerHwr)
       
  2095             {
       
  2096             ClearSpriteGc();
       
  2097             //Close the UI immediately, without notify UI handler 
       
  2098             DeactivateSprite(ETrue, ETrue);
       
  2099             }
       
  2100         if(needToLiftUp)
       
  2101             {
       
  2102             if(iPenUiCtrl)
       
  2103                 {
       
  2104                 
       
  2105                 // must lift up the wnd group priority otherwise when rotating screen, the underling application will show first and then
       
  2106                 // 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
       
  2107                 // work if we remove this line of code. 
       
  2108                 iPenUiCtrl->LiftUpPriority();				
       
  2109                 }
       
  2110             }
       
  2111         }
       
  2112 	#endif	
  2022     if(iUiLayout && !(iUiLayout->PenInputType() & DisabledByOrientation()) )
  2113     if(iUiLayout && !(iUiLayout->PenInputType() & DisabledByOrientation()) )
  2023         {
  2114         {
  2024         //hide the layout if it's already shown
  2115         //hide the layout if it's already shown
  2025         
  2116         
  2026         iUiLayout->OnResourceChange(aType);
  2117         iUiLayout->OnResourceChange(aType);
  2133         return;
  2224         return;
  2134         }
  2225         }
  2135     
  2226     
  2136 	if(iActive && !iPrevActive && inputMode != EPluginInputModeFSQ && iBackgroudDefaultOri == CAknAppUiBase::EAppUiOrientationUnspecified )
  2227 	if(iActive && !iPrevActive && inputMode != EPluginInputModeFSQ && iBackgroudDefaultOri == CAknAppUiBase::EAppUiOrientationUnspecified )
  2137         {
  2228         {
  2138         
  2229         #ifdef FIX_FOR_NGA
       
  2230         if(inputMode == EPluginInputModeFingerHwr)
       
  2231             {
       
  2232             iPrevActive = ETrue;
       
  2233             ClearSpriteGc();
       
  2234             //Close the UI immediately, without notify UI handler 
       
  2235             DeactivateSprite(ETrue, ETrue);
       
  2236             }
       
  2237         else
       
  2238             {// for other input mode: we are not going to cose UI, since it will cause
       
  2239              // serious fliker: which will have the mixed ui(with other app ui) on pen input ui
       
  2240             
       
  2241 			if(iUiLayout)
       
  2242 			    {
       
  2243 				TBool notDraw = ETrue;
       
  2244 	            iUiLayout->HandleCommand(ECmdPeninputDisableLayoutDrawing,(unsigned char*)&notDraw);
       
  2245 	            iUiLayout->OnDeActivate();
       
  2246 			    }
       
  2247             }       
       
  2248         #else
  2139         iPrevActive = ETrue;
  2249         iPrevActive = ETrue;
  2140         ClearSpriteGc();
  2250         ClearSpriteGc();
  2141 	    //Close the UI immediately, without notify UI handler 
  2251         //Close the UI immediately, without notify UI handler 
  2142 	    DeactivateSprite(ETrue, ETrue);
  2252         DeactivateSprite(ETrue, ETrue);
       
  2253         #endif
  2143         }    
  2254         }    
  2144     }
  2255     }
  2145     
  2256     
  2146 // ---------------------------------------------------------------------------
  2257 // ---------------------------------------------------------------------------
  2147 // CPeninputServer::SetDisabledLayouts
  2258 // CPeninputServer::SetDisabledLayouts
  2261 void CPeninputServer::HandleRawEventL(const TRawEvent& aEvent)
  2372 void CPeninputServer::HandleRawEventL(const TRawEvent& aEvent)
  2262     {
  2373     {
  2263     if(iActive)
  2374     if(iActive)
  2264         { 
  2375         { 
  2265         if( aEvent.Type() == TRawEvent::ENone && 
  2376         if( aEvent.Type() == TRawEvent::ENone && 
  2266         	aEvent.IsTip() &&
  2377         	aEvent.IsTip() 
  2267         	iCrpService->IsDsaActive() )
  2378         	&& iCrpService && iCrpService->IsDsaActive() )
  2268             {
  2379             {
  2269             SignalOwner( ESignalLayoutClosed, KNullDesC );    
  2380             SignalOwner( ESignalLayoutClosed, KNullDesC );    
  2270             }
  2381             }
  2271                    
  2382                    
  2272         TBool handled = iUiLayout->HandleEventL(ERawEvent,&aEvent);
  2383         TBool handled = iUiLayout ? iUiLayout->HandleEventL(ERawEvent,&aEvent)
       
  2384         		        : EFalse;
  2273 
  2385 
  2274         if (TRawEvent::EButton1Down == aEvent.Type())
  2386         if (TRawEvent::EButton1Down == aEvent.Type())
  2275             {
  2387             {
  2276             iLastRawEvent = aEvent;     
  2388             iLastRawEvent = aEvent;     
  2277             }
  2389             }