windowing/windowserver/nga/CLIENT/RWINDOW.CPP
branchRCL_3
changeset 20 25ffed67c7ef
parent 19 bbf46f59e123
equal deleted inserted replaced
19:bbf46f59e123 20:25ffed67c7ef
     1 // Copyright (c) 1994-2010 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 1994-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".
    18 #include <e32std.h>
    18 #include <e32std.h>
    19 #include "../SERVER/w32cmd.h"
    19 #include "../SERVER/w32cmd.h"
    20 #include "CLIENT.H"
    20 #include "CLIENT.H"
    21 #include "w32comm.h"
    21 #include "w32comm.h"
    22 #include <graphics/surface.h>
    22 #include <graphics/surface.h>
    23 #include "rtfxeffect.h"
       
    24 
    23 
    25 RWindowTreeNode::RWindowTreeNode()
    24 RWindowTreeNode::RWindowTreeNode()
    26 /** Protected default constructor.
    25 /** Protected default constructor.
    27 
    26 
    28 This creates a sessionless, uninitialised window tree node handle. This class 
    27 This creates a sessionless, uninitialised window tree node handle. This class 
   169 	    {
   168 	    {
   170 	    if (WindowSizeCacheEnabled())
   169 	    if (WindowSizeCacheEnabled())
   171 	         {
   170 	         {
   172 	         DestroyWindowSizeCacheEntry();
   171 	         DestroyWindowSizeCacheEntry();
   173 	         }
   172 	         }
       
   173 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
       
   174 	    if (WindowNativeSizeCacheEnabled())
       
   175 	         {
       
   176 	         DestroyWindowNativeSizeCacheEntry();
       
   177 	         }
       
   178 #endif // SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
   174         Write(EWsWinOpFree);
   179         Write(EWsWinOpFree);
   175 	    }
   180 	    }
   176 	iWsHandle=NULL;
   181 	iWsHandle=NULL;
   177 	}
   182 	}
   178 
   183 
   839             return size;
   844             return size;
   840             }
   845             }
   841         }
   846         }
   842 	}
   847 	}
   843 
   848 
       
   849 EXPORT_C TSize RWindowBase::SizeForEgl() const
       
   850 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
   844 /**
   851 /**
   845 @internalAll
   852 @internalAll
   846 Disclaimer - this API is internal and is subject to change
   853 Disclaimer - this API is internal and is subject to change
   847 @deprecated */
   854 @prototype */
   848 EXPORT_C TSize RWindowBase::SizeForEgl() const
   855 	{
       
   856 	TSize size;
       
   857 	if (WindowNativeSizeCacheEnabled() && WindowNativeSize(size) == KErrNone)
       
   858 		{
       
   859 		return size;
       
   860 		}
       
   861 	else
       
   862 		{
       
   863 		return Size();
       
   864 		}
       
   865 	}
       
   866 #else
   849     {
   867     {
   850     return Size();
   868     // API should not be used if macro undefined.
       
   869     ASSERT(0);
       
   870     return TSize();
   851     }
   871     }
   852     
   872 #endif // SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
       
   873 
   853 EXPORT_C void RWindowBase::SetPosition(const TPoint &aPos)
   874 EXPORT_C void RWindowBase::SetPosition(const TPoint &aPos)
   854 /** Sets the position of a window relative to its parent. 
   875 /** Sets the position of a window relative to its parent. 
   855 
   876 
   856 The co-ordinates given in aPos specify the position of the top left-hand 
   877 The co-ordinates given in aPos specify the position of the top left-hand 
   857 corner of the window, relative to the top left-hand corner of its parent. 
   878 corner of the window, relative to the top left-hand corner of its parent. 
  1361 (for example a touch screen that is able to determine coordinates of more than
  1382 (for example a touch screen that is able to determine coordinates of more than
  1362 one finger touching it at the same time), then this method will enable delivering
  1383 one finger touching it at the same time), then this method will enable delivering
  1363 events from all detected pointers to this window.
  1384 events from all detected pointers to this window.
  1364 
  1385 
  1365 This method must be called before the window is activated by calling RWindowBase::Activate().
  1386 This method must be called before the window is activated by calling RWindowBase::Activate().
  1366 Otherwise the client is panicked with the code EWservPanicUnableToEnableAdvPointer.
  1387 Otherwise this will be ignored (release build), or panic (debug build). 
  1367 
  1388 
  1368 If this method is not called for the window, it is assumed that the window is not
  1389 If this method is not called for the window, it is assumed that the window is not
  1369 able to receive events from multiple pointers, and thus only events from a single
  1390 able to receive events from multiple pointers, and thus only events from a single
  1370 emulated pointer are sent to it. Emulated pointer ensures that code written for a single 
  1391 emulated pointer are sent to it. Emulated pointer ensures that code written for a single 
  1371 pointer environment works properly in a multiple pointer environment: there is only 
  1392 pointer environment works properly in a multiple pointer environment: there is only 
  1388 	}
  1409 	}
  1389 
  1410 
  1390 /**
  1411 /**
  1391 @internalAll
  1412 @internalAll
  1392 Disclaimer - this API is internal and is subject to change
  1413 Disclaimer - this API is internal and is subject to change
  1393 @deprecated */
  1414 @prototype */
  1394 EXPORT_C TInt RWindowBase::FixNativeOrientation()
  1415 EXPORT_C TInt RWindowBase::FixNativeOrientation()
       
  1416 #if !defined(SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION) || defined (SYMBIAN_GRAPHICS_BUILD_OPENWF_WSERV) || defined (__WINS__) 
  1395     {
  1417     {
  1396     return KErrNotSupported;
  1418     return KErrNotSupported;
  1397     }
  1419     }
       
  1420 #else
       
  1421 	{
       
  1422     TInt err = KErrNone;
       
  1423 	if (!WindowNativeSizeCacheEnabled())
       
  1424 		{
       
  1425 		TRAP(err, EnableWindowNativeSizeCacheL());
       
  1426 		if (err != KErrNone)
       
  1427 		    {
       
  1428             return err;
       
  1429 		    }
       
  1430 		}
       
  1431 	
       
  1432 	const CFbsBitGc::TGraphicsOrientation orientation = static_cast<CFbsBitGc::TGraphicsOrientation>(WriteReply(EWsWinOpFixNativeOrientation));
       
  1433 	switch (orientation)
       
  1434 		{
       
  1435 	case CFbsBitGc::EGraphicsOrientationNormal:
       
  1436     case CFbsBitGc::EGraphicsOrientationRotated180:
       
  1437 		err = SetWindowNativeSize(Size());
       
  1438         break;
       
  1439 	case CFbsBitGc::EGraphicsOrientationRotated90 :
       
  1440     case CFbsBitGc::EGraphicsOrientationRotated270:
       
  1441         {
       
  1442 	    TSize size = Size();
       
  1443 	    err = SetWindowNativeSize(TSize(size.iHeight, size.iWidth));
       
  1444         }
       
  1445 		break;
       
  1446 	default:
       
  1447 	    Assert(EW32AssertInvalidOrientation);
       
  1448 		}
       
  1449 	return err;
       
  1450 	}
       
  1451 #endif // SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
  1398 
  1452 
  1399 EXPORT_C TInt RWindowBase::AllocPointerMoveBuffer(TInt aMaxNumPoints, TUint aFlags)
  1453 EXPORT_C TInt RWindowBase::AllocPointerMoveBuffer(TInt aMaxNumPoints, TUint aFlags)
  1400 /** Allocates a buffer for storing pointer movements. 
  1454 /** Allocates a buffer for storing pointer movements. 
  1401 
  1455 
  1402 The pointer move buffer is used by applications that need to process every 
  1456 The pointer move buffer is used by applications that need to process every 
  1876 	
  1930 	
  1877 	argb.SetInternal(WriteReply(EWsWinOpKeyColor));
  1931 	argb.SetInternal(WriteReply(EWsWinOpKeyColor));
  1878 	return argb;
  1932 	return argb;
  1879 	}
  1933 	}
  1880 
  1934 
  1881 EXPORT_C void RWindowBase::SetPurpose(TInt aPurpose)
  1935 // RDrawableWindow //
  1882 /** 
       
  1883 Sets specific window  purpose to the TFX layer. The purpose passed 
       
  1884 by the client API will be directed to MWsTfxLayer::SetPurpose. 
       
  1885 @param aPurpose The window purpose information. 
       
  1886 @see MWsTfxLayer
       
  1887 @publishedPartner
       
  1888 @prototype
       
  1889 */
       
  1890 	{
       
  1891 	WriteInt(aPurpose,EWsWinOpSetPurpose);
       
  1892 	}
       
  1893 
       
  1894 EXPORT_C void RWindowBase::SendEffectCommand(TInt aTfxCmd,const TDesC8& aTfxCmdData)
       
  1895 /** 
       
  1896 Sets specific effect data or execute commands to the TFX layer.
       
  1897 The data or command passed by the client API will be directed to MWsTfxLayer::SendEffectCommand.
       
  1898 MWsTfxLayer will accept only window specific commands and data.
       
  1899 @param aTfxCmd TFX layer command.
       
  1900 @param aTfxCmdData Data structure related to the specified value of aTfxCmd. The default value is KNullDesC8.
       
  1901 @publishedPartner
       
  1902 */
       
  1903     {
       
  1904     __ASSERT_ALWAYS(aTfxCmdData.Length()<=KMaxWservStringSize, Panic(EW32PanicStringTooLong));
       
  1905     TWsClCmdSendEffectCommand params(aTfxCmd,aTfxCmdData.Size(),this->iWsHandle);
       
  1906     Write(&params,sizeof(params),aTfxCmdData.Ptr(),aTfxCmdData.Size(),EWsWinOpSendEffectCommand);
       
  1907     }
       
  1908 
       
  1909 EXPORT_C void RWindowBase::OverrideEffects(TInt aAction, const TFileName& aResourceDir, const TFileName& aFilenameOutgoing, const TFileName& aFilenameIncoming, TBitFlags aFlags)
       
  1910 /**
       
  1911 Overides the default animation for current window's transition effect by sent animation description.
       
  1912 Please refer RWsSession::RegisterEffect() comments for more information on animation description.
       
  1913 
       
  1914 @param aAction The particular transition to set the animation for.
       
  1915 @param aResourceDir The name of the directory that contains the animation description files.
       
  1916 @param aFilenameOutgoing The file containing the description of the animation for the outgoing phase of the transition. 
       
  1917 						 Specify KNullDesC for no outgoing phase effect.
       
  1918 @param aFilenameIncoming The file containing the description of the animation for the incoming phase of the transition. 
       
  1919 						 Specify KNullDesC for no incoming phase effect.
       
  1920 @param aFlags Flag for the effect. Please see TTfxFlags for values this flag parameter can use.
       
  1921 
       
  1922 @publishedPartner
       
  1923 */
       
  1924 	{
       
  1925 	RTFXEffect tfxEffect(iWsHandle, iBuffer);
       
  1926 	tfxEffect.OverrideTFXEffect(RTFXEffect::ETFXWindow, aAction, 0, aResourceDir, aFilenameOutgoing, aFilenameIncoming, aFlags);
       
  1927 	}
       
  1928 //////////////////////////// RDrawableWindow ////////////////////////////////
       
  1929 
  1936 
  1930 void RDrawableWindow::doScroll(const TRect &aClipRect, const TPoint &aOffset, const TRect &aRect, TInt aOpcode)
  1937 void RDrawableWindow::doScroll(const TRect &aClipRect, const TPoint &aOffset, const TRect &aRect, TInt aOpcode)
  1931 	{
  1938 	{
  1932 	TWsWinCmdScroll scroll(aClipRect,aOffset,aRect);
  1939 	TWsWinCmdScroll scroll(aClipRect,aOffset,aRect);
  1933 	Write(&scroll,sizeof(scroll),aOpcode);
  1940 	Write(&scroll,sizeof(scroll),aOpcode);
  2796 @param aModifiers Bitmask that identifies which of the modifier keys in 
  2803 @param aModifiers Bitmask that identifies which of the modifier keys in 
  2797 aModifierMask need to be set and which need to be unset. For example, see the 
  2804 aModifierMask need to be set and which need to be unset. For example, see the 
  2798 description above. 
  2805 description above. 
  2799 @param aPriority A priority value - if more than one window group has requested 
  2806 @param aPriority A priority value - if more than one window group has requested 
  2800 capture for the same key event, the one with the highest priority will capture it.
  2807 capture for the same key event, the one with the highest priority will capture it.
  2801 The value must be greater than KMinTInt.
       
  2802 @return A handle identifying the capture key, or one of the system-wide error 
  2808 @return A handle identifying the capture key, or one of the system-wide error 
  2803 codes (if <0). KErrPermissionDenied indicates that the requested key cannot be 
  2809 codes (if <0). KErrPermissionDenied indicates that the requested key cannot be 
  2804 captured by this window group, because it has been protected by another window group. 
  2810 captured by this window group, because it has been protected by another window group. 
  2805 For more information, see the PROTECTEDKEY parameter in wsini.ini. Handles should be 
  2811 For more information, see the PROTECTEDKEY parameter in wsini.ini. Handles should be 
  2806 kept in order to be passed to CancelCaptureKey() later. 
  2812 kept in order to be passed to CancelCaptureKey() later. 
  2865 Possible values are defined in TEventModifier. 
  2871 Possible values are defined in TEventModifier. 
  2866 @param aModifiers Bitmask that identifies which of the modifier keys in 
  2872 @param aModifiers Bitmask that identifies which of the modifier keys in 
  2867 aModifierMask need to be set and which need to be unset. 
  2873 aModifierMask need to be set and which need to be unset. 
  2868 @param aPriority A priority value - if more than one window group has requested 
  2874 @param aPriority A priority value - if more than one window group has requested 
  2869 capture for the same key event, the one with the highest priority will capture it.
  2875 capture for the same key event, the one with the highest priority will capture it.
  2870 The value must be greater than KMinTInt.
       
  2871 @return A handle identifying the capture key, or one of the system-wide error 
  2876 @return A handle identifying the capture key, or one of the system-wide error 
  2872 codes (if < 0). KErrPermissionDenied indicates that the requested key cannot be captured by this 
  2877 codes (if < 0). KErrPermissionDenied indicates that the requested key cannot be captured by this 
  2873 window group, because it has been protected by another window group. For more information, see 
  2878 window group, because it has been protected by another window group. For more information, see 
  2874 the PROTECTEDKEY parameter in wsini.ini. Handles should be kept in order to be passed to 
  2879 the PROTECTEDKEY parameter in wsini.ini. Handles should be kept in order to be passed to 
  2875 CancelCaptureKeyUpAndDowns() later.
  2880 CancelCaptureKeyUpAndDowns() later.
  2937 @param aModifiers The key is captured only when the modifier keys specified 
  2942 @param aModifiers The key is captured only when the modifier keys specified 
  2938 in aModifierMask match these states, where 1 = modifier set, and 0 = modifier 
  2943 in aModifierMask match these states, where 1 = modifier set, and 0 = modifier 
  2939 not set. Modifier key states are defined in TEventModifier. 
  2944 not set. Modifier key states are defined in TEventModifier. 
  2940 @param aPriority If more than one window group has requested capture for the 
  2945 @param aPriority If more than one window group has requested capture for the 
  2941 same long key event, the one with the highest priority will capture the event.
  2946 same long key event, the one with the highest priority will capture the event.
  2942 The value must be greater than KMinTInt.
       
  2943 @param aFlags Configures the long key capture behaviour. See the TLongCaptureFlags 
  2947 @param aFlags Configures the long key capture behaviour. See the TLongCaptureFlags 
  2944 enum.
  2948 enum.
  2945 @return Identifying value for the long key capture. For use with the CancelCaptureLongKey() 
  2949 @return Identifying value for the long key capture. For use with the CancelCaptureLongKey() 
  2946 function.
  2950 function.
  2947 @see TLongCaptureFlags 
  2951 @see TLongCaptureFlags 
  2973 @param aModifiers The key is captured only when the modifier keys specified 
  2977 @param aModifiers The key is captured only when the modifier keys specified 
  2974 in aModifierMask match these states, where 1 = modifier set, and 0 = modifier 
  2978 in aModifierMask match these states, where 1 = modifier set, and 0 = modifier 
  2975 not set. Modifier key states are defined in TEventModifier. 
  2979 not set. Modifier key states are defined in TEventModifier. 
  2976 @param aPriority If more than one window group has requested capture for the 
  2980 @param aPriority If more than one window group has requested capture for the 
  2977 same long key event, the one with the highest priority will capture the event.
  2981 same long key event, the one with the highest priority will capture the event.
  2978 The value must be greater than KMinTInt.
       
  2979 @param aFlags Configures the long key capture behaviour. See the TLongCaptureFlags 
  2982 @param aFlags Configures the long key capture behaviour. See the TLongCaptureFlags 
  2980 enum.
  2983 enum.
  2981 @return Identifying value for the long key capture. For use with the CancelCaptureLongKey() 
  2984 @return Identifying value for the long key capture. For use with the CancelCaptureLongKey() 
  2982 function.
  2985 function.
  2983 @see TLongCaptureFlags
  2986 @see TLongCaptureFlags