coreapplicationuis/SysAp/Src/sysapkeymanagement.cpp
branchRCL_3
changeset 63 c2c61fdca848
parent 62 924385140d98
equal deleted inserted replaced
62:924385140d98 63:c2c61fdca848
   132         
   132         
   133         for ( TInt upAndDownKeyHandleCounter = info->iUpAndDownKeyHandles.Count()-1; upAndDownKeyHandleCounter >= 0; upAndDownKeyHandleCounter-- )
   133         for ( TInt upAndDownKeyHandleCounter = info->iUpAndDownKeyHandles.Count()-1; upAndDownKeyHandleCounter >= 0; upAndDownKeyHandleCounter-- )
   134             {
   134             {
   135             iRootWindowGroup.CancelCaptureKeyUpAndDowns( info->iUpAndDownKeyHandles[upAndDownKeyHandleCounter] );
   135             iRootWindowGroup.CancelCaptureKeyUpAndDowns( info->iUpAndDownKeyHandles[upAndDownKeyHandleCounter] );
   136             }
   136             }
   137         for ( TInt keyHandleCounter = info->iLongKeyPressHandle.Count()-1; keyHandleCounter >= 0; keyHandleCounter-- )
       
   138              {
       
   139              iRootWindowGroup.CancelCaptureLongKey( info->iLongKeyPressHandle[keyHandleCounter] );
       
   140              }
       
   141         }
   137         }
   142     }
   138     }
   143 
   139 
   144 
   140 
   145 // ----------------------------------------------------------------------------
   141 // ----------------------------------------------------------------------------
   168 			
   164 			
   169 			TRACES( RDebug::Print( _L("CSysApKeyManagement::CaptureKeys: capturing key 0x%x for plugin 0x%x"), 
   165 			TRACES( RDebug::Print( _L("CSysApKeyManagement::CaptureKeys: capturing key 0x%x for plugin 0x%x"), 
   170                                        captureKey, info->iPluginUid ) );
   166                                        captureKey, info->iPluginUid ) );
   171 			if (info->iIsKeyProvider)
   167 			if (info->iIsKeyProvider)
   172 			    {
   168 			    {
   173 			    TUint repeatValue = 0;
       
   174 			    TInt captureUpDownKey = info->iKeys[keyCounter].iScanCode;
   169 			    TInt captureUpDownKey = info->iKeys[keyCounter].iScanCode;
   175 			    TUint modifiers = info->iKeys[keyCounter].iModifiers;
   170 			    TUint modifiers = info->iKeys[keyCounter].iModifiers;
   176 			    repeatValue = info->iKeys[keyCounter].iRepeats; 
       
   177 			    
   171 			    
   178                 TInt32 keyHandle = iRootWindowGroup.CaptureKey( captureKey, modifiers, modifiers );
   172                 TInt32 keyHandle = iRootWindowGroup.CaptureKey( captureKey, modifiers, modifiers );
   179                 
   173                 
   180                 if ( keyHandle < KErrNone )
   174                 if ( keyHandle < KErrNone )
   181                     {
   175                     {
   199                 
   193                 
   200                 if ( ( upAndDownKeyHandle = info->iUpAndDownKeyHandles.Append( upAndDownKeyHandle ) ) != KErrNone ) //store handle for CancelCaptureKeyUpAndDowns
   194                 if ( ( upAndDownKeyHandle = info->iUpAndDownKeyHandles.Append( upAndDownKeyHandle ) ) != KErrNone ) //store handle for CancelCaptureKeyUpAndDowns
   201                     {
   195                     {
   202                     //error of Append ignored, key will not be cancelled. We can live with that.
   196                     //error of Append ignored, key will not be cancelled. We can live with that.
   203                     TRACES( RDebug::Print( _L("CSysApKeyManagement::CaptureKeys UpAndDowns: Append failed, error %d"), upAndDownKeyHandle ) );
   197                     TRACES( RDebug::Print( _L("CSysApKeyManagement::CaptureKeys UpAndDowns: Append failed, error %d"), upAndDownKeyHandle ) );
   204                     }
       
   205                 if( repeatValue == 1 )
       
   206                     {
       
   207                     TInt32 longKeyPressHandle = iRootWindowGroup.CaptureLongKey( captureKey, captureKey,0, modifiers,0, ELongCaptureWaitShort);
       
   208                     if ( longKeyPressHandle < KErrNone )
       
   209                         {
       
   210                        TRACES( RDebug::Print( _L("CSysApKeyManagement::CaptureLongKey : error %d"), longKeyPressHandle ) );
       
   211                        continue; // other keys may be possible to capture, so continue
       
   212                         }
       
   213                     if ( ( longKeyPressHandle = info->iLongKeyPressHandle.Append( longKeyPressHandle ) ) != KErrNone ) //store handle for CancelCaptureKeyUpAndDowns
       
   214                          {
       
   215                           TRACES( RDebug::Print( _L("CSysApKeyManagement::CaptureLongKey : Append failed, error %d"), longKeyPressHandle ) );
       
   216                          }                               
       
   217                     }
   198                     }
   218 			    }
   199 			    }
   219 			else
   200 			else
   220 			    {
   201 			    {
   221 	            TInt32 handle = iRootWindowGroup.CaptureKey( captureKey, 0, 0 );
   202 	            TInt32 handle = iRootWindowGroup.CaptureKey( captureKey, 0, 0 );