os/graphics/windowing/windowserver/nga/SERVER/openwfc/server.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/windowing/windowserver/nga/SERVER/openwfc/server.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,425 @@
     1.4 +// Copyright (c) 1999-2010 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// Window server C++ Class definitions
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#ifndef __SERVER_H__
    1.22 +#define __SERVER_H__
    1.23 +
    1.24 +#include <e32std.h>
    1.25 +#include "W32STD.H"
    1.26 +#include "w32cmd.h"
    1.27 +#include <bitstd.h>
    1.28 +#include <bitdev.h>
    1.29 +#include <e32svr.h>
    1.30 +#include "OBJECT.H"
    1.31 +#include "CLIENT.H"
    1.32 +#include "ScrDev.H"
    1.33 +#include <graphics/wskeyrouter.h>
    1.34 +#include <graphics/WSGRAPHICDRAWERINTERFACE.H>
    1.35 +#include "graphics/wsgraphicdrawerinternal.h"
    1.36 +#include "WSGRAPHICDRAWERARRAY.H"
    1.37 +#include "panics.h"
    1.38 +
    1.39 +class CWsGc;
    1.40 +class CWsDirectScreenAccess;
    1.41 +class CWsAnim;
    1.42 +
    1.43 +const TUid KDllUid={0x10000079};
    1.44 +
    1.45 +const TUint KMaxNumberOfMsgsInQueue=20;
    1.46 +const TUint KMaxNumberOfMsgsInInactiveQueue=2;
    1.47 +
    1.48 +enum TWservActiveObjectPriorities
    1.49 +	{
    1.50 +	EWsGraphicAnimateAwaitIdlePriority=0, // lowest of all, when the system is really idle
    1.51 +	EWsGraphicAnimatePriority=50,		// used by the default animation scheduler; custom schedulers might use other priorities as they see fit
    1.52 +	EComposeMergePriority=80,			// Merges normal priority screen composition requests
    1.53 +	EMainServerPriority=100,
    1.54 +	ESpriteAnimatePriority=900,			// Below normal heartbeat
    1.55 +	EPointerCursorPriority=950,
    1.56 +	EHeartBeatPriority=1000,
    1.57 +	EKeyRepeatPriority=1980,
    1.58 +	EPointerRepeatPriority=1980,// Same as for key repeats
    1.59 +	EEventPriority=2000,
    1.60 +	EComposeCompletePriority=2500,		// Triggers further composition if necessary
    1.61 +	EWsShellLogonPriority=3000,	// Log on to the shell dying
    1.62 +	EDirectTimeOut=4000,
    1.63 +	EDirectAbort=4010,
    1.64 +	};
    1.65 +
    1.66 +enum {ETidyCountSetting=8};
    1.67 +
    1.68 +class CWsClient;
    1.69 +class DWsScreenDevice;
    1.70 +
    1.71 +GLREF_C RWsRegion *GetRegionFromClientL(CWsClient *aClient, TInt aCount);
    1.72 +
    1.73 +//---------------------------
    1.74 +// The event queue
    1.75 +//---------------------------
    1.76 +
    1.77 +#define WS_EVENT_QUEUE_SIZE 50
    1.78 +
    1.79 +// Forward references
    1.80 +
    1.81 +class CWsRedrawMsgWindow;
    1.82 +class CWsWindowRedraw;
    1.83 +class CWsWindow;
    1.84 +class CWsWindowBase;
    1.85 +class CWsWindowGroup;
    1.86 +class CWsClientWindow;
    1.87 +class CWsTopClientWindow;
    1.88 +class CWsClient;
    1.89 +class CWsBackedUpWindow;
    1.90 +class CWsPointerCursor;
    1.91 +class TWindowServerEvent;
    1.92 +class CWsRootWindow;
    1.93 +
    1.94 +enum TFlashState {EFlashOn,EFlashOff};
    1.95 +
    1.96 +struct TPointerKeyList
    1.97 +	{
    1.98 +	TRect iRect;
    1.99 +	TInt iScanCode;
   1.100 +	TBool iActivatedByPointerSwitchOn;
   1.101 +	TDblQueLink iQue;
   1.102 +	};
   1.103 +
   1.104 +struct TWsMessage
   1.105 +	{
   1.106 +	TUid iUid;
   1.107 +	TUint8 iTheRest[4];	// Dummy elemnt where a variable length component will be
   1.108 +	};
   1.109 +
   1.110 +class WsKeyboardEmulator
   1.111 +	{
   1.112 +public:
   1.113 +	static TBool PointerEvent(TPointerEvent::TType type,const TPoint &aPoint, TDblQue<TPointerKeyList> *iPointerKeyList);
   1.114 +private:
   1.115 +	static void RawKeyEvent(TRawEvent::TType aType);
   1.116 +private: // Private data
   1.117 +	static TBool iKeyIsDown;
   1.118 +	static TInt iCurrentKeyDown;
   1.119 +	};
   1.120 +
   1.121 +struct TPointerEventInternal
   1.122 +	{
   1.123 +	TPointerEvent::TType iType;		// Type of pointer event
   1.124 +	TUint iModifiers;	// State of pointing device and associated buttons
   1.125 +	TPoint iPosition; 	// Screen co-ordinates of mouse event
   1.126 +	};
   1.127 +
   1.128 +//------------------------------
   1.129 +// Client object
   1.130 +//------------------------------
   1.131 +
   1.132 +class CWsCliObj : public CWsObject
   1.133 +	{
   1.134 +public:
   1.135 +	static CWsCliObj* NewL(CWsClient *aOwner);
   1.136 +private:
   1.137 +	CWsCliObj(CWsClient *aOwner);
   1.138 +	void ConstructL();
   1.139 +public: //from CWsObject
   1.140 +	void CommandL(TInt aOpcode, const TAny *aCmdData);
   1.141 +	};
   1.142 +
   1.143 +
   1.144 +//---------------------------
   1.145 +// Capture Key
   1.146 +//---------------------------
   1.147 +class CWsCaptureKey : public CWsObject
   1.148 +	{
   1.149 +public:
   1.150 +	CWsCaptureKey(CWsWindowGroup *owner);
   1.151 +	~CWsCaptureKey();
   1.152 +	void ConstructL(const TWsWinCmdCaptureKey &aCaptureKey);
   1.153 +	void SetL(const TWsWinCmdCaptureKey &aCaptureKey);
   1.154 +	void CommandL(TInt aOpcode, const TAny *aCmdData);
   1.155 +	inline CWsWindowGroup *WindowGroup();
   1.156 +	inline const CWsWindowGroup *WindowGroup() const;
   1.157 +private:
   1.158 +	void CmdToRequest(const TWsWinCmdCaptureKey &aCaptureKey, TKeyCaptureRequest &aParams);
   1.159 +private:
   1.160 +	CWsWindowGroup *iWindowGroup;
   1.161 +	};
   1.162 +
   1.163 +class CWsHotKey : public CBase
   1.164 +	{
   1.165 +public:
   1.166 +	CWsHotKey(TInt aHotKey, TBool aIsDefault);
   1.167 +	~CWsHotKey();
   1.168 +	void ConstructLD(const TWsWinCmdCaptureKey &aCaptureKey);
   1.169 +	inline TInt HotKeyType() const;
   1.170 +	inline TInt KeyHandle() const;
   1.171 +	inline TBool IsDefault() const;
   1.172 +	inline void SetLink(CWsHotKey *aLink);
   1.173 +	void SetL(const TWsWinCmdCaptureKey &aCaptureKey);
   1.174 +public:
   1.175 +	CWsHotKey *iNext;
   1.176 +private:
   1.177 +	TInt iHotKeyType;
   1.178 +	TBool iIsDefault;
   1.179 +	CWsCaptureKey *iCaptureKey;
   1.180 +	};
   1.181 +
   1.182 +class CWsCaptureKeyUpsAndDowns : public CWsObject
   1.183 +	{
   1.184 +public:
   1.185 +	CWsCaptureKeyUpsAndDowns(CWsWindowGroup *owner);
   1.186 +	~CWsCaptureKeyUpsAndDowns();
   1.187 +	void ConstructL(const TWsWinCmdCaptureKey &aCaptureKey);
   1.188 +	void CommandL(TInt aOpcode, const TAny *aCmdData);
   1.189 +	inline CWsWindowGroup *WindowGroup();
   1.190 +	inline const CWsWindowGroup *WindowGroup() const;
   1.191 +private:
   1.192 +	CWsWindowGroup *iWindowGroup;
   1.193 +	};
   1.194 +
   1.195 +class CWsCaptureLongKey : public CWsObject
   1.196 +	{
   1.197 +	friend class CKeyboardRepeat;
   1.198 +	friend class TWindowServerEvent;
   1.199 +public:
   1.200 +	CWsCaptureLongKey(CWsWindowGroup *owner);
   1.201 +	~CWsCaptureLongKey();
   1.202 +	void ConstructL(const TWsWinCmdCaptureLongKey &aCaptureKey);
   1.203 +	void CommandL(TInt aOpcode, const TAny *aCmdData);
   1.204 +	inline CWsWindowGroup *WindowGroup();
   1.205 +	inline const CWsWindowGroup *WindowGroup() const;
   1.206 +private:
   1.207 +	TTimeIntervalMicroSeconds32 iDelay;
   1.208 +	TUint iFlags;
   1.209 +	CWsWindowGroup *iWindowGroup;
   1.210 +	};
   1.211 +
   1.212 +//--------------------------------
   1.213 +// Owner of CWsGraphicDrawer
   1.214 +//--------------------------------
   1.215 +
   1.216 +class CWsGraphicDrawerObject: public CWsObject
   1.217 +	{
   1.218 +public:
   1.219 +	static CWsGraphicDrawerObject* NewL(CWsClient* aClient,const TWsClCmdUnion &aParams);
   1.220 +	~CWsGraphicDrawerObject();
   1.221 +	// from CWsObject
   1.222 +	void CommandL(TInt aOpcode, const TAny *aCmdData);
   1.223 +	// access
   1.224 +	CWsGraphicDrawer* Drawer();
   1.225 +	const CWsGraphicDrawer* Drawer() const;
   1.226 +	inline TInt ClientHandle() const;
   1.227 +private:
   1.228 +	CWsGraphicDrawerObject(CWsClient* aOwner);
   1.229 +	void ConstructL(TUid aType,MWsGraphicDrawerEnvironment& aEnv,const TGraphicDrawerId& aId,const TDesC8& aData,TInt aClientHandle);
   1.230 +private:
   1.231 +	static TInt TransientSequence;
   1.232 +	static TBool RollOver;
   1.233 +	CWsGraphicDrawer* iDrawer;
   1.234 +	TInt iClientHandle;
   1.235 +	};
   1.236 +
   1.237 +//----------------------------
   1.238 +// Window's
   1.239 +//----------------------------
   1.240 +enum TWalkMode
   1.241 +	{
   1.242 +	EWalkBehind,
   1.243 +	EWalkChildren,
   1.244 +	EWalkChildrenAndBehind
   1.245 +	};
   1.246 +
   1.247 +enum TWalkModeBackToFront
   1.248 +	{
   1.249 +	EVisitParentNodesFirst, //Useful for re-sending the entire window tree.
   1.250 +	};
   1.251 +
   1.252 +enum TWindowFlags
   1.253 +	{
   1.254 +	EFlagHidden=0x1,			// True if the window is invisble for any reason
   1.255 +	EFlagPointerCaptured=0x2,
   1.256 +	EFlagPointerGrab=0x4,
   1.257 +	EFlagInvisible=0x8,			// True if the client has requested the window to be invisible
   1.258 +	EFlagActive=0x10,			// True if the window has been activated
   1.259 +	EFlagValidRedraw=0x20,      // True if a Begin/End redraw was called with GC commands. An empty Begin/End redraw is used to trigger redraw loop without actually drawing to the window with GC.
   1.260 +//	EFlagHasGcDrawing=0x40,    // True if a GC has drawn on a window.
   1.261 +	EFlagDrawnToScreen=0x80,    // True if the window has been drawn to the screen since it became visible
   1.262 +	//0x100
   1.263 +	EFlagPointerCaptureDragDrop=0x200,	// True if pointure capture in Drag/Drop mode
   1.264 +	EFlagPointerCaptureAllGroups=0x400,	// True if pointer capture affects all groups
   1.265 +	EFlagUsingPointerBuffer=0x800,		// True if using a pointer event buffer
   1.266 +	EFlagHasPointerBuffer=0x1000,		// True if has pointer event buffer allocated
   1.267 +	//0x2000
   1.268 +	EFlagFadeBehind=0x4000,             // True if fade behind requested for this window
   1.269 +	EFlagIsTopClientWindow=0x8000,	// True if is a top level client window
   1.270 +	EFlagNonFadingWindow=0x00010000,		//True if the window should never be faded
   1.271 +	EFlagScreenDeviceInvalid=0x00020000,
   1.272 +	EFlagShutDownInProgress=0x00040000,		// True if the window is currently being shut down
   1.273 +#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
   1.274 +	EFlagHasTransparentSurface=0x00080000,
   1.275 +	EFlagPaintTransparentHoles=0x00100000,
   1.276 +#endif
   1.277 +	//0x00200000,
   1.278 +	//0x00400000,
   1.279 +	//0x00800000,
   1.280 +	EFlagGeneratesVisibilityEvents=0x02000000,	// True if visibility events are enabled for this window
   1.281 +	EFlagCanBeSeen=0x04000000,					// True if the last visibility event indicated that part of the window was visible
   1.282 +//	EFlagTransparencyAlphaChannel=0x08000000, // True if the window is transparent with an alpha channel (and no transparency mask)
   1.283 +	EFlagNotCantBeSeen=0x10000000,					// True if the last visibility event did not indicate that part of the window was not visible
   1.284 +//	EFlagTransparencyPolicyFreezeUnder=0x20000000,	// True if the transparent window enables freezing under policy
   1.285 +//	EFlagChildClippedRegionValid=0x40000000,  // True if the ChildClippedRegion is valid
   1.286 +	EFlagHasAlpha=            0x80000000,  // Equivalent to EFlagTransperencyAlphaChannel - new name to prevent confusion
   1.287 +	};
   1.288 +
   1.289 +//
   1.290 +// Sprites
   1.291 +//
   1.292 +
   1.293 +class TWsDeltaTimerEntry
   1.294 +	{
   1.295 +	friend class CWsDeltaTimer;
   1.296 +public:
   1.297 +	inline TWsDeltaTimerEntry(TCallBack& aCallback);
   1.298 +	inline TWsDeltaTimerEntry();
   1.299 +	inline void Set(TCallBack& aCallback);
   1.300 +	inline TBool IsPending();
   1.301 +private:
   1.302 +	TCallBack iCallBack; 
   1.303 +	TDeltaQueLink iLink;
   1.304 +	};
   1.305 +class CWsDeltaTimer : public CActive
   1.306 +	{
   1.307 +	enum {CWsDeltaTimerGranularity=100000};
   1.308 +public:
   1.309 +	static CWsDeltaTimer* NewL(TInt aPriority);
   1.310 +	void Queue(TTimeIntervalMicroSeconds32 aTimeInMicroSeconds,TWsDeltaTimerEntry& aHandle);
   1.311 +	void Remove(TWsDeltaTimerEntry& anEntry);
   1.312 +	void Activate();
   1.313 +	~CWsDeltaTimer();
   1.314 +private:
   1.315 +	CWsDeltaTimer(TInt aPriority);
   1.316 +	void DoCancel();
   1.317 +	void RunL();
   1.318 +protected:
   1.319 +	RTimer iTimer;
   1.320 +	TDeltaQue<TWsDeltaTimerEntry> iQueue;
   1.321 +	};
   1.322 +
   1.323 +//---------------------------
   1.324 +// Top level command class
   1.325 +//---------------------------
   1.326 +
   1.327 +/** The main server class.
   1.328 +
   1.329 +@internalComponent
   1.330 +@released
   1.331 +*/
   1.332 +class CWindowServer : public CBase, public MWsGraphicDrawerEnvironment, public MWsMemoryRelease
   1.333 +	{
   1.334 +public:
   1.335 +	static CWindowServer *NewL();
   1.336 +	~CWindowServer();
   1.337 +	void StartL();
   1.338 +	TInt SessionCount();
   1.339 +	MWsAnimationScheduler* AnimationScheduler();
   1.340 +	void PrepareShutdown();
   1.341 +	TBool ReleaseMemory();
   1.342 +	void DestroySessionsForShutdown();
   1.343 +	void SetPinClientDescriptors(TBool aPin);
   1.344 +public:	// from MWsGraphicDrawerEnvironment
   1.345 +	const CWsGraphicDrawer* ResolveGraphic(const TGraphicDrawerId& aId) const;
   1.346 +	void Invalidate(const TGraphicDrawerId& aId);
   1.347 +	TInt ScreenCount() const;
   1.348 +	MWsScreen* Screen(TInt aIndex);
   1.349 +	const MWsScreen* Screen(TInt aIndex) const;
   1.350 +	TBool SetCustomAnimationScheduler(MWsAnimationScheduler* aScheduler);
   1.351 +	TBool HasCustomAnimationScheduler() const;
   1.352 +	TBool ClearCustomAnimationScheduler(MWsAnimationScheduler* aCurrentScheduler);
   1.353 +	TInt RegisterEventHandler(CWsGraphicDrawer* aDrawer, MWsEventHandler* aHandler, TUint32 aEventMask);
   1.354 +	TInt UnregisterEventHandler(CWsGraphicDrawer* aDrawer);
   1.355 +	TInt RegisterWsEventHandler(MWsEventHandler* aHandler, TUint32 aEventMask);
   1.356 +	TInt UnregisterWsEventHandler(MWsEventHandler* aHandler);
   1.357 +	void Log(TInt aPriority,const TDesC &aFmt,TInt aParam=0);
   1.358 +	TInt RegisterMemoryRelease(MWsMemoryRelease * aMemoryRelease);
   1.359 +	void UnregisterMemoryRelease(MWsMemoryRelease * aMemoryRelease);
   1.360 +
   1.361 +public:
   1.362 +	// CWsGraphicDrawer master index
   1.363 +	TInt AddGraphicDrawer(CWsGraphicDrawer* aDrawer);
   1.364 +	TInt SwapGraphicDrawer(CWsGraphicDrawer* aDrawer);
   1.365 +	TInt RemoveGraphicDrawer(const TGraphicDrawerId& aId);
   1.366 +	TInt RemoveAllGraphicDrawers(const MWsClient& aOwner);
   1.367 +public: // from MWsMemoryRelease
   1.368 +	TBool ReleaseMemory(TMemoryReleaseLevel aLevel);
   1.369 +private:
   1.370 +	CWindowServer();
   1.371 +	void ConstructL();
   1.372 +	TAny* ResolveObjectInterface(TUint aTypeId);
   1.373 +private:
   1.374 +	class CServer;
   1.375 +	class CDefaultAnimationScheduler;
   1.376 +	CServer* iServer;
   1.377 +	CDefaultAnimationScheduler* iDefaultAnimationScheduler;
   1.378 +	MWsAnimationScheduler* iCustomAnimationScheduler;
   1.379 +	RPointerArray<MWsMemoryRelease> iMemoryReleases;
   1.380 +	/** An index to all the CWsGraphicDrawer objects.
   1.381 +	
   1.382 +	All the CWsGraphicDrawer objects are created and owned by the CWsClient objects but they are
   1.383 +	indexed centrally because some operations require access to the full list.
   1.384 +	*/
   1.385 +	CWsGraphicDrawerArray iDrawerMasterIndex;
   1.386 +	};
   1.387 +
   1.388 +//
   1.389 +inline CWsWindowGroup *CWsCaptureKey::WindowGroup()
   1.390 +	{return(iWindowGroup);}
   1.391 +inline const CWsWindowGroup *CWsCaptureKey::WindowGroup() const
   1.392 +	{return(iWindowGroup);}
   1.393 +//
   1.394 +inline CWsWindowGroup *CWsCaptureKeyUpsAndDowns::WindowGroup()
   1.395 +	{return(iWindowGroup);}
   1.396 +inline const CWsWindowGroup *CWsCaptureKeyUpsAndDowns::WindowGroup() const
   1.397 +	{return(iWindowGroup);}
   1.398 +//
   1.399 +inline CWsWindowGroup *CWsCaptureLongKey::WindowGroup()
   1.400 +	{return(iWindowGroup);}
   1.401 +inline const CWsWindowGroup *CWsCaptureLongKey::WindowGroup() const
   1.402 +	{return(iWindowGroup);}
   1.403 +//
   1.404 +inline CWsPointerCursor *CWsClient::DefaultSystemPointerCursor()
   1.405 +	{return(iDefaultSystemPointerCursor);}
   1.406 +//
   1.407 +inline TInt CWsHotKey::HotKeyType() const
   1.408 +	{return(iHotKeyType);}
   1.409 +inline TInt CWsHotKey::KeyHandle() const
   1.410 +	{return((TInt)iCaptureKey);}
   1.411 +inline TBool CWsHotKey::IsDefault() const
   1.412 +	{return(iIsDefault);}
   1.413 +inline void CWsHotKey::SetLink(CWsHotKey *aLink)
   1.414 +	{iNext=aLink;}
   1.415 +//
   1.416 +inline TWsDeltaTimerEntry::TWsDeltaTimerEntry(TCallBack& aCallback)
   1.417 +	{iCallBack=aCallback;}
   1.418 +inline TWsDeltaTimerEntry::TWsDeltaTimerEntry()
   1.419 +	{}
   1.420 +inline void TWsDeltaTimerEntry::Set(TCallBack& aCallback)
   1.421 +	{iCallBack=aCallback;}
   1.422 +inline TBool TWsDeltaTimerEntry::IsPending()
   1.423 +	{return(iLink.iNext!=NULL);}
   1.424 +//
   1.425 +inline TInt CWsGraphicDrawerObject::ClientHandle() const
   1.426 +	{return iClientHandle;}
   1.427 +
   1.428 +#endif