Update contrib.
1 // Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // WsPointer and associated classes definitions
23 class CWsPointerTimer : public CTimer
34 enum {EPointerUpdateGapInMicroSeconds=50000};
36 static void InitStaticsL();
37 static void DeleteStatics();
38 static inline TPointerCursorMode PointerCursorMode();
39 static inline void SetPointerCursorMode(TPointerCursorMode aMode);
40 static inline TPoint PointerCursorPos();
41 static void SetPointerCursorPos(TPoint aPos);
42 static void ReLogCurrentWindow();
43 static void ReLogCurrentWindow(TPoint &aPos, TPoint &aParentPos, const CWsWindowGroup *aForceInGroup);
44 static void ReLogWindow(const CWsWindow *aWin);
45 static void WindowDisconected(const CWsWindow *deletedWindow);
46 static void ClaimGrab(const CWsWindow *aWindow, TBool aSendUpEvent);
48 static TBool PreProcessEvent(TRawEvent &aRawEvent,TBool aFromHardware=EFalse);
50 static TBool PreProcessEvent(TRawEvent &aRawEvent);
52 static void ProcessEvent(TPointerEvent::TType type, const TPoint &aPos, TUint aModifiers
53 ,const CWsWindowGroup *aForceInGroup,TBool aNatural);
54 static void GetDoubleClickSettings(TTimeIntervalMicroSeconds32 &aTime, TInt &aDistance);
55 static void SetDoubleClick(const TTimeIntervalMicroSeconds32 &aTime, TInt aDistance);
56 static void UpdatePointerCursor();
57 static void RequestPointerRepeatEvent(CWsWindow *aWindow, TTimeIntervalMicroSeconds32 aTime,const TRect &aRect);
58 static void CancelPointerRepeatEventRequest();
59 static void RepeatTimerCompleted();
60 static TEventQueueWalkRet PointerRepeatPurgeCheck(const TWsEvent *aEvent);
61 static void UnmatchedDownPurged(TPointerEvent::TType aPointerType, TUint aHandle);
62 static void TimerExpired();
63 static inline TBool XyInput();
65 static void SetXyInputType(TXYInputType aXyInputType);
68 static void PointerCursorUpdateCheck();
69 static void ProcessForegroundCheck();
70 static void RestrictPos(TPoint& aPos,TBool aWithinDrawableArea=ETrue);
71 static void ProcessEvent(TWsEvent& aEvent);
72 static TBool PointerEventRepeatCheck(const TWsEvent *aEvent, TUint32 aHandle);
73 static void SendEnterExitEvent(TEventCode aType);
74 static void SetCurrentWindow(const CWsWindow *aWin);
75 static void ProcessPointerEvent(TWsEvent& aEvent);
76 static TBool QueuePointerEvent(const CWsWindow *aWindow, TWsEvent &event);
77 static TBool CheckDownEventPurged(TPointerEvent::TType aType);
78 static void UpdatePointerCursorTo(CWsPointerCursor* aNewCursor);
79 static CWsPointerCursor* CalculatePointerCursor();
80 static inline TBool MovesAvailable();
81 static inline TBool DeltaMouse();
83 static TPoint iCurrentPos;
84 static TBool iPointerDown; // Maps onto button1 down on multi button systems
85 static TXYInputType iXyInputType;
86 static const CWsWindow *iCurrentWindow;
87 static const CWsWindow *iGrabWindow;
88 static const CWsWindow *iActualWinPointerIsOver;
89 static const CWsWindow *iPrevClickWindow;
90 static TPoint iPrevClickPos;
91 static TTime iPrevClickTime;
92 static TPointerEvent::TType iPrevClickEventType;
93 static TTimeIntervalMicroSeconds32 iDoubleClickMaxInterval;
94 static TInt iDoubleClickMaxDistance;
95 static CWsPointerCursor *iCursorSprite;
96 static CWsPointerTimer *iRepeatTimer;
97 static TPointerCursorMode iPointerCursorMode;
98 static CWsWindow *iRepeatWindow;
99 static TRect iRepeatRect;
100 static TUint iLastUnmatchedDown1;
101 static TUint iLastUnmatchedDown2;
102 static TUint iLastUnmatchedDown3;
103 static TBool iTimerQueued;
104 static TBool iUpdateRequired;
105 static CPeriodic *iPeriodicTimer;
106 static CWsRootWindow* iRootWindow; // uses
109 class CWsPointerBuffer : public CBase
113 static void ConnectL(CWsClientWindow *aWindow, TInt aMaxPoints, TUint aFlags);
114 static void Disconnect(CWsClientWindow *aWindow);
115 static void PointerEvent(CWsClientWindow *aWindow,const TPoint &aPoint);
116 static void RetrievePointerMoveBuffer(CWsClientWindow *aWindow,TInt aMaxPoints);
117 static void DiscardPointerMoveBuffer(CWsClientWindow *aWindow);
118 static void DiscardPointerMoveBuffer(TUint aHandle);
120 static void AdjustMaxSizeL();
122 static void SignalBufferReady();
124 CWsClientWindow *iWindow;
128 static TBool iSignalled;
129 static CWsPointerBuffer *iCurrentBuffer;
130 static CCirBuf<TPoint> *iPointerBuffer;
131 static TSglQue<CWsPointerBuffer> iList;
135 inline void WsPointer::SetPointerCursorMode(TPointerCursorMode aMode)
137 iPointerCursorMode=aMode;
140 inline TPointerCursorMode WsPointer::PointerCursorMode()
142 return iPointerCursorMode;
145 inline TPoint WsPointer::PointerCursorPos()
150 inline TBool WsPointer::XyInput()
152 return iXyInputType!=EXYInputNone;
155 inline TBool WsPointer::MovesAvailable()
157 return (iXyInputType!=EXYInputNone && iXyInputType!=EXYInputPointer);
160 inline TBool WsPointer::DeltaMouse()
162 return (iXyInputType==EXYInputDeltaMouse);