windowing/windowserver/nga/SERVER/POINTER.CPP
branchRCL_3
changeset 164 25ffed67c7ef
parent 163 bbf46f59e123
equal deleted inserted replaced
163:bbf46f59e123 164:25ffed67c7ef
    28 #include "wstop.h"
    28 #include "wstop.h"
    29 #include "inifile.h"
    29 #include "inifile.h"
    30 #include <hal.h>
    30 #include <hal.h>
    31 #include "advancedpointereventhelper.h"
    31 #include "advancedpointereventhelper.h"
    32 #include "graphics/pointereventdata.h"
    32 #include "graphics/pointereventdata.h"
    33 #include "debughelper.h"
       
    34 
    33 
    35 TTimeIntervalMicroSeconds32 TWsPointer::iDoubleClickMaxInterval;
    34 TTimeIntervalMicroSeconds32 TWsPointer::iDoubleClickMaxInterval;
    36 TInt 			   TWsPointer::iDoubleClickMaxDistance;
    35 TInt 			   TWsPointer::iDoubleClickMaxDistance;
    37 CWsPointerCursor*  TWsPointer::iCursorSprite;
    36 CWsPointerCursor*  TWsPointer::iCursorSprite;
    38 TPointerCursorMode TWsPointer::iPointerCursorMode=EPointerCursorNormal;
    37 TPointerCursorMode TWsPointer::iPointerCursorMode=EPointerCursorNormal;
    39 TXYInputType       TWsPointer::iXyInputType;
    38 TXYInputType 	   TWsPointer::iXyInputType;
    40 TBool 			   TWsPointer::iTimerQueued;
    39 TBool 			   TWsPointer::iTimerQueued;
    41 TBool 			   TWsPointer::iUpdateRequired;
    40 TBool 			   TWsPointer::iUpdateRequired;
    42 CPeriodic* 		   TWsPointer::iPeriodicTimer;
    41 CPeriodic* 		   TWsPointer::iPeriodicTimer;
    43 CWsRootWindow*     TWsPointer::iRootWindow;
    42 CWsRootWindow*     TWsPointer::iRootWindow;
    44 TInt			   TWsPointer::iMaxPointers;
    43 TInt			   TWsPointer::iMaxPointers;
    52 TInt			   TWsPointer::iExitHighPressureThreshold;
    51 TInt			   TWsPointer::iExitHighPressureThreshold;
    53 TBool			   CWsPointerBuffer::iSignalled=EFalse;
    52 TBool			   CWsPointerBuffer::iSignalled=EFalse;
    54 CWsPointerBuffer*  CWsPointerBuffer::iCurrentBuffer=NULL;
    53 CWsPointerBuffer*  CWsPointerBuffer::iCurrentBuffer=NULL;
    55 CCirBuf<TPoint>*   CWsPointerBuffer::iPointerBuffer=NULL;
    54 CCirBuf<TPoint>*   CWsPointerBuffer::iPointerBuffer=NULL;
    56 TSglQue<CWsPointerBuffer> CWsPointerBuffer::iList(_FOFF(CWsPointerBuffer,iQue));
    55 TSglQue<CWsPointerBuffer> CWsPointerBuffer::iList(_FOFF(CWsPointerBuffer,iQue));
    57 TInt                TWsPointer::iYOffset;
    56 TInt                TWsPointer::iYOffsetTop;
       
    57 TInt                TWsPointer::iYOffsetBottom;
       
    58 TInt                TWsPointer::iYOffsetMax;
    58 #if defined(__WINS__)
    59 #if defined(__WINS__)
    59 TBool               TWsPointer::iEmulatorRotatePointerCoords;
    60 TBool               TWsPointer::iEmulatorRotatePointerCoords;
    60 #endif
    61 #endif
    61 
    62 
    62 static _LIT_SECURITY_POLICY_C1(KSecurityPolicy_SwEvent,ECapabilitySwEvent);
    63 static _LIT_SECURITY_POLICY_C1(KSecurityPolicy_SwEvent,ECapabilitySwEvent);
    63 
    64 
    64 void TWsPointer::InitStaticsL()
    65 void TWsPointer::InitStaticsL()
    65 	{
    66 	{
    66 	//This iYOffset setting is specific for capacitive touch screens, where user's finger is the pointer device.
    67 	//This iYOffsetTop setting is specific for capacitive touch screens, where user's finger is the pointer device.
    67 	//This is typically used so that the pointer event location is more inline with where the user perceives their 
    68 	//This is typically used so that the pointer event location is more inline with where the user perceives their 
    68 	//finger to be on the screen (for example, due to refraction and the relatively large touch area of a finger).
    69 	//finger to be on the screen (for example, due to refraction and the relatively large touch area of a finger).
    69 	iYOffset = 0;
    70 	//The logic used here is to use Yoffset value such that it is max the finger is at the top and keeps on reducing
    70     _LIT( KWSERVIniFileVarYShifting, "YSHIFTING");
    71 	//when the finger input is moved towards bottom of the screen
    71     TBool fetchingSucceeded = WsIniFile->FindVar(KWSERVIniFileVarYShifting, iYOffset);
    72 	iYOffsetTop = 0;
    72     WS_ASSERT_ALWAYS(iYOffset>=0, EWsPanicInvalidPointerOffset);
    73 	iYOffsetBottom = 0;
    73     if ( !fetchingSucceeded )
    74 	iYOffsetMax = 0;
    74        {
    75     _LIT( KWSERVIniFileVarYShiftingTop, "YSHIFTINGTOP");
    75        iYOffset = 0;
    76     _LIT( KWSERVIniFileVarYShiftingBottom, "YSHIFTINGBOTTOM");
    76        }
    77     _LIT( KWSERVIniFileVarYShiftingMax, "YSHIFTINGMAX");
       
    78     WsIniFile->FindVar(KWSERVIniFileVarYShiftingTop, iYOffsetTop);
       
    79     WsIniFile->FindVar(KWSERVIniFileVarYShiftingBottom, iYOffsetBottom);
       
    80     WsIniFile->FindVar(KWSERVIniFileVarYShiftingMax, iYOffsetMax);
    77 
    81 
    78 #if defined(__WINS__)    
    82 #if defined(__WINS__)    
    79 	//An emulator may or may not deploy a renderchain or displaydriver that supports rotated drawing.
    83 	//An emulator may or may not deploy a renderchain or displaydriver that supports rotated drawing.
    80 	//On a real device target the coordinate system is always rotated together with wserv's screendevice.
    84 	//On a real device target the coordinate system is always rotated together with wserv's screendevice.
    81 	_LIT( KWSERVIniFileVarEmulatorRotPointCoords, "EMULATOR_ROTATE_POINTER_COORDS");
    85 	_LIT( KWSERVIniFileVarEmulatorRotPointCoords, "EMULATOR_ROTATE_POINTER_COORDS");
   109 			{
   113 			{
   110 			iMaxPointers = 1;
   114 			iMaxPointers = 1;
   111 			}
   115 			}
   112 		}
   116 		}
   113 	
   117 	
   114 	//** Log the number of pointers here i,e iMaxPointers
       
   115 #ifdef LOG_WSERV_EVENTS
       
   116 	RDebug::Printf("_WSEVENT_POINTER: Number of pointers system supports %d", iMaxPointers);
       
   117 #endif
       
   118 	
       
   119 	// Does device support Z coordinate of the pointers?
   118 	// Does device support Z coordinate of the pointers?
   120 	if(HAL::Get(HALData::EPointer3D,iIs3DPointer)!=KErrNone)
   119 	if(HAL::Get(HALData::EPointer3D,iIs3DPointer)!=KErrNone)
   121 		{
   120 		{
   122 		iIs3DPointer=EFalse; // No API, then no 3D pointers
   121 		iIs3DPointer=EFalse; // No API, then no 3D pointers
   123 		}
   122 		}
   124 	WS_ASSERT_ALWAYS(!iIs3DPointer || XyInput(), EWsPanicPointer3DInconsistent);
   123 	WS_ASSERT_ALWAYS(!iIs3DPointer || XyInput(), EWsPanicPointer3DInconsistent);
   125 	
       
   126 #ifdef LOG_WSERV_EVENTS
       
   127 	RDebug::Printf("_WSEVENT_POINTER: Z coordinate supported %d", iIs3DPointer);
       
   128 #endif	
       
   129 	
   124 	
   130 	// Initialize thresholds for EEnterCloseProximity, EExitCloseProximity,
   125 	// Initialize thresholds for EEnterCloseProximity, EExitCloseProximity,
   131 	// EEnterHighPressure and EExitHightPressure events.
   126 	// EEnterHighPressure and EExitHightPressure events.
   132 	if(HAL::Get(HALData::EPointer3DEnterCloseProximityThreshold,
   127 	if(HAL::Get(HALData::EPointer3DEnterCloseProximityThreshold,
   133 			iEnterCloseProximityThreshold) != KErrNone)
   128 			iEnterCloseProximityThreshold) != KErrNone)
   493 		(aWindow->AdvancedPointersEnabled() || 
   488 		(aWindow->AdvancedPointersEnabled() || 
   494 		TAdvancedPointerEventHelper::PointerNumber(aEvent) == iPrimaryPointer))
   489 		TAdvancedPointerEventHelper::PointerNumber(aEvent) == iPrimaryPointer))
   495 		{
   490 		{
   496 		CEventQueue* queue=aWindow->EventQueue();
   491 		CEventQueue* queue=aWindow->EventQueue();
   497 		aEvent.SetHandle(aWindow->ClientHandle());
   492 		aEvent.SetHandle(aWindow->ClientHandle());
   498 #ifdef LOG_WSERV_EVENTS
       
   499 		RDebug::Printf("_WSEVENT_POINTER: TWsPointer::QueuePointerEvent with AdvancedPointerEnabled");
       
   500 #endif
       
   501 		if (aEvent.Handle()!=0)
   493 		if (aEvent.Handle()!=0)
   502 			{
   494 			{
   503  			if(!aWindow->AdvancedPointersEnabled())
   495  			if(!aWindow->AdvancedPointersEnabled())
   504  				{
   496  				{
   505  				// Re-assign from WServ primary pointer number, to EDefaultPointerNumber for Cone and other clients.
   497  				// Re-assign from WServ primary pointer number, to EDefaultPointerNumber for Cone and other clients.
   519 				case TPointerEvent::EButton2Up:
   511 				case TPointerEvent::EButton2Up:
   520 				case TPointerEvent::EButton3Up:
   512 				case TPointerEvent::EButton3Up:
   521 				case TPointerEvent::EExitHighPressure:
   513 				case TPointerEvent::EExitHighPressure:
   522 					if (CheckMatchingEventPurged(aEvent.Pointer()->iType))
   514 					if (CheckMatchingEventPurged(aEvent.Pointer()->iType))
   523 						{
   515 						{
   524 						#ifdef LOG_WSERV_EVENTS
       
   525 						RDebug::Printf("_WSEVENT_POINTER: Check matching event has been purged so no addition of event 01");
       
   526 						#endif
       
   527 						return ETrue;
   516 						return ETrue;
   528 						}
   517 						}
   529 					if (queue->CheckRoom())
   518 					if (queue->CheckRoom())
   530 						{
   519 						{
   531 						if (CheckMatchingEventPurged(aEvent.Pointer()->iType))
   520 						if (CheckMatchingEventPurged(aEvent.Pointer()->iType))
   532 							{
   521 							{
   533 							#ifdef LOG_WSERV_EVENTS
       
   534 							RDebug::Printf("_WSEVENT_POINTER: Check matching event has been purged so no addition of event 02");
       
   535 							#endif
       
   536 							return ETrue;
   522 							return ETrue;
   537 							}
   523 							}
   538 						}
   524 						}
   539 					/*Fall Through if an event was not purged*/
   525 					/*Fall Through if an event was not purged*/
   540 				case TPointerEvent::EButton1Down:
   526 				case TPointerEvent::EButton1Down:
   545 					priority=EEventPriorityHigh;
   531 					priority=EEventPriorityHigh;
   546 					break;
   532 					break;
   547 				default:;
   533 				default:;
   548 				}
   534 				}
   549 #ifdef LOG_WSERV_EVENTS
   535 #ifdef LOG_WSERV_EVENTS
   550 			RDebug::Printf("_WSEVENT_POINTER: TWsPointer::QueuePointerEvent After adding event to clientqueue Event State %d ", iState);
   536 			RDebug::Printf("{EVNT}TWsPointer::QueuePointerEvent After adding event to clientqueue Event State %d ", iState);
   551 #endif
   537 #endif
   552 			queue->QueueEvent(aEvent,priority);
   538 			queue->QueueEvent(aEvent,priority);
   553 			}
   539 			}
   554 		}
   540 		}
   555 	return EFalse;
   541 	return EFalse;
   677 	if (!XyInput())
   663 	if (!XyInput())
   678 		{
   664 		{
   679 		return EFalse;
   665 		return EFalse;
   680 		}
   666 		}
   681 	
   667 	
   682 	//** Log the type, pointer number, and its coordinates
       
   683 #ifdef LOG_WSERV_EVENTS
       
   684 	RDebug::Printf("_WSEVENT_POINTER: Pointer number = %d RawEvent Type = %d Coordinates [%d, %d]", 
       
   685 					aRawEvent.PointerNumber(), type, aRawEvent.Pos().iX, aRawEvent.Pos().iY);
       
   686 #endif
       
   687 	
       
   688 	// check correctness of aRawEvent.PointerNumber()
   668 	// check correctness of aRawEvent.PointerNumber()
   689 	if (iMaxPointers > 1)
   669 	if (iMaxPointers > 1)
   690 		{
   670 		{
   691 		if (aRawEvent.PointerNumber() >= iMaxPointers)
   671 		if (aRawEvent.PointerNumber() >= iMaxPointers)
   692 			{
   672 			{
   736 			RestrictPos(xy);
   716 			RestrictPos(xy);
   737 			}
   717 			}
   738 		aRawEvent.Set(type, xy.iX, xy.iY, 
   718 		aRawEvent.Set(type, xy.iX, xy.iY, 
   739 					  iIs3DPointer ? aRawEvent.Pos3D().iZ : 0);
   719 					  iIs3DPointer ? aRawEvent.Pos3D().iZ : 0);
   740 		}
   720 		}
   741 	
       
   742 #ifdef LOG_WSERV_EVENTS
       
   743 	RDebug::Printf("_WSEVENT_POINTER: Coordinates after Rotation and shift [%d, %d]", 
       
   744 							aRawEvent.Pos().iX, aRawEvent.Pos().iY);
       
   745 #endif
       
   746 	return ETrue;
   721 	return ETrue;
   747 	}
   722 	}
   748 
   723 
   749 void TWsPointer::TranslateCoordsOnRotation(TPoint& aPoint)
   724 void TWsPointer::TranslateCoordsOnRotation(TPoint& aPoint)
   750 	{
   725 	{
   889 	ReLogCurrentWindow(pointerEvent.iPosition,parPos,aForceInGroup);
   864 	ReLogCurrentWindow(pointerEvent.iPosition,parPos,aForceInGroup);
   890 	pointerEvent.iParentPosition=parPos;
   865 	pointerEvent.iParentPosition=parPos;
   891 	
   866 	
   892 	
   867 	
   893 #ifdef LOG_WSERV_EVENTS
   868 #ifdef LOG_WSERV_EVENTS
   894 	RDebug::Printf("_WSEVENT_POINTER: TWsPointer::ProcessEvent Event to be sent to this window %U", reinterpret_cast<TUint32>(iCurrentWindow));
   869 	RDebug::Printf("{EVNT}TWsPointer::ProcessEvent Event send to this window %U", reinterpret_cast<TUint32>(iCurrentWindow));
   895 	RDebug::Print(_L("_WSEVENT_POINTER: TWsPointer::ProcessEvent EventName %S and Event State %d "), &WsEventName(aEvent), iState);
   870 	RDebug::Printf("{EVNT}TWsPointer::ProcessEvent EventType %d and Event State %d ", eventType, iState);
   896 #endif
   871 #endif
   897 	// update state
   872 	// update state
   898 	switch(eventType)
   873 	switch(eventType)
   899 		{
   874 		{
   900 		case TPointerEvent::EButton1Down:
   875 		case TPointerEvent::EButton1Down:
  1044 void TWsPointer::ProcessOutOfRangeEvent(TWsEvent& aEvent,const CWsWindowGroup* aForceInGroup, TBool aNatural)
  1019 void TWsPointer::ProcessOutOfRangeEvent(TWsEvent& aEvent,const CWsWindowGroup* aForceInGroup, TBool aNatural)
  1045 	{
  1020 	{
  1046 	if (iState != EPointerStateOutOfRange)
  1021 	if (iState != EPointerStateOutOfRange)
  1047 		{
  1022 		{
  1048 #ifdef LOG_WSERV_EVENTS
  1023 #ifdef LOG_WSERV_EVENTS
  1049        RDebug::Printf("_WSEVENT_POINTER: TWsPointer::ProcessOutOfRangeEvent Pointer Number = %d, iState =%d ", iNumber, iState); 
  1024        RDebug::Printf("{EVNT}TWsPointer::ProcessOutOfRangeEvent Pointer Number = %d, iState =%d ", iNumber, iState); 
  1050 #endif
  1025 #endif
  1051 
  1026 
  1052 		// OutOfRange event generated by driver doesn't contain correct coordinates,
  1027 		// OutOfRange event generated by driver doesn't contain correct coordinates,
  1053 		// we update them from last state in order to deliver event to the proper window.
  1028 		// we update them from last state in order to deliver event to the proper window.
  1054 		SendEnterExitEvent(EEventPointerExit);
  1029 		SendEnterExitEvent(EEventPointerExit);
  1118 				CWsPointerBuffer::PointerEvent((CWsClientWindow *)iCurrentWindow,pos);
  1093 				CWsPointerBuffer::PointerEvent((CWsClientWindow *)iCurrentWindow,pos);
  1119 				ProcessPointerEvent(aEvent);
  1094 				ProcessPointerEvent(aEvent);
  1120 				}
  1095 				}
  1121 			else if (!WsKeyboardEmulator::PointerEvent(type,pos,iCurrentWindow->PointerKeyList()))
  1096 			else if (!WsKeyboardEmulator::PointerEvent(type,pos,iCurrentWindow->PointerKeyList()))
  1122 				{
  1097 				{
  1123 #ifdef LOG_WSERV_EVENTS
       
  1124 				RDebug::Printf("_WSEVENT_POINTER: Calling ProcessPointerEvent for primary pointer");
       
  1125 #endif
       
  1126 				ProcessPointerEvent(aEvent);
  1098 				ProcessPointerEvent(aEvent);
  1127 				}
  1099 				}
  1128 			}
  1100 			}
  1129 		else if (!iCurrentWindow->UsingPointerBuffer() || (type != TPointerEvent::EMove && type != TPointerEvent::EDrag))
  1101 		else if (!iCurrentWindow->UsingPointerBuffer() || (type != TPointerEvent::EMove && type != TPointerEvent::EDrag))
  1130 			{
  1102 			{
  1131 #ifdef LOG_WSERV_EVENTS
       
  1132 			RDebug::Printf("_WSEVENT_POINTER: Calling ProcessPointerEvent for non primary pointer");
       
  1133 #endif
       
  1134 			ProcessPointerEvent(aEvent);
  1103 			ProcessPointerEvent(aEvent);
  1135 			}
  1104 			}
  1136 		}
  1105 		}
  1137 	if (!MovesAvailable() && (type==TPointerEvent::EButton1Up || 
  1106 	if (!MovesAvailable() && (type==TPointerEvent::EButton1Up || 
  1138 			                  type==TPointerEvent::ESwitchOn  ||
  1107 			                  type==TPointerEvent::ESwitchOn  ||
  1442 	
  1411 	
  1443 	TRawEvent::TType type=aRawEvent.Type();
  1412 	TRawEvent::TType type=aRawEvent.Type();
  1444 	TInt pointerNumber = aRawEvent.PointerNumber();
  1413 	TInt pointerNumber = aRawEvent.PointerNumber();
  1445     
  1414     
  1446 #ifdef LOG_WSERV_EVENTS
  1415 #ifdef LOG_WSERV_EVENTS
  1447 	RDebug::Printf("_WSEVENT_POINTER: TWsPointer::UpdatePrimaryPointer Current Primary pointer = %d",iPrimaryPointer);
  1416 	RDebug::Printf("{EVNT}TWsPointer::UpdatePrimaryPointer Current Primary pointer = %d",iPrimaryPointer);
  1448 	for(TInt i=0; i< iMaxPointers; i++)
  1417 	RDebug::Printf("{EVNT}TWsPointer::UpdatePrimaryPointer Pointer Number= %d  State = %x XY(%d,%d)",iPointers[0].iNumber,iPointers[0].iState,iPointers[0].iPos.iX,iPointers[0].iPos.iY);
  1449 		{
  1418     RDebug::Printf("{EVNT}TWsPointer::UpdatePrimaryPointer Pointer Number= %d  State = %x XY(%d,%d)",iPointers[1].iNumber,iPointers[1].iState,iPointers[1].iPos.iX,iPointers[1].iPos.iY);
  1450 		RDebug::Printf("_WSEVENT_POINTER: TWsPointer::UpdatePrimaryPointer Pointer Number= %d  State = %x XY(%d,%d)",iPointers[i].iNumber,iPointers[i].iState,iPointers[i].iPos.iX,iPointers[i].iPos.iY);
       
  1451 		}
       
  1452 #endif
  1419 #endif
  1453 	
  1420 	
  1454 	// If primary pointer is out of range, then the first pointer that will 
  1421 	// If primary pointer is out of range, then the first pointer that will 
  1455 	// start being detected (come back in range) will become primary.
  1422 	// start being detected (come back in range) will become primary.
  1456 	if (iPointers[iPrimaryPointer].iState == EPointerStateOutOfRange)
  1423 	if (iPointers[iPrimaryPointer].iState == EPointerStateOutOfRange)
  1457 		{
  1424 		{
  1458 		if (type != TRawEvent::EPointer3DOutOfRange && iPointers[pointerNumber].iState == EPointerStateOutOfRange)
  1425 		if (type != TRawEvent::EPointer3DOutOfRange && iPointers[pointerNumber].iState == EPointerStateOutOfRange)
  1459 			{
  1426 			{
  1460 			iPrimaryPointer = pointerNumber;
  1427 			iPrimaryPointer = pointerNumber;
  1461 #ifdef LOG_WSERV_EVENTS
  1428 #ifdef LOG_WSERV_EVENTS
  1462 	        RDebug::Printf("_WSEVENT_POINTER: TWsPointer::UpdatePrimaryPointer New Primary pointer(OutRange) = %d",iPrimaryPointer);
  1429 	        RDebug::Printf("{EVNT}TWsPointer::UpdatePrimaryPointer New Primary pointer(case OutRange) = %d",iPrimaryPointer);
  1463 #endif
  1430 #endif
  1464 			}
  1431 			}
  1465 		return;
  1432 		return;
  1466 		}
  1433 		}
  1467 	
  1434 	
  1468 	// if non-primary pointer sends EButton1Down event, and actual primary pointer
  1435 	// if non-primary pointer sends EButton1Down event, and actual primary pointer
  1469 	// is not down, then the pointer which has sent EButton1Down becomes primary.
  1436 	// is not down, then the pointer which has sent EButton1Down becomes primary.
  1470 	if (type == TRawEvent::EButton1Down && 
  1437 	if (type == TRawEvent::EButton1Down && 
  1471 		iPointers[iPrimaryPointer].iState != EPointerStateDown)
  1438 		iPointers[iPrimaryPointer].iState != EPointerStateDown)
  1472 		{
  1439 		{ 
  1473 		iPrimaryPointer = pointerNumber;
  1440 		iPrimaryPointer = pointerNumber;
  1474 #ifdef LOG_WSERV_EVENTS
  1441 #ifdef LOG_WSERV_EVENTS
  1475         RDebug::Printf("_WSEVENT_POINTER: TWsPointer::UpdatePrimaryPointer New Primary pointer(ButtonDown) = %d",iPrimaryPointer);
  1442         RDebug::Printf("{EVNT}TWsPointer::UpdatePrimaryPointer New Primary pointer(case ButtonDown) = %d",iPrimaryPointer);
  1476 #endif
  1443 #endif
  1477 		return;
  1444 		return;
  1478 		}
  1445 		}
  1479 	}
  1446 	}
  1480 
  1447 
  1586 Usability studies have shown that the user's perception of the location of the pointer hit is always 
  1553 Usability studies have shown that the user's perception of the location of the pointer hit is always 
  1587 away from few pixels north of the actual hit centre as detected by the digitizer device. So, this function
  1554 away from few pixels north of the actual hit centre as detected by the digitizer device. So, this function
  1588 will shift all pointer events by a specified Y displacement.
  1555 will shift all pointer events by a specified Y displacement.
  1589 
  1556 
  1590 @param aY Current y coordinate pointer position.
  1557 @param aY Current y coordinate pointer position.
  1591  
  1558 */
  1592  */
       
  1593 void TWsPointer::ShiftYCoordinate(TInt& aY)
  1559 void TWsPointer::ShiftYCoordinate(TInt& aY)
  1594     {
  1560     {
  1595     WS_ASSERT_DEBUG(iYOffset>=0, EWsPanicInvalidPointerOffset);
  1561 	// If iYOffsetMax is zero or both topOffset and bottomOffset is zero then return without doing anything
  1596     if (aY >= iYOffset)
  1562 	if (!iYOffsetMax || !(iYOffsetTop || iYOffsetBottom))
  1597         {
  1563 		return;
  1598         aY -=iYOffset;
  1564 	
  1599         }
  1565 	if (aY >= iYOffsetMax )	
  1600     else
  1566 		{
  1601         {
  1567 		CScreen* screen=iRootWindow->Screen();
  1602         aY=0;
  1568 		TInt displayHeight = screen->SizeInPixels().iHeight;
  1603         }
  1569 
       
  1570 		// Gradual reduction of Yoffset depending upon the aY value
       
  1571 		TInt offset = iYOffsetTop + iYOffsetBottom - ( iYOffsetTop * 
       
  1572 				aY / displayHeight );
       
  1573 		
       
  1574 		if ( offset > iYOffsetMax )
       
  1575 			{
       
  1576 			offset = iYOffsetMax;
       
  1577 			}
       
  1578 		aY -=offset;
       
  1579 		
       
  1580 		// As the pixels are zero counted, digitiser would send a pointer with co-ordinates 
       
  1581 		// from 0 to 239 or 0 to 639, if hieght of the screen was 240 or 640.
       
  1582 		// And here we are calulating the Yvalue so it cannot be more than 239 or 639 
       
  1583 		if ( aY > (displayHeight-1) )
       
  1584 			{
       
  1585 			aY = displayHeight-1;
       
  1586 			}
       
  1587 		}
       
  1588 	else
       
  1589 		{
       
  1590 		aY = 0;
       
  1591 		}
  1604     }
  1592     }
  1605 //
  1593 //
  1606 CWsPointerTimer::CWsPointerTimer(MPointerTimerCallback& aPointerTimerCallback)
  1594 CWsPointerTimer::CWsPointerTimer(MPointerTimerCallback& aPointerTimerCallback)
  1607 : CTimer(EPointerRepeatPriority), iPointerTimerCallback(aPointerTimerCallback)
  1595 : CTimer(EPointerRepeatPriority), iPointerTimerCallback(aPointerTimerCallback)
  1608 	{}
  1596 	{}