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::iYOffset; |
|
57 #if defined(__WINS__) |
|
58 TBool TWsPointer::iEmulatorRotatePointerCoords; |
|
59 #endif |
57 |
60 |
58 static _LIT_SECURITY_POLICY_C1(KSecurityPolicy_SwEvent,ECapabilitySwEvent); |
61 static _LIT_SECURITY_POLICY_C1(KSecurityPolicy_SwEvent,ECapabilitySwEvent); |
59 |
62 |
60 void TWsPointer::InitStaticsL() |
63 void TWsPointer::InitStaticsL() |
61 { |
64 { |
68 WS_ASSERT_ALWAYS(iYOffset>=0, EWsPanicInvalidPointerOffset); |
71 WS_ASSERT_ALWAYS(iYOffset>=0, EWsPanicInvalidPointerOffset); |
69 if ( !fetchingSucceeded ) |
72 if ( !fetchingSucceeded ) |
70 { |
73 { |
71 iYOffset = 0; |
74 iYOffset = 0; |
72 } |
75 } |
73 |
76 |
|
77 #if defined(__WINS__) |
|
78 //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. |
|
80 _LIT( KWSERVIniFileVarEmulatorRotPointCoords, "EMULATOR_ROTATE_POINTER_COORDS"); |
|
81 iEmulatorRotatePointerCoords = WsIniFile->FindVar(KWSERVIniFileVarEmulatorRotPointCoords); |
|
82 #endif |
|
83 |
74 iRootWindow = CWsTop::Screen()->RootWindow(); |
84 iRootWindow = CWsTop::Screen()->RootWindow(); |
75 |
85 |
76 TMachineInfoV1Buf machineInfo; |
86 TMachineInfoV1Buf machineInfo; |
77 UserHal::MachineInfo(machineInfo); |
87 UserHal::MachineInfo(machineInfo); |
78 iXyInputType=machineInfo().iXYInputType; |
88 iXyInputType=machineInfo().iXYInputType; |
677 else |
687 else |
678 xy=iPointers[aRawEvent.PointerNumber()].iPos; |
688 xy=iPointers[aRawEvent.PointerNumber()].iPos; |
679 } |
689 } |
680 else |
690 else |
681 { |
691 { |
|
692 #if !defined(__WINS__) |
|
693 TranslateCoordsOnRotation(xy); |
|
694 #else |
|
695 if(iEmulatorRotatePointerCoords) |
|
696 { |
|
697 //emulators that support rotated drawing and touch may want to enable |
|
698 //rotation of pointer events in wsini. |
|
699 TranslateCoordsOnRotation(xy); |
|
700 } |
|
701 #endif |
682 CScreen* screen=iRootWindow->Screen(); |
702 CScreen* screen=iRootWindow->Screen(); |
683 #if !defined(__WINS__) |
|
684 TSize screenSize=screen->SizeInPixels()-TSize(1,1); //This is in the current rotation |
|
685 switch (screen->Orientation()) |
|
686 { |
|
687 case CFbsBitGc::EGraphicsOrientationRotated90: |
|
688 xy.SetXY(xy.iY,screenSize.iHeight-xy.iX); |
|
689 break; |
|
690 case CFbsBitGc::EGraphicsOrientationRotated180: |
|
691 xy=-(xy-screenSize); |
|
692 break; |
|
693 case CFbsBitGc::EGraphicsOrientationRotated270: |
|
694 xy.SetXY(screenSize.iWidth-xy.iY,xy.iX); |
|
695 break; |
|
696 default:; //To stop warning |
|
697 } |
|
698 #endif |
|
699 ShiftYCoordinate(xy.iY); |
703 ShiftYCoordinate(xy.iY); |
700 // Move the raw event position by shifting it by Origin and scale |
704 // Move the raw event position by shifting it by Origin and scale |
701 xy=screen->PhysicalToLogical(xy); |
705 xy=screen->PhysicalToLogical(xy); |
702 RestrictPos(xy); |
706 RestrictPos(xy); |
703 } |
707 } |
704 aRawEvent.Set(type, xy.iX, xy.iY, |
708 aRawEvent.Set(type, xy.iX, xy.iY, |
705 iIs3DPointer ? aRawEvent.Pos3D().iZ : 0); |
709 iIs3DPointer ? aRawEvent.Pos3D().iZ : 0); |
706 } |
710 } |
707 return ETrue; |
711 return ETrue; |
|
712 } |
|
713 |
|
714 void TWsPointer::TranslateCoordsOnRotation(TPoint& aPoint) |
|
715 { |
|
716 CScreen* screen=iRootWindow->Screen(); |
|
717 TSize screenSize=screen->SizeInPixels()-TSize(1,1); //This is in the current rotation |
|
718 switch (screen->Orientation()) |
|
719 { |
|
720 case CFbsBitGc::EGraphicsOrientationRotated90: |
|
721 aPoint.SetXY(aPoint.iY,screenSize.iHeight-aPoint.iX); |
|
722 break; |
|
723 case CFbsBitGc::EGraphicsOrientationRotated180: |
|
724 aPoint=-(aPoint-screenSize); |
|
725 break; |
|
726 case CFbsBitGc::EGraphicsOrientationRotated270: |
|
727 aPoint.SetXY(screenSize.iWidth-aPoint.iY,aPoint.iX); |
|
728 break; |
|
729 default:; //To stop warning |
|
730 } |
708 } |
731 } |
709 |
732 |
710 /** |
733 /** |
711 * Validates events sent to the Window Server by its Client (Anim or Window Group). |
734 * Validates events sent to the Window Server by its Client (Anim or Window Group). |
712 * May overwrite aRawEvent's Z coordinate and/or pointer number if Client or digitizer driver |
735 * May overwrite aRawEvent's Z coordinate and/or pointer number if Client or digitizer driver |