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