1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 1995-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
51 TInt TWsPointer::iExitHighPressureThreshold; |
51 TInt TWsPointer::iExitHighPressureThreshold; |
52 TBool CWsPointerBuffer::iSignalled=EFalse; |
52 TBool CWsPointerBuffer::iSignalled=EFalse; |
53 CWsPointerBuffer* CWsPointerBuffer::iCurrentBuffer=NULL; |
53 CWsPointerBuffer* CWsPointerBuffer::iCurrentBuffer=NULL; |
54 CCirBuf<TPoint>* CWsPointerBuffer::iPointerBuffer=NULL; |
54 CCirBuf<TPoint>* CWsPointerBuffer::iPointerBuffer=NULL; |
55 TSglQue<CWsPointerBuffer> CWsPointerBuffer::iList(_FOFF(CWsPointerBuffer,iQue)); |
55 TSglQue<CWsPointerBuffer> CWsPointerBuffer::iList(_FOFF(CWsPointerBuffer,iQue)); |
56 TInt TWsPointer::iYOffset; |
56 TInt TWsPointer::iYOffsetTop; |
|
57 TInt TWsPointer::iYOffsetBottom; |
|
58 TInt TWsPointer::iYOffsetMax; |
57 #if defined(__WINS__) |
59 #if defined(__WINS__) |
58 TBool TWsPointer::iEmulatorRotatePointerCoords; |
60 TBool TWsPointer::iEmulatorRotatePointerCoords; |
59 #endif |
61 #endif |
60 |
62 |
61 static _LIT_SECURITY_POLICY_C1(KSecurityPolicy_SwEvent,ECapabilitySwEvent); |
63 static _LIT_SECURITY_POLICY_C1(KSecurityPolicy_SwEvent,ECapabilitySwEvent); |
62 |
64 |
63 void TWsPointer::InitStaticsL() |
65 void TWsPointer::InitStaticsL() |
64 { |
66 { |
65 //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. |
66 //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 |
67 //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). |
68 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 |
69 _LIT( KWSERVIniFileVarYShifting, "YSHIFTING"); |
71 //when the finger input is moved towards bottom of the screen |
70 TBool fetchingSucceeded = WsIniFile->FindVar(KWSERVIniFileVarYShifting, iYOffset); |
72 iYOffsetTop = 0; |
71 WS_ASSERT_ALWAYS(iYOffset>=0, EWsPanicInvalidPointerOffset); |
73 iYOffsetBottom = 0; |
72 if ( !fetchingSucceeded ) |
74 iYOffsetMax = 0; |
73 { |
75 _LIT( KWSERVIniFileVarYShiftingTop, "YSHIFTINGTOP"); |
74 iYOffset = 0; |
76 _LIT( KWSERVIniFileVarYShiftingBottom, "YSHIFTINGBOTTOM"); |
75 } |
77 _LIT( KWSERVIniFileVarYShiftingMax, "YSHIFTINGMAX"); |
|
78 WsIniFile->FindVar(KWSERVIniFileVarYShiftingTop, iYOffsetTop); |
|
79 WsIniFile->FindVar(KWSERVIniFileVarYShiftingBottom, iYOffsetBottom); |
|
80 WsIniFile->FindVar(KWSERVIniFileVarYShiftingMax, iYOffsetMax); |
76 |
81 |
77 #if defined(__WINS__) |
82 #if defined(__WINS__) |
78 //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. |
79 //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. |
80 _LIT( KWSERVIniFileVarEmulatorRotPointCoords, "EMULATOR_ROTATE_POINTER_COORDS"); |
85 _LIT( KWSERVIniFileVarEmulatorRotPointCoords, "EMULATOR_ROTATE_POINTER_COORDS"); |
1524 Usability studies have shown that the user's perception of the location of the pointer hit is always |
1529 Usability studies have shown that the user's perception of the location of the pointer hit is always |
1525 away from few pixels north of the actual hit centre as detected by the digitizer device. So, this function |
1530 away from few pixels north of the actual hit centre as detected by the digitizer device. So, this function |
1526 will shift all pointer events by a specified Y displacement. |
1531 will shift all pointer events by a specified Y displacement. |
1527 |
1532 |
1528 @param aY Current y coordinate pointer position. |
1533 @param aY Current y coordinate pointer position. |
1529 |
1534 */ |
1530 */ |
|
1531 void TWsPointer::ShiftYCoordinate(TInt& aY) |
1535 void TWsPointer::ShiftYCoordinate(TInt& aY) |
1532 { |
1536 { |
1533 WS_ASSERT_DEBUG(iYOffset>=0, EWsPanicInvalidPointerOffset); |
1537 // If iYOffsetMax is zero or both topOffset and bottomOffset is zero then return without doing anything |
1534 if (aY >= iYOffset) |
1538 if (!iYOffsetMax || !(iYOffsetTop || iYOffsetBottom)) |
1535 { |
1539 return; |
1536 aY -=iYOffset; |
1540 |
1537 } |
1541 if (aY >= iYOffsetMax ) |
1538 else |
1542 { |
1539 { |
1543 CScreen* screen=iRootWindow->Screen(); |
1540 aY=0; |
1544 TInt displayHeight = screen->SizeInPixels().iHeight; |
1541 } |
1545 |
|
1546 // Gradual reduction of Yoffset depending upon the aY value |
|
1547 TInt offset = iYOffsetTop + iYOffsetBottom - ( iYOffsetTop * |
|
1548 aY / displayHeight ); |
|
1549 |
|
1550 if ( offset > iYOffsetMax ) |
|
1551 { |
|
1552 offset = iYOffsetMax; |
|
1553 } |
|
1554 aY -=offset; |
|
1555 |
|
1556 // As the pixels are zero counted, digitiser would send a pointer with co-ordinates |
|
1557 // from 0 to 239 or 0 to 639, if hieght of the screen was 240 or 640. |
|
1558 // And here we are calulating the Yvalue so it cannot be more than 239 or 639 |
|
1559 if ( aY > (displayHeight-1) ) |
|
1560 { |
|
1561 aY = displayHeight-1; |
|
1562 } |
|
1563 } |
|
1564 else |
|
1565 { |
|
1566 aY = 0; |
|
1567 } |
1542 } |
1568 } |
1543 // |
1569 // |
1544 CWsPointerTimer::CWsPointerTimer(MPointerTimerCallback& aPointerTimerCallback) |
1570 CWsPointerTimer::CWsPointerTimer(MPointerTimerCallback& aPointerTimerCallback) |
1545 : CTimer(EPointerRepeatPriority), iPointerTimerCallback(aPointerTimerCallback) |
1571 : CTimer(EPointerRepeatPriority), iPointerTimerCallback(aPointerTimerCallback) |
1546 {} |
1572 {} |