sl@0: // Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // WsPointer and associated classes definitions sl@0: // sl@0: // sl@0: sl@0: #ifndef __POINTER_H__ sl@0: #define __POINTER_H__ sl@0: sl@0: #include "server.h" sl@0: sl@0: class CWsPointerTimer : public CTimer sl@0: { sl@0: public: sl@0: CWsPointerTimer(); sl@0: void ConstructL(); sl@0: private: sl@0: void RunL(); sl@0: }; sl@0: sl@0: class WsPointer sl@0: { sl@0: enum {EPointerUpdateGapInMicroSeconds=50000}; sl@0: public: sl@0: static void InitStaticsL(); sl@0: static void DeleteStatics(); sl@0: static inline TPointerCursorMode PointerCursorMode(); sl@0: static inline void SetPointerCursorMode(TPointerCursorMode aMode); sl@0: static inline TPoint PointerCursorPos(); sl@0: static void SetPointerCursorPos(TPoint aPos); sl@0: static void ReLogCurrentWindow(); sl@0: static void ReLogCurrentWindow(TPoint &aPos, TPoint &aParentPos, const CWsWindowGroup *aForceInGroup); sl@0: static void ReLogWindow(const CWsWindow *aWin); sl@0: static void WindowDisconected(const CWsWindow *deletedWindow); sl@0: static void ClaimGrab(const CWsWindow *aWindow, TBool aSendUpEvent); sl@0: #if defined(__WINS__) sl@0: static TBool PreProcessEvent(TRawEvent &aRawEvent,TBool aFromHardware=EFalse); sl@0: #else sl@0: static TBool PreProcessEvent(TRawEvent &aRawEvent); sl@0: #endif sl@0: static void ProcessEvent(TPointerEvent::TType type, const TPoint &aPos, TUint aModifiers sl@0: ,const CWsWindowGroup *aForceInGroup,TBool aNatural); sl@0: static void GetDoubleClickSettings(TTimeIntervalMicroSeconds32 &aTime, TInt &aDistance); sl@0: static void SetDoubleClick(const TTimeIntervalMicroSeconds32 &aTime, TInt aDistance); sl@0: static void UpdatePointerCursor(); sl@0: static void RequestPointerRepeatEvent(CWsWindow *aWindow, TTimeIntervalMicroSeconds32 aTime,const TRect &aRect); sl@0: static void CancelPointerRepeatEventRequest(); sl@0: static void RepeatTimerCompleted(); sl@0: static TEventQueueWalkRet PointerRepeatPurgeCheck(const TWsEvent *aEvent); sl@0: static void UnmatchedDownPurged(TPointerEvent::TType aPointerType, TUint aHandle); sl@0: static void TimerExpired(); sl@0: static inline TBool XyInput(); sl@0: #if defined(__WINS__) sl@0: static void SetXyInputType(TXYInputType aXyInputType); sl@0: #endif sl@0: private: sl@0: static void PointerCursorUpdateCheck(); sl@0: static void ProcessForegroundCheck(); sl@0: static void RestrictPos(TPoint& aPos,TBool aWithinDrawableArea=ETrue); sl@0: static void ProcessEvent(TWsEvent& aEvent); sl@0: static TBool PointerEventRepeatCheck(const TWsEvent *aEvent, TUint32 aHandle); sl@0: static void SendEnterExitEvent(TEventCode aType); sl@0: static void SetCurrentWindow(const CWsWindow *aWin); sl@0: static void ProcessPointerEvent(TWsEvent& aEvent); sl@0: static TBool QueuePointerEvent(const CWsWindow *aWindow, TWsEvent &event); sl@0: static TBool CheckDownEventPurged(TPointerEvent::TType aType); sl@0: static void UpdatePointerCursorTo(CWsPointerCursor* aNewCursor); sl@0: static CWsPointerCursor* CalculatePointerCursor(); sl@0: static inline TBool MovesAvailable(); sl@0: static inline TBool DeltaMouse(); sl@0: private: sl@0: static TPoint iCurrentPos; sl@0: static TBool iPointerDown; // Maps onto button1 down on multi button systems sl@0: static TXYInputType iXyInputType; sl@0: static const CWsWindow *iCurrentWindow; sl@0: static const CWsWindow *iGrabWindow; sl@0: static const CWsWindow *iActualWinPointerIsOver; sl@0: static const CWsWindow *iPrevClickWindow; sl@0: static TPoint iPrevClickPos; sl@0: static TTime iPrevClickTime; sl@0: static TPointerEvent::TType iPrevClickEventType; sl@0: static TTimeIntervalMicroSeconds32 iDoubleClickMaxInterval; sl@0: static TInt iDoubleClickMaxDistance; sl@0: static CWsPointerCursor *iCursorSprite; sl@0: static CWsPointerTimer *iRepeatTimer; sl@0: static TPointerCursorMode iPointerCursorMode; sl@0: static CWsWindow *iRepeatWindow; sl@0: static TRect iRepeatRect; sl@0: static TUint iLastUnmatchedDown1; sl@0: static TUint iLastUnmatchedDown2; sl@0: static TUint iLastUnmatchedDown3; sl@0: static TBool iTimerQueued; sl@0: static TBool iUpdateRequired; sl@0: static CPeriodic *iPeriodicTimer; sl@0: static CWsRootWindow* iRootWindow; // uses sl@0: }; sl@0: sl@0: class CWsPointerBuffer : public CBase sl@0: { sl@0: public: sl@0: ~CWsPointerBuffer(); sl@0: static void ConnectL(CWsClientWindow *aWindow, TInt aMaxPoints, TUint aFlags); sl@0: static void Disconnect(CWsClientWindow *aWindow); sl@0: static void PointerEvent(CWsClientWindow *aWindow,const TPoint &aPoint); sl@0: static void RetrievePointerMoveBuffer(CWsClientWindow *aWindow,TInt aMaxPoints); sl@0: static void DiscardPointerMoveBuffer(CWsClientWindow *aWindow); sl@0: static void DiscardPointerMoveBuffer(TUint aHandle); sl@0: private: sl@0: static void AdjustMaxSizeL(); sl@0: static void Reset(); sl@0: static void SignalBufferReady(); sl@0: private: sl@0: CWsClientWindow *iWindow; sl@0: TInt iMaxPoints; sl@0: TInt iFlags; sl@0: TSglQueLink iQue; sl@0: static TBool iSignalled; sl@0: static CWsPointerBuffer *iCurrentBuffer; sl@0: static CCirBuf *iPointerBuffer; sl@0: static TSglQue iList; sl@0: }; sl@0: sl@0: sl@0: inline void WsPointer::SetPointerCursorMode(TPointerCursorMode aMode) sl@0: { sl@0: iPointerCursorMode=aMode; sl@0: } sl@0: sl@0: inline TPointerCursorMode WsPointer::PointerCursorMode() sl@0: { sl@0: return iPointerCursorMode; sl@0: } sl@0: sl@0: inline TPoint WsPointer::PointerCursorPos() sl@0: { sl@0: return iCurrentPos; sl@0: } sl@0: sl@0: inline TBool WsPointer::XyInput() sl@0: { sl@0: return iXyInputType!=EXYInputNone; sl@0: } sl@0: sl@0: inline TBool WsPointer::MovesAvailable() sl@0: { sl@0: return (iXyInputType!=EXYInputNone && iXyInputType!=EXYInputPointer); sl@0: } sl@0: sl@0: inline TBool WsPointer::DeltaMouse() sl@0: { sl@0: return (iXyInputType==EXYInputDeltaMouse); sl@0: } sl@0: sl@0: #endif