windowing/windowserver/nga/SERVER/EVENT.H
branchRCL_3
changeset 19 bbf46f59e123
parent 18 57c618273d5c
child 20 25ffed67c7ef
equal deleted inserted replaced
18:57c618273d5c 19:bbf46f59e123
     1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 1999-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".
    25 #include <e32svr.h>
    25 #include <e32svr.h>
    26 #include "W32STD.H"
    26 #include "W32STD.H"
    27 #include "w32cmd.h"
    27 #include "w32cmd.h"
    28 #include "EVQUEUE.H"
    28 #include "EVQUEUE.H"
    29 #include <w32adll.h>
    29 #include <w32adll.h>
    30 #include "Graphics/WSGRAPHICDRAWER.H"
    30 #include "graphics/WSGRAPHICDRAWER.H"
       
    31 #include <graphics/wskeyrouter.h>
    31 
    32 
    32 class CWsClient;
    33 class CWsClient;
    33 class CWsWindowBase;
    34 class CWsWindowBase;
    34 class CWsWindowGroup;
    35 class CWsWindowGroup;
    35 class MEventHandler;
    36 class MEventHandler;
    36 class CWsHotKey;
    37 class CWsHotKey;
    37 class CWsCaptureLongKey;
    38 class CWsCaptureLongKey;
    38 class CScreen;
    39 class CScreen;
    39 class DWsScreenDevice;
    40 class DWsScreenDevice;
    40 
    41 
    41 const TInt KRetryInitialDelay = 100000; //0.1 second
    42 const TInt KRetryInitialDelay = 100000; //0.01 second
    42 
    43 
    43 struct TEventRequestItem
    44 struct TEventRequestItem
    44 	{
    45 	{
    45 	const CWsWindowBase *iWindow;
    46 	const CWsWindowBase *iWindow;
    46 	TInt iParam;
    47 	TInt iParam;
    76 	};
    77 	};
    77 
    78 
    78 class TRepeatKey
    79 class TRepeatKey
    79 	{
    80 	{
    80 public:
    81 public:
    81 	TKeyData iKey;
    82 	TKeyEventRouterOutput iOutput;
    82 	TInt iScanCode;
    83 	TInt iInputScanCode;
    83 	};
    84 	};
    84 
    85 
    85 class CKeyboardRepeat : public CTimer
    86 class CKeyboardRepeat : public CTimer
    86 	{
    87 	{
    87 public:
    88 public:
    88 	CKeyboardRepeat();
    89 	CKeyboardRepeat();
    89 	static void NewL();
    90 	static void NewL();
    90 	static void Destroy();
    91 	static void Destroy();
    91 	static void KeyDown();
    92 	static void KeyDown();
    92 	static void KeyUp(TInt aScanCode);
    93 	static void KeyUp(TInt aScanCode);
    93 	static TBool StartRepeat(const TKeyData &aKey, TInt aScanCode, CWsWindowGroup *aRepeatFocus, CWsCaptureLongKey* longCapture);
    94 	static void StartRepeat(TInt aInputScanCode, const TKeyEventRouterOutput& aShortEvent, const TKeyEventRouterOutput* aLongEvent);
    94 	static void CancelRepeat(CWsWindowGroup *aRepeatFocus);
    95 	static void CancelRepeat(CWsWindowGroup *aRepeatFocus);
    95 	static void CancelRepeat(CWsWindowGroup *aRepeatFocus,TUint aScanCode,TBool aLongCaptureFlag,TUint aModifiers=0);
    96 	static void CancelRepeat(const TAny* aCaptureHandle, TBool aLongCaptureFlag);
    96 	static void SetRepeatTime(const TTimeIntervalMicroSeconds32 &aInitialTime, const TTimeIntervalMicroSeconds32 &aTime);
    97 	static void SetRepeatTime(const TTimeIntervalMicroSeconds32 &aInitialTime, const TTimeIntervalMicroSeconds32 &aTime);
    97 	static void GetRepeatTime(TTimeIntervalMicroSeconds32 &aInitialTime, TTimeIntervalMicroSeconds32 &aTime);
    98 	static void GetRepeatTime(TTimeIntervalMicroSeconds32 &aInitialTime, TTimeIntervalMicroSeconds32 &aTime);
    98 	static inline TBool IsAreadyActive();
    99 	static inline TBool IsAreadyActive();
    99 private:
   100 private:
   100 	enum TRepeatType
   101 	enum TRepeatType
   106 		};
   107 		};
   107 private:
   108 private:
   108 	static void doCancelRepeat();
   109 	static void doCancelRepeat();
   109 	void RunL();
   110 	void RunL();
   110 private:
   111 private:
   111 	static CWsWindowGroup *iFocus;
       
   112 	static CKeyboardRepeat *iThis; // Needed as CTimer derived parts can't be static
   112 	static CKeyboardRepeat *iThis; // Needed as CTimer derived parts can't be static
   113 	static TTimeIntervalMicroSeconds32 iInitialTime;
   113 	static TTimeIntervalMicroSeconds32 iInitialTime;
   114 	static TTimeIntervalMicroSeconds32 iTime;
   114 	static TTimeIntervalMicroSeconds32 iTime;
       
   115 	static TRepeatType iRepeating;
   115 	static TRepeatKey iCurrentRepeat;
   116 	static TRepeatKey iCurrentRepeat;
   116 	static TRepeatType iRepeating;
       
   117 	static TRepeatKey iAlternateRepeat;
   117 	static TRepeatKey iAlternateRepeat;
       
   118 	static TRepeatKey iLongRepeat;
   118 	static TBool iAlternateRepeatExists;
   119 	static TBool iAlternateRepeatExists;
   119 	static CWsCaptureLongKey* iLongCapture;
   120 	static CWsCaptureLongKey* iLongCapture;
   120 	static TInt iRepeatRollover;
   121 	static TInt iRepeatRollover;
   121 	};
   122 	};
   122 
   123 
   172 	static void InitStaticsL();
   173 	static void InitStaticsL();
   173 	static void DeleteStatics();
   174 	static void DeleteStatics();
   174 	static CWsHotKey* ClearHotKeysL(TInt aHotKey);
   175 	static CWsHotKey* ClearHotKeysL(TInt aHotKey);
   175 	static void ResetDefaultHotKeyL(TInt aHotKey);
   176 	static void ResetDefaultHotKeyL(TInt aHotKey);
   176 	static void SetHotKeyL(const TWsClCmdSetHotKey &aHotKey);
   177 	static void SetHotKeyL(const TWsClCmdSetHotKey &aHotKey);
   177 	static void AddCaptureKeyL(const TCaptureKey &aCaptureKey);
   178 	static void AddCaptureKeyL(const TKeyCaptureRequest& aRequest);
   178 	static void SetCaptureKey(TUint32 aHandle, const TCaptureKey &aCaptureKey);
   179 	static void UpdateCaptureKeyL(const TKeyCaptureRequest& aRequest);
   179 	static void CancelCaptureKey(TUint32 aHandle);
   180 	static void CancelCaptureKey(TKeyCaptureType aType, TAny* aHandle);
   180 	static void ClientDestroyed(CWsClient *aClient);
   181 	static void ClientDestroyed(CWsClient *aClient);
   181 	static inline void AddToSwitchOnEventListL(const CWsWindowBase &aWindow, TEventControl aCircumstances);
   182 	static inline void AddToSwitchOnEventListL(const CWsWindowBase &aWindow, TEventControl aCircumstances);
   182 	static inline void RemoveFromSwitchOnEventList(const CWsWindowBase &aWindow);
   183 	static inline void RemoveFromSwitchOnEventList(const CWsWindowBase &aWindow);
   183 	static inline void AddToErrorMessageListL(const CWsWindowBase &aWindow, TEventControl aCircumstances);
   184 	static inline void AddToErrorMessageListL(const CWsWindowBase &aWindow, TEventControl aCircumstances);
   184 	static inline void RemoveFromErrorMessageList(const CWsWindowBase &aWindow);
   185 	static inline void RemoveFromErrorMessageList(const CWsWindowBase &aWindow);
   205 	static TBool SendDisplayChangedEvents(CWsClient *aWsClient, TInt aDisplayNumber, TInt aConfigurationChangeId, TInt aResolutionListChangeId);
   206 	static TBool SendDisplayChangedEvents(CWsClient *aWsClient, TInt aDisplayNumber, TInt aConfigurationChangeId, TInt aResolutionListChangeId);
   206 	static void SendScreenDeviceChangedEvents(CScreen* aScreen);
   207 	static void SendScreenDeviceChangedEvents(CScreen* aScreen);
   207 	static void SendScreenDeviceChangedEvent(const CWsWindowBase *aWindow);
   208 	static void SendScreenDeviceChangedEvent(const CWsWindowBase *aWindow);
   208 	static TBool ProcessErrorMessages(TWsErrorMessage::TErrorCategory aCategory, TInt aError);
   209 	static TBool ProcessErrorMessages(TWsErrorMessage::TErrorCategory aCategory, TInt aError);
   209 	static void NotifyOom();
   210 	static void NotifyOom();
   210 	static void QueueKeyPress(const TKeyData& aKey, TInt aScanCode, CWsWindowGroup* aRepeatFocus, TBool aCheckRepeat,TInt aRepeats);
   211 	static void ProcessKeyPress(const TKeyEvent& aKeyEvent, TBool aCheckRepeat,TInt aRepeats);
       
   212 	static void QueueKeyPress(const TKeyEventRouterOutput& aOutput, TBool aIsRepeat, TInt aRepeats);
   211 	static void AddEventHandler(MEventHandler *aEventHandler, TBool aAdvancedPointersEnabled);
   213 	static void AddEventHandler(MEventHandler *aEventHandler, TBool aAdvancedPointersEnabled);
   212 	static void RemoveEventHandler(const MEventHandler *aEventHandler);
   214 	static void RemoveEventHandler(const MEventHandler *aEventHandler);
   213 	static void PotentialEventHandlerL(TInt aNum);
   215 	static void PotentialEventHandlerL(TInt aNum);
   214 	static TInt AddNotificationHandler(CAnim* aAnim, TUint32 aNotifications);
   216 	static TInt AddNotificationHandler(CAnim* aAnim, TUint32 aNotifications);
   215 	static void RemoveNotificationHandler(CAnim* aAnim);
   217 	static void RemoveNotificationHandler(CAnim* aAnim);
   220 	static TInt UnregisterWsEventHandler(MWsEventHandler * aHandler);
   222 	static TInt UnregisterWsEventHandler(MWsEventHandler * aHandler);
   221 	static void NotifyDrawer(const TWservCrEvent& aEvent);
   223 	static void NotifyDrawer(const TWservCrEvent& aEvent);
   222 	static void NotifyScreenDrawingEvent(const TRegion* aRegion);
   224 	static void NotifyScreenDrawingEvent(const TRegion* aRegion);
   223 	static void NotifyScreenDrawingEvent(const TRect& aRect);
   225 	static void NotifyScreenDrawingEvent(const TRect& aRect);
   224 	static inline const CRawEventReceiver* EventReceiver() {return iEventReceiver;}
   226 	static inline const CRawEventReceiver* EventReceiver() {return iEventReceiver;}
   225 	static void PauseProcessRawEvents(TInt aPauseInterval);
       
   226 	static inline TInt GetConfigationPauseTime();
       
   227 	
       
   228 private:
   227 private:
   229 	class TRawEventHandler
   228 	class TRawEventHandler
   230 		{
   229 		{
   231 		public:
   230 		public:
   232 			inline TRawEventHandler(MEventHandler *aEventHandler, TBool aAdvancedPointersEnabled);
   231 			inline TRawEventHandler(MEventHandler *aEventHandler, TBool aAdvancedPointersEnabled);
   251 	static TEventRequestQueue iFocusChangedQueue;
   250 	static TEventRequestQueue iFocusChangedQueue;
   252 	static TEventRequestQueue iGroupListChangedQueue;
   251 	static TEventRequestQueue iGroupListChangedQueue;
   253 	static TEventRequestQueue iScreenDeviceChangedQueue;
   252 	static TEventRequestQueue iScreenDeviceChangedQueue;
   254 	static TTime iPrevOomMessageTime;
   253 	static TTime iPrevOomMessageTime;
   255 	static CCaptureKeys *iCaptureKeys;
   254 	static CCaptureKeys *iCaptureKeys;
       
   255 	static CKeyEventRouter *iKeyEventRouter;
       
   256 	static RLibrary iKeyEventRouterLibrary;
   256 	static CWsHotKey *iHotKeys;
   257 	static CWsHotKey *iHotKeys;
   257 	static TInt iModifierState;
   258 	static TInt iModifierState;
   258 	static CRawEventReceiver *iEventReceiver;
   259 	static CRawEventReceiver *iEventReceiver;
   259 	static RArray<TRawEventHandler> iEventHandlers;
   260 	static RArray<TRawEventHandler> iEventHandlers;
   260 	static CArrayFixFlat<SNotificationHandler> *iNotificationHandlers;
   261 	static CArrayFixFlat<SNotificationHandler> *iNotificationHandlers;
   261 	static TInt iPotentialEventHandlers;
   262 	static TInt iPotentialEventHandlers;
   262 	static RArray<TDrawerHandler>* iDrawerHandlers;
   263 	static RArray<TDrawerHandler>* iDrawerHandlers;
   263 	static RArray<TWsEventHandler> iWsEventHandlers;
   264 	static RArray<TWsEventHandler> iWsEventHandlers;
   264 	static TUint32 iBinaryFlags;
   265 	static TUint32 iBinaryFlags;
   265 	static TInt iEventHandlerCount;
   266 	static TInt iEventHandlerCount;
   266 
       
   267 	// For supporting a pause in processing raw events after rotation.
       
   268 	// Pause in processing all raw pointer and key events (except processing by anim's dll plug-ins).
       
   269 	// All events will be ignored except for anim's dll plug-ins.
       
   270 	static TTimeIntervalMicroSeconds iPauseInterval;
       
   271 	static TTime iPauseStartTime;
       
   272 	 // Filled from wsini.ini  , example:  SUPPRESSEVENTSTIMEAFTERROTATION   700000 //(0.7sec) 
       
   273 	static TInt iConfigationPauseTime;
       
   274 	};
   267 	};
   275 
   268 
   276 
   269 
   277 //
   270 //
   278 // inlines			//
   271 // inlines			//
   316 	{iGroupListChangedQueue.RemoveFromEventRequestListL(aWindow);}
   309 	{iGroupListChangedQueue.RemoveFromEventRequestListL(aWindow);}
   317 inline void TWindowServerEvent::RemoveFromScreenDeviceChangeEventList(const CWsWindowBase &aWindow)
   310 inline void TWindowServerEvent::RemoveFromScreenDeviceChangeEventList(const CWsWindowBase &aWindow)
   318 	{iScreenDeviceChangedQueue.RemoveFromEventRequestListL(aWindow);}
   311 	{iScreenDeviceChangedQueue.RemoveFromEventRequestListL(aWindow);}
   319 inline TInt TWindowServerEvent::GetStoredModifierState()
   312 inline TInt TWindowServerEvent::GetStoredModifierState()
   320 	{return(iModifierState);}
   313 	{return(iModifierState);}
   321 inline TInt TWindowServerEvent::GetConfigationPauseTime()
       
   322     {return(iConfigationPauseTime);}
       
   323 
   314 
   324 #endif
   315 #endif