coreapplicationuis/SysAp/Src/sysapkeymanagement.cpp
changeset 48 2222076f5c60
parent 0 2e3d3ce01487
child 63 c2c61fdca848
equal deleted inserted replaced
40:951aeeb3da43 48:2222076f5c60
   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              }
   137         }
   141         }
   138     }
   142     }
   139 
   143 
   140 
   144 
   141 // ----------------------------------------------------------------------------
   145 // ----------------------------------------------------------------------------
   164 			
   168 			
   165 			TRACES( RDebug::Print( _L("CSysApKeyManagement::CaptureKeys: capturing key 0x%x for plugin 0x%x"), 
   169 			TRACES( RDebug::Print( _L("CSysApKeyManagement::CaptureKeys: capturing key 0x%x for plugin 0x%x"), 
   166                                        captureKey, info->iPluginUid ) );
   170                                        captureKey, info->iPluginUid ) );
   167 			if (info->iIsKeyProvider)
   171 			if (info->iIsKeyProvider)
   168 			    {
   172 			    {
       
   173 			    TUint repeatValue = 0;
   169 			    TInt captureUpDownKey = info->iKeys[keyCounter].iScanCode;
   174 			    TInt captureUpDownKey = info->iKeys[keyCounter].iScanCode;
   170 			    TUint modifiers = info->iKeys[keyCounter].iModifiers;
   175 			    TUint modifiers = info->iKeys[keyCounter].iModifiers;
       
   176 			    repeatValue = info->iKeys[keyCounter].iRepeats; 
   171 			    
   177 			    
   172                 TInt32 keyHandle = iRootWindowGroup.CaptureKey( captureKey, modifiers, modifiers );
   178                 TInt32 keyHandle = iRootWindowGroup.CaptureKey( captureKey, modifiers, modifiers );
   173                 
   179                 
   174                 if ( keyHandle < KErrNone )
   180                 if ( keyHandle < KErrNone )
   175                     {
   181                     {
   193                 
   199                 
   194                 if ( ( upAndDownKeyHandle = info->iUpAndDownKeyHandles.Append( upAndDownKeyHandle ) ) != KErrNone ) //store handle for CancelCaptureKeyUpAndDowns
   200                 if ( ( upAndDownKeyHandle = info->iUpAndDownKeyHandles.Append( upAndDownKeyHandle ) ) != KErrNone ) //store handle for CancelCaptureKeyUpAndDowns
   195                     {
   201                     {
   196                     //error of Append ignored, key will not be cancelled. We can live with that.
   202                     //error of Append ignored, key will not be cancelled. We can live with that.
   197                     TRACES( RDebug::Print( _L("CSysApKeyManagement::CaptureKeys UpAndDowns: Append failed, error %d"), upAndDownKeyHandle ) );
   203                     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                          }                               
   198                     }
   217                     }
   199 			    }
   218 			    }
   200 			else
   219 			else
   201 			    {
   220 			    {
   202 	            TInt32 handle = iRootWindowGroup.CaptureKey( captureKey, 0, 0 );
   221 	            TInt32 handle = iRootWindowGroup.CaptureKey( captureKey, 0, 0 );