textinput/peninputarc/src/peninputserverapp/peninputserver.cpp
branchRCL_3
changeset 6 6ceef9a83b1a
parent 5 a47de9135b21
child 7 6defe5d1bd39
equal deleted inserted replaced
5:a47de9135b21 6:6ceef9a83b1a
    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>
    50 //#define __WND_TEST_
    51 //#define __WND_TEST_
    51 
    52 
    52 // CONSTANTS
    53 // CONSTANTS
    53 const TSize KInitialPeninputSize= TSize( 10, 10 );
    54 const TSize KInitialPeninputSize= TSize( 10, 10 );
    54 const TInt KMsgQueueLen = 1000;
    55 const TInt KMsgQueueLen = 1000;
   262 #endif
   263 #endif
   263     
   264     
   264     iCurScrMode = CCoeEnv::Static()->ScreenDevice()->CurrentScreenMode();
   265     iCurScrMode = CCoeEnv::Static()->ScreenDevice()->CurrentScreenMode();
   265     iCrpService = CPenInputCrpServiceClient::NewL();
   266     iCrpService = CPenInputCrpServiceClient::NewL();
   266     iSensorRepository = CRepository::NewL(KCRUidSensorSettings);
   267     iSensorRepository = CRepository::NewL(KCRUidSensorSettings);
       
   268     User::LeaveIfError(iDiscreetPopProperty.Attach(KPSUidAvkonDomain, 
       
   269                                          KAknGlobalDiscreetPopupNumChanged));
       
   270     iDiscreetPopSubscriber = new (ELeave) CSubscriber(
       
   271             TCallBack( DiscreetPopChangeNotification, this), 
       
   272             iDiscreetPopProperty);
       
   273     iDiscreetPopSubscriber->SubscribeL();
       
   274     // Get the pop area
       
   275     User::LeaveIfError(iAknUiSrv.Connect());
       
   276     iDiscreetPopArea = iAknUiSrv.GetInUseGlobalDiscreetPopupRect();
       
   277     if(iDiscreetPopArea.Size().iWidth > 0)
       
   278         {
       
   279         HandleDiscreetPopNotification();
       
   280         }
   267     }
   281     }
   268 
   282 
   269 void CPeninputServer::CleanAll()
   283 void CPeninputServer::CleanAll()
   270     {
   284     {
   271     if(iNoNeedClean)
   285     if(iNoNeedClean)
   330     iClientProcess.Close();
   344     iClientProcess.Close();
   331     iClientLayouts.Close();
   345     iClientLayouts.Close();
   332 #ifdef __LOG_WNDGROU__    
   346 #ifdef __LOG_WNDGROU__    
   333     iLogFile.Close();    
   347     iLogFile.Close();    
   334 #endif
   348 #endif
       
   349     if (iDiscreetPopSubscriber)
       
   350 	    {
       
   351 	    iDiscreetPopSubscriber->StopSubscribe();
       
   352 	    }
       
   353     iDiscreetPopProperty.Close();
       
   354     delete iDiscreetPopSubscriber;
       
   355     iAknUiSrv.Close();
   335     delete iAnimObj;
   356     delete iAnimObj;
   336     iAnimObj = NULL;
   357     iAnimObj = NULL;
   337     
   358     
   338     iNoNeedClean = ETrue;
   359     iNoNeedClean = ETrue;
   339     
   360     
  2301                     break;
  2322                     break;
  2302                     }
  2323                     }
  2303                 */
  2324                 */
  2304                 if(IsGlobalNotesApp(focusApp))
  2325                 if(IsGlobalNotesApp(focusApp))
  2305                         {
  2326                         {
  2306                         iInGlobalNotesState = ETrue; 	             
  2327                         iInGlobalNotesState = ETrue;
       
  2328                         // add this to enable global dim   
       
  2329                         DeactivatePenUiLayout(EFalse);           
  2307                         break;            
  2330                         break;            
  2308                         }
  2331                         }
  2309                     
  2332                     
  2310 /*                else if (focusApp.iUid == 0x102750f0)
  2333 /*                else if (focusApp.iUid == 0x102750f0)
  2311                     {
  2334                     {
  2714             }
  2737             }
  2715         tempMode<<=1;
  2738         tempMode<<=1;
  2716         }    
  2739         }    
  2717     return supportMode;
  2740     return supportMode;
  2718     }
  2741     }
  2719     
  2742 	
       
  2743 // ---------------------------------------------------------------------------
       
  2744 // CPeninputServer::DiscreetPopChangeNotification
       
  2745 // handle notification of discreept pop changing
       
  2746 // ---------------------------------------------------------------------------
       
  2747 // 
       
  2748 TInt CPeninputServer::DiscreetPopChangeNotification(TAny* aObj)
       
  2749     {
       
  2750     if (aObj)
       
  2751         {
       
  2752         static_cast<CPeninputServer*>(aObj)->HandleDiscreetPopNotification();
       
  2753         return KErrNone;
       
  2754         }
       
  2755     else
       
  2756         {
       
  2757         return KErrArgument;
       
  2758         }
       
  2759     }
       
  2760 // ---------------------------------------------------------------------------
       
  2761 // CPeninputServer::HandleDiscreetPopNotification
       
  2762 // handle notification of discreept pop changing
       
  2763 // ---------------------------------------------------------------------------
       
  2764 // 
       
  2765 void CPeninputServer::HandleDiscreetPopNotification()
       
  2766     {
       
  2767 	iDiscreetPopArea = iAknUiSrv.GetInUseGlobalDiscreetPopupRect();
       
  2768 	iAnimObj->SetDiscreetPopArea(iDiscreetPopArea);
       
  2769     }
  2720 // ======== class CEventQueue========
  2770 // ======== class CEventQueue========
  2721 //
  2771 //
  2722 // ---------------------------------------------------------------------------
  2772 // ---------------------------------------------------------------------------
  2723 // CEventQueue::CEventQueue
  2773 // CEventQueue::CEventQueue
  2724 // Constructor. Adds the active object to the active scheduler
  2774 // Constructor. Adds the active object to the active scheduler
  2924 //
  2974 //
  2925 GLDEF_C void PanicServer(TPeninputServerPanic aPanic)
  2975 GLDEF_C void PanicServer(TPeninputServerPanic aPanic)
  2926     {
  2976     {
  2927     User::Panic( KPeninputServerName, aPanic );
  2977     User::Panic( KPeninputServerName, aPanic );
  2928     } 
  2978     } 
       
  2979 	
       
  2980 // ======== class CSubscriber========
       
  2981 //
       
  2982 CSubscriber::CSubscriber(TCallBack aCallBack, RProperty& aProperty)
       
  2983     :
       
  2984     CActive(EPriorityNormal), iCallBack(aCallBack), iProperty(aProperty)
       
  2985     {
       
  2986     CActiveScheduler::Add(this);
       
  2987     }
       
  2988 
       
  2989 CSubscriber::~CSubscriber()
       
  2990     {
       
  2991     Cancel();
       
  2992     }
       
  2993 
       
  2994 void CSubscriber::SubscribeL()
       
  2995     {
       
  2996     if (!IsActive())
       
  2997         {
       
  2998         iProperty.Subscribe(iStatus);
       
  2999         SetActive();
       
  3000         }
       
  3001     }
       
  3002 
       
  3003 void CSubscriber::StopSubscribe()
       
  3004     {
       
  3005     Cancel();
       
  3006     }
       
  3007 
       
  3008 void CSubscriber::RunL()
       
  3009     {
       
  3010     if (iStatus.Int() == KErrNone)
       
  3011         {
       
  3012         iCallBack.CallBack();
       
  3013         SubscribeL();
       
  3014         }
       
  3015     }
       
  3016 
       
  3017 void CSubscriber::DoCancel()
       
  3018     {
       
  3019     iProperty.Cancel();
       
  3020     }
  2929 // End of File
  3021 // End of File
  2930 
  3022