1 // Copyright (c) 1999-2010 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 1999-2009 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> |
|
32 |
31 |
33 class CWsClient; |
32 class CWsClient; |
34 class CWsWindowBase; |
33 class CWsWindowBase; |
35 class CWsWindowGroup; |
34 class CWsWindowGroup; |
36 class MEventHandler; |
35 class MEventHandler; |
37 class CWsHotKey; |
36 class CWsHotKey; |
38 class CWsCaptureLongKey; |
37 class CWsCaptureLongKey; |
39 class CScreen; |
38 class CScreen; |
40 class DWsScreenDevice; |
39 class DWsScreenDevice; |
41 |
40 |
42 const TInt KRetryInitialDelay = 100000; //0.01 second |
41 const TInt KRetryInitialDelay = 100000; //0.1 second |
43 |
42 |
44 struct TEventRequestItem |
43 struct TEventRequestItem |
45 { |
44 { |
46 const CWsWindowBase *iWindow; |
45 const CWsWindowBase *iWindow; |
47 TInt iParam; |
46 TInt iParam; |
77 }; |
76 }; |
78 |
77 |
79 class TRepeatKey |
78 class TRepeatKey |
80 { |
79 { |
81 public: |
80 public: |
82 TKeyEventRouterOutput iOutput; |
81 TKeyData iKey; |
83 TInt iInputScanCode; |
82 TInt iScanCode; |
84 }; |
83 }; |
85 |
84 |
86 class CKeyboardRepeat : public CTimer |
85 class CKeyboardRepeat : public CTimer |
87 { |
86 { |
88 public: |
87 public: |
89 CKeyboardRepeat(); |
88 CKeyboardRepeat(); |
90 static void NewL(); |
89 static void NewL(); |
91 static void Destroy(); |
90 static void Destroy(); |
92 static void KeyDown(); |
91 static void KeyDown(); |
93 static void KeyUp(TInt aScanCode); |
92 static void KeyUp(TInt aScanCode); |
94 static void StartRepeat(TInt aInputScanCode, const TKeyEventRouterOutput& aShortEvent, const TKeyEventRouterOutput* aLongEvent); |
93 static TBool StartRepeat(const TKeyData &aKey, TInt aScanCode, CWsWindowGroup *aRepeatFocus, CWsCaptureLongKey* longCapture); |
95 static void CancelRepeat(CWsWindowGroup *aRepeatFocus); |
94 static void CancelRepeat(CWsWindowGroup *aRepeatFocus); |
96 static void CancelRepeat(const TAny* aCaptureHandle, TBool aLongCaptureFlag); |
95 static void CancelRepeat(CWsWindowGroup *aRepeatFocus,TUint aScanCode,TBool aLongCaptureFlag,TUint aModifiers=0); |
97 static void SetRepeatTime(const TTimeIntervalMicroSeconds32 &aInitialTime, const TTimeIntervalMicroSeconds32 &aTime); |
96 static void SetRepeatTime(const TTimeIntervalMicroSeconds32 &aInitialTime, const TTimeIntervalMicroSeconds32 &aTime); |
98 static void GetRepeatTime(TTimeIntervalMicroSeconds32 &aInitialTime, TTimeIntervalMicroSeconds32 &aTime); |
97 static void GetRepeatTime(TTimeIntervalMicroSeconds32 &aInitialTime, TTimeIntervalMicroSeconds32 &aTime); |
99 static inline TBool IsAreadyActive(); |
98 static inline TBool IsAreadyActive(); |
100 private: |
99 private: |
101 enum TRepeatType |
100 enum TRepeatType |
107 }; |
106 }; |
108 private: |
107 private: |
109 static void doCancelRepeat(); |
108 static void doCancelRepeat(); |
110 void RunL(); |
109 void RunL(); |
111 private: |
110 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 TRepeatKey iCurrentRepeat; |
115 static TRepeatType iRepeating; |
116 static TRepeatType iRepeating; |
116 static TRepeatKey iCurrentRepeat; |
|
117 static TRepeatKey iAlternateRepeat; |
117 static TRepeatKey iAlternateRepeat; |
118 static TRepeatKey iLongRepeat; |
|
119 static TBool iAlternateRepeatExists; |
118 static TBool iAlternateRepeatExists; |
120 static CWsCaptureLongKey* iLongCapture; |
119 static CWsCaptureLongKey* iLongCapture; |
121 static TInt iRepeatRollover; |
120 static TInt iRepeatRollover; |
122 }; |
121 }; |
123 |
122 |
173 static void InitStaticsL(); |
172 static void InitStaticsL(); |
174 static void DeleteStatics(); |
173 static void DeleteStatics(); |
175 static CWsHotKey* ClearHotKeysL(TInt aHotKey); |
174 static CWsHotKey* ClearHotKeysL(TInt aHotKey); |
176 static void ResetDefaultHotKeyL(TInt aHotKey); |
175 static void ResetDefaultHotKeyL(TInt aHotKey); |
177 static void SetHotKeyL(const TWsClCmdSetHotKey &aHotKey); |
176 static void SetHotKeyL(const TWsClCmdSetHotKey &aHotKey); |
178 static void AddCaptureKeyL(const TKeyCaptureRequest& aRequest); |
177 static void AddCaptureKeyL(const TCaptureKey &aCaptureKey); |
179 static void UpdateCaptureKeyL(const TKeyCaptureRequest& aRequest); |
178 static void SetCaptureKey(TUint32 aHandle, const TCaptureKey &aCaptureKey); |
180 static void CancelCaptureKey(TKeyCaptureType aType, TAny* aHandle); |
179 static void CancelCaptureKey(TUint32 aHandle); |
181 static void ClientDestroyed(CWsClient *aClient); |
180 static void ClientDestroyed(CWsClient *aClient); |
182 static inline void AddToSwitchOnEventListL(const CWsWindowBase &aWindow, TEventControl aCircumstances); |
181 static inline void AddToSwitchOnEventListL(const CWsWindowBase &aWindow, TEventControl aCircumstances); |
183 static inline void RemoveFromSwitchOnEventList(const CWsWindowBase &aWindow); |
182 static inline void RemoveFromSwitchOnEventList(const CWsWindowBase &aWindow); |
184 static inline void AddToErrorMessageListL(const CWsWindowBase &aWindow, TEventControl aCircumstances); |
183 static inline void AddToErrorMessageListL(const CWsWindowBase &aWindow, TEventControl aCircumstances); |
185 static inline void RemoveFromErrorMessageList(const CWsWindowBase &aWindow); |
184 static inline void RemoveFromErrorMessageList(const CWsWindowBase &aWindow); |
206 static TBool SendDisplayChangedEvents(CWsClient *aWsClient, TInt aDisplayNumber, TInt aConfigurationChangeId, TInt aResolutionListChangeId); |
205 static TBool SendDisplayChangedEvents(CWsClient *aWsClient, TInt aDisplayNumber, TInt aConfigurationChangeId, TInt aResolutionListChangeId); |
207 static void SendScreenDeviceChangedEvents(CScreen* aScreen); |
206 static void SendScreenDeviceChangedEvents(CScreen* aScreen); |
208 static void SendScreenDeviceChangedEvent(const CWsWindowBase *aWindow); |
207 static void SendScreenDeviceChangedEvent(const CWsWindowBase *aWindow); |
209 static TBool ProcessErrorMessages(TWsErrorMessage::TErrorCategory aCategory, TInt aError); |
208 static TBool ProcessErrorMessages(TWsErrorMessage::TErrorCategory aCategory, TInt aError); |
210 static void NotifyOom(); |
209 static void NotifyOom(); |
211 static void ProcessKeyPress(const TKeyEvent& aKeyEvent, TBool aCheckRepeat,TInt aRepeats); |
210 static void QueueKeyPress(const TKeyData& aKey, TInt aScanCode, CWsWindowGroup* aRepeatFocus, TBool aCheckRepeat,TInt aRepeats); |
212 static void QueueKeyPress(const TKeyEventRouterOutput& aOutput, TBool aIsRepeat, TInt aRepeats); |
|
213 static void AddEventHandler(MEventHandler *aEventHandler, TBool aAdvancedPointersEnabled); |
211 static void AddEventHandler(MEventHandler *aEventHandler, TBool aAdvancedPointersEnabled); |
214 static void RemoveEventHandler(const MEventHandler *aEventHandler); |
212 static void RemoveEventHandler(const MEventHandler *aEventHandler); |
215 static void PotentialEventHandlerL(TInt aNum); |
213 static void PotentialEventHandlerL(TInt aNum); |
216 static TInt AddNotificationHandler(CAnim* aAnim, TUint32 aNotifications); |
214 static TInt AddNotificationHandler(CAnim* aAnim, TUint32 aNotifications); |
217 static void RemoveNotificationHandler(CAnim* aAnim); |
215 static void RemoveNotificationHandler(CAnim* aAnim); |
222 static TInt UnregisterWsEventHandler(MWsEventHandler * aHandler); |
220 static TInt UnregisterWsEventHandler(MWsEventHandler * aHandler); |
223 static void NotifyDrawer(const TWservCrEvent& aEvent); |
221 static void NotifyDrawer(const TWservCrEvent& aEvent); |
224 static void NotifyScreenDrawingEvent(const TRegion* aRegion); |
222 static void NotifyScreenDrawingEvent(const TRegion* aRegion); |
225 static void NotifyScreenDrawingEvent(const TRect& aRect); |
223 static void NotifyScreenDrawingEvent(const TRect& aRect); |
226 static inline const CRawEventReceiver* EventReceiver() {return iEventReceiver;} |
224 static inline const CRawEventReceiver* EventReceiver() {return iEventReceiver;} |
|
225 static void PauseProcessRawEvents(TInt aPauseInterval); |
|
226 static inline TInt GetConfigationPauseTime(); |
|
227 |
227 private: |
228 private: |
228 class TRawEventHandler |
229 class TRawEventHandler |
229 { |
230 { |
230 public: |
231 public: |
231 inline TRawEventHandler(MEventHandler *aEventHandler, TBool aAdvancedPointersEnabled); |
232 inline TRawEventHandler(MEventHandler *aEventHandler, TBool aAdvancedPointersEnabled); |
250 static TEventRequestQueue iFocusChangedQueue; |
251 static TEventRequestQueue iFocusChangedQueue; |
251 static TEventRequestQueue iGroupListChangedQueue; |
252 static TEventRequestQueue iGroupListChangedQueue; |
252 static TEventRequestQueue iScreenDeviceChangedQueue; |
253 static TEventRequestQueue iScreenDeviceChangedQueue; |
253 static TTime iPrevOomMessageTime; |
254 static TTime iPrevOomMessageTime; |
254 static CCaptureKeys *iCaptureKeys; |
255 static CCaptureKeys *iCaptureKeys; |
255 static CKeyEventRouter *iKeyEventRouter; |
|
256 static RLibrary iKeyEventRouterLibrary; |
|
257 static CWsHotKey *iHotKeys; |
256 static CWsHotKey *iHotKeys; |
258 static TInt iModifierState; |
257 static TInt iModifierState; |
259 static CRawEventReceiver *iEventReceiver; |
258 static CRawEventReceiver *iEventReceiver; |
260 static RArray<TRawEventHandler> iEventHandlers; |
259 static RArray<TRawEventHandler> iEventHandlers; |
261 static CArrayFixFlat<SNotificationHandler> *iNotificationHandlers; |
260 static CArrayFixFlat<SNotificationHandler> *iNotificationHandlers; |
262 static TInt iPotentialEventHandlers; |
261 static TInt iPotentialEventHandlers; |
263 static RArray<TDrawerHandler>* iDrawerHandlers; |
262 static RArray<TDrawerHandler>* iDrawerHandlers; |
264 static RArray<TWsEventHandler> iWsEventHandlers; |
263 static RArray<TWsEventHandler> iWsEventHandlers; |
265 static TUint32 iBinaryFlags; |
264 static TUint32 iBinaryFlags; |
266 static TInt iEventHandlerCount; |
265 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; |
267 }; |
274 }; |
268 |
275 |
269 |
276 |
270 // |
277 // |
271 // inlines // |
278 // inlines // |
309 {iGroupListChangedQueue.RemoveFromEventRequestListL(aWindow);} |
316 {iGroupListChangedQueue.RemoveFromEventRequestListL(aWindow);} |
310 inline void TWindowServerEvent::RemoveFromScreenDeviceChangeEventList(const CWsWindowBase &aWindow) |
317 inline void TWindowServerEvent::RemoveFromScreenDeviceChangeEventList(const CWsWindowBase &aWindow) |
311 {iScreenDeviceChangedQueue.RemoveFromEventRequestListL(aWindow);} |
318 {iScreenDeviceChangedQueue.RemoveFromEventRequestListL(aWindow);} |
312 inline TInt TWindowServerEvent::GetStoredModifierState() |
319 inline TInt TWindowServerEvent::GetStoredModifierState() |
313 {return(iModifierState);} |
320 {return(iModifierState);} |
|
321 inline TInt TWindowServerEvent::GetConfigationPauseTime() |
|
322 {return(iConfigationPauseTime);} |
314 |
323 |
315 #endif |
324 #endif |