1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/windowing/windowserver/nonnga/SERVER/scrdev.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,517 @@
1.4 +// Copyright (c) 1995-2009 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 +// Screen device
1.18 +//
1.19 +//
1.20 +
1.21 +#include "ScrDev.H"
1.22 +#include "Direct.H"
1.23 +
1.24 +#include <e32hal.h>
1.25 +#include <hal.h>
1.26 +#include "server.h"
1.27 +#include "gc.h"
1.28 +#include "rootwin.h"
1.29 +#include "windowgroup.h"
1.30 +#include "wstop.h"
1.31 +#include "EVENT.H"
1.32 +#include "panics.h"
1.33 +#include "../CLIENT/w32comm.h"
1.34 +#include <w32std.h>
1.35 +
1.36 +const TInt KEikSrvsSid=0x10003a4a;
1.37 +
1.38 +static _LIT_SECURITY_POLICY_C1(KSecurityPolicy_WriteDeviceData,ECapabilityWriteDeviceData);
1.39 +
1.40 +/*DWsScreenDevice*/
1.41 +
1.42 +DWsScreenDevice::DWsScreenDevice(CWsClient* aOwner, TInt aDefaultScreenNumber, TUint aClientScreenDevicePointer)
1.43 + : CWsScreenObject(aOwner, WS_HANDLE_SCREEN_DEVICE, CWsTop::Screen( aDefaultScreenNumber )),
1.44 + iClientScreenDevicePointer(aClientScreenDevicePointer)
1.45 + {}
1.46 +
1.47 +DWsScreenDevice::~DWsScreenDevice()
1.48 + {}
1.49 +
1.50 +void DWsScreenDevice::CopyScreenToBitmapL(const TRect &aRect, TInt aHandle)
1.51 + {
1.52 + CFbsBitmap *bitmap=new(ELeave) CFbsBitmap();
1.53 + CleanupStack::PushL(bitmap);
1.54 + TInt ret = bitmap->Duplicate(aHandle);
1.55 + if (ret == KErrNoMemory)
1.56 + {
1.57 + User::Leave(ret);
1.58 + }
1.59 + if (ret != KErrNone)
1.60 + OwnerPanic(EWservPanicBitmap);
1.61 +
1.62 + CFbsBitmapDevice *device=CFbsBitmapDevice::NewL(bitmap);
1.63 + CleanupStack::PushL(device);
1.64 + CFbsBitGc *gc;
1.65 + User::LeaveIfError(device->CreateContext(gc));
1.66 + CleanupStack::PushL(gc); //Don't need to push this, but this is probably the eaiest way to delete it
1.67 + gc->SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha );
1.68 + gc->BitBlt(TPoint(), *iScreen->ScreenGdi(), aRect);
1.69 + CleanupStack::PopAndDestroy(3);
1.70 + }
1.71 +
1.72 +void DWsScreenDevice::CommandL(TInt aOpcode, const TAny *aCmdData)
1.73 + {
1.74 + TWsSdCmdUnion pData;
1.75 + pData.any=aCmdData;
1.76 + switch(aOpcode)
1.77 + {
1.78 + case EWsSdOpGetNumScreenModes:
1.79 + SetReply(iScreen->NumScreenSizeModes());
1.80 + break;
1.81 + case EWsSdOpGetScreenMode:
1.82 + SetReply(iScreen->ScreenSizeMode());
1.83 + break;
1.84 + case EWsSdOpSetScreenMode:
1.85 + {
1.86 + if(!KSecurityPolicy_WriteDeviceData().CheckPolicy(iWsOwner->ClientMessage(),__PLATSEC_DIAGNOSTIC_STRING("Capability check failed for CWsScreenDevice::SetScreenMode API")))
1.87 + {
1.88 + iWsOwner->PPanic(EWservPanicPermissionDenied);
1.89 + }
1.90 + SetScreenMode(*pData.Int);
1.91 + }
1.92 + break;
1.93 + case EWsSdOpSetModeRotation:
1.94 + {
1.95 + if(KSecurityPolicy_WriteDeviceData().CheckPolicy(iWsOwner->ClientMessage(),__PLATSEC_DIAGNOSTIC_STRING("Capability check failed for CWsScreenDevice::SetModeRotation API")))
1.96 + {
1.97 + TClientPanic panic=iScreen->SetModeRotation(pData.SetScreenRotation->mode,pData.SetScreenRotation->rotation);
1.98 + if (panic)
1.99 + OwnerPanic(panic);
1.100 + }
1.101 + }
1.102 + break;
1.103 + case EWsSdOpGetRotationList:
1.104 + if (!iScreen->IsValidScreenSizeMode(*pData.Int))
1.105 + OwnerPanic(EWservPanicScreenModeNumber);
1.106 + SetReply(iScreen->ScreenSizeModeData(*pData.Int).iAlternativeRotations);
1.107 + break;
1.108 + case EWsSdOpGetScreenModeSizeAndRotation:
1.109 + GetScreenSizeAndRotationCmd(*pData.Int);
1.110 + break;
1.111 + case EWsSdOpGetScreenModeSizeAndRotation2:
1.112 + GetScreenSizeAndRotationCmd2(*pData.Int);
1.113 + break;
1.114 + case EWsSdOpSetScreenSizeAndRotation:
1.115 + SetScreenSizeAndRotation(*pData.PixelsTwipsAndRotation);
1.116 + break;
1.117 + case EWsSdOpSetScreenSizeAndRotation2:
1.118 + SetScreenSizeAndRotation(*pData.PixelsAndRotation);
1.119 + break;
1.120 + case EWsSdOpGetDefaultScreenSizeAndRotation:
1.121 + GetScreenSizeAndRotationCmd(iScreen->ScreenSizeMode());
1.122 + break;
1.123 + case EWsSdOpGetDefaultScreenSizeAndRotation2:
1.124 + GetScreenSizeAndRotationCmd2(iScreen->ScreenSizeMode());
1.125 + break;
1.126 + case EWsSdOpGetScreenModeDisplayMode:
1.127 + GetScreenModeDisplayMode(*pData.Int);
1.128 + break;
1.129 + case EWsSdOpGetScreenModeScale:
1.130 + GetScreenScale(*pData.Int);
1.131 + break;
1.132 + case EWsSdOpGetCurrentScreenModeScale:
1.133 + GetScreenScale(iScreen->ScreenSizeMode());
1.134 + break;
1.135 + case EWsSdOpSetAppScreenMode:
1.136 + SetAppScreenMode(*pData.Int);
1.137 + break;
1.138 + case EWsSdOpGetCurrentScreenModeScaledOrigin:
1.139 + CWsClient::ReplyPoint(iScreen->CurrentScreenModeScaledOrigin());
1.140 + break;
1.141 + case EWsSdOpGetScreenModeScaledOrigin:
1.142 + if (!iScreen->IsValidScreenSizeMode(*pData.Int))
1.143 + OwnerPanic(EWservPanicScreenModeNumber);
1.144 + CWsClient::ReplyPoint(iScreen->ScreenModeScaledOrigin(*pData.Int));
1.145 + break;
1.146 + case EWsSdOpGetCurrentScreenModeAttributes:
1.147 + GetCurrentScreenModeAttributes();
1.148 + break;
1.149 + case EWsSdOpSetCurrentScreenModeAttributes:
1.150 + if(!KSecurityPolicy_WriteDeviceData().CheckPolicy(iWsOwner->ClientMessage(),__PLATSEC_DIAGNOSTIC_STRING("Capability check failed for CWsScreenDevice::SetCurrentScreenModeAttributes API, API should be used for test purposes only")))
1.151 + {
1.152 + iWsOwner->PPanic(EWservPanicPermissionDenied);
1.153 + }
1.154 + SetCurrentScreenModeAttributes(*pData.ScreenSizeMode);
1.155 + break;
1.156 + case EWsSdOpSetScreenModeEnforcement:
1.157 + {
1.158 + if(!KSecurityPolicy_WriteDeviceData().CheckPolicy(iWsOwner->ClientMessage(),__PLATSEC_DIAGNOSTIC_STRING("Capability check failed for CWsScreenDevice::SetScreenModeEnforcement API")))
1.159 + {
1.160 + iWsOwner->PPanic(EWservPanicPermissionDenied);
1.161 + }
1.162 + if (!iScreen->SetScreenModeEnforcement(*pData.Int))
1.163 + OwnerPanic(EWservPanicScreenEnforcementMode);
1.164 + }
1.165 + break;
1.166 + case EWsSdOpScreenModeEnforcement:
1.167 + SetReply(iScreen->SizeEnforcementMode());
1.168 + break;
1.169 + case EWsSdOpGetDefaultScreenModeOrigin:
1.170 + GetScreenModeOriginCmd(iScreen->ScreenSizeMode());
1.171 + break;
1.172 + case EWsSdOpGetScreenModeOrigin:
1.173 + GetScreenModeOriginCmd(*pData.Int);
1.174 + break;
1.175 + case EWsSdOpPixel:
1.176 + {
1.177 + TRgb rgb;
1.178 + iScreen->ScreenDevice()->GetPixel(rgb,*pData.Point);
1.179 + SetReply(rgb.Internal());
1.180 + }
1.181 + break;
1.182 + case EWsSdOpGetScanLine:
1.183 + iScreen->GetScanLine(pData.GetScanLine);
1.184 + break;
1.185 + case EWsSdOpTwipsSize:
1.186 + CWsClient::ReplySize(iAppScreenSizeInTwips);
1.187 + break;
1.188 + case EWsSdOpPixelSize:
1.189 + CWsClient::ReplySize(iAppScreenSizeInPixels);
1.190 + break;
1.191 + case EWsSdOpHorizontalTwipsToPixels:
1.192 + SetReply(iScreen->ScreenDevice()->HorizontalTwipsToPixels(*pData.UInt));
1.193 + break;
1.194 + case EWsSdOpVerticalTwipsToPixels:
1.195 + SetReply(iScreen->ScreenDevice()->VerticalTwipsToPixels(*pData.UInt));
1.196 + break;
1.197 + case EWsSdOpHorizontalPixelsToTwips:
1.198 + SetReply(iScreen->ScreenDevice()->HorizontalPixelsToTwips(*pData.UInt));
1.199 + break;
1.200 + case EWsSdOpVerticalPixelsToTwips:
1.201 + SetReply(iScreen->ScreenDevice()->VerticalPixelsToTwips(*pData.UInt));
1.202 + break;
1.203 + case EWsSdOpPointerRect:
1.204 + {
1.205 + TMachineInfoV1Buf macInfo;
1.206 + UserHal::MachineInfo(macInfo);
1.207 + TRect rect(-macInfo().iOffsetToDisplayInPixels,macInfo().iXYInputSizeInPixels);
1.208 + CWsClient::ReplyRect(rect);
1.209 + }
1.210 + break;
1.211 + case EWsSdOpFree:
1.212 + {
1.213 + // Mark any group windows associated with the screen device being deleted
1.214 + CWsRootWindow* root=iScreen->RootWindow();
1.215 + for (CWsWindowGroup* grp = root->Child(); grp; grp = grp->NextSibling())
1.216 + {
1.217 + if (grp->Device() == this)
1.218 + {
1.219 +#if defined(_DEBUG)
1.220 + grp->SetScreenDeviceDeleted();
1.221 +#endif
1.222 + grp->SetScreenDevice(NULL);
1.223 + }
1.224 + }
1.225 + }
1.226 + // Let our owner (CWsClient) know that a screen device is being deleted so it
1.227 + // can check whether to reset its iPrimaryScreenDevice member or not
1.228 + if (WsOwner())
1.229 + WsOwner()->NotifyScreenDeviceDeleted(this);
1.230 + delete this;
1.231 + break;
1.232 + case EWsSdOpDisplayMode:
1.233 + iScreen->ScreenGdi(); // To force display mode update if required
1.234 + SetReply(iScreen->CurrentDisplayMode());
1.235 + break;
1.236 + case EWsSdOpRectCompare:
1.237 + {
1.238 +// if (pData.RectCompare->flags&CWsScreenDevice::EIncludeSprite)
1.239 +// {
1.240 +// SpriteManager()->IncrementProcessingSprites();
1.241 +// }
1.242 +
1.243 + RWsTextCursor * cursor = 0;
1.244 + if (!pData.RectCompare->flags&CWsScreenDevice::EIncludeTextCursor)
1.245 + cursor = CWsTop::CurrentTextCursor();
1.246 + if (cursor)
1.247 + cursor->Disable();
1.248 +
1.249 + SetReply(iScreen->ScreenDevice()->RectCompare(pData.RectCompare->rect1,*iScreen->ScreenDevice(),pData.RectCompare->rect2));
1.250 +
1.251 + if (cursor)
1.252 + cursor->Enable();
1.253 +
1.254 +// if (pData.RectCompare->flags&CWsScreenDevice::EIncludeSprite)
1.255 +// {
1.256 +// SpriteManager()->DecrementProcessingSprites();
1.257 +// }
1.258 + }
1.259 + break;
1.260 + case EWsSdOpCopyScreenToBitmap:
1.261 + CopyScreenToBitmapL(TRect(iScreen->ScreenDevice()->SizeInPixels()),pData.CopyScreenToBitmap->handle);
1.262 + break;
1.263 + case EWsSdOpCopyScreenToBitmap2:
1.264 + CopyScreenToBitmapL(pData.CopyScreenToBitmap2->rect,pData.CopyScreenToBitmap2->handle);
1.265 + break;
1.266 + case EWsSdOpPaletteAttributes:
1.267 + {
1.268 + TBool modifiable;
1.269 + TInt numEntries;
1.270 + iScreen->ScreenDevice()->PaletteAttributes(modifiable,numEntries);
1.271 + if (modifiable)
1.272 + numEntries|=EWsSdSetableBitFlag;
1.273 + SetReply(numEntries);
1.274 + }
1.275 + break;
1.276 + case EWsSdOpSetPalette:
1.277 + {
1.278 + if(!KSecurityPolicy_WriteDeviceData().CheckPolicy(iWsOwner->ClientMessage(),__PLATSEC_DIAGNOSTIC_STRING("Capability check failed for CWsScreenDevice::SetPalette API")))
1.279 + {
1.280 + User::Leave(KErrPermissionDenied);
1.281 + }
1.282 + SetPaletteL();
1.283 + }
1.284 + break;
1.285 + case EWsSdOpGetPalette:
1.286 + GetPalette(*pData.Int);
1.287 + break;
1.288 +
1.289 + case EWsSdOpGetScreenNumber:
1.290 + SetReply(iScreen->ScreenNumber());
1.291 + break;
1.292 + case EWsSdOpGetScreenSizeModeList:
1.293 + SetReply(iScreen->GetScreenSizeModeListL());
1.294 + break;
1.295 + case EWsClOpSetBackLight:
1.296 + {
1.297 + TInt err=KErrNone;
1.298 + if(Screen()->BackLightFlag() && iWsOwner->ClientMessage().SecureId()==KEikSrvsSid)
1.299 + {
1.300 + TWindowServerEvent::ProcessErrorMessages(TWsErrorMessage::EBackLight, err=HAL::Set(iScreen->ScreenNumber(),HALData::EBacklightState,*pData.Int));
1.301 + SetReply(err);
1.302 + }
1.303 + else
1.304 + {
1.305 + User::Leave(KErrPermissionDenied);
1.306 + }
1.307 + }
1.308 + break;
1.309 + default:
1.310 + OwnerPanic(EWservPanicOpcode);
1.311 + break;
1.312 + }
1.313 + }
1.314 +
1.315 +
1.316 +void DWsScreenDevice::SetScreenMode(TInt aMode)
1.317 + {
1.318 + if (!iScreen->IsValidScreenSizeMode(aMode))
1.319 + OwnerPanic(EWservPanicScreenModeNumber);
1.320 + iScreen->doSetScreenMode(aMode);
1.321 + }
1.322 +
1.323 +TBool DWsScreenDevice::ScreenDeviceValidState() const
1.324 + {
1.325 + WS_ASSERT_DEBUG(iScreen->IsValidScreenSizeMode(iScreen->ScreenSizeMode()), EWsPanicInvalidScreenSizeMode);
1.326 + const TSizeMode& currentMode=iScreen->ScreenSizeModeData();
1.327 + TBool state=ETrue;
1.328 + // In all enforcement modes scale should match, so check scale first
1.329 + if (currentMode.iScreenScale!=iAppScale)
1.330 + {
1.331 + state=EFalse;
1.332 + }
1.333 + else
1.334 + {
1.335 + if (iScreen->SizeEnforcementMode()!=ESizeEnforcementNone)
1.336 + {
1.337 + if (currentMode.iRotation!=iAppRotation)
1.338 + state=EFalse;
1.339 + else if (currentMode.iScreenSize!=iAppScreenSizeInPixels)
1.340 + state=EFalse;
1.341 + }
1.342 + if (iScreen->SizeEnforcementMode()==ESizeEnforcementPixelsTwipsAndRotation)
1.343 + {
1.344 + if (currentMode.iScreenTwipsSize!=iAppScreenSizeInTwips)
1.345 + state=EFalse;
1.346 + }
1.347 + }
1.348 + return(state);
1.349 + }
1.350 +
1.351 +void DWsScreenDevice::ConstructL()
1.352 +//
1.353 +// App specific construct
1.354 +//
1.355 + {
1.356 + NewObjL();
1.357 + const TSizeMode& mode=iScreen->ScreenSizeModeData(iScreen->ScreenSizeMode());
1.358 + iAppScreenSizeInPixels=mode.iScreenSize;
1.359 + iAppScreenSizeInTwips=mode.iScreenTwipsSize;
1.360 + iAppRotation=mode.iRotation;
1.361 + iAppMode=iScreen->ScreenSizeMode();
1.362 + iAppScale=mode.iScreenScale;
1.363 + }
1.364 +
1.365 +void DWsScreenDevice::SetScreenSizeAndRotation(const TPixelsTwipsAndRotation &aSar)
1.366 + {
1.367 + iAppScreenSizeInPixels=aSar.iPixelSize;
1.368 + iAppScreenSizeInTwips=aSar.iTwipsSize;
1.369 + iAppRotation=aSar.iRotation;
1.370 + SetScreenDeviceValidStates(this);
1.371 + }
1.372 +
1.373 +void DWsScreenDevice::SetScreenSizeAndRotation(const TPixelsAndRotation &aSar)
1.374 + {
1.375 + iAppScreenSizeInPixels=aSar.iPixelSize;
1.376 + iAppScreenSizeInTwips.iWidth=iScreen->ScreenDevice()->HorizontalPixelsToTwips(iAppScreenSizeInPixels.iWidth);
1.377 + iAppScreenSizeInTwips.iHeight=iScreen->ScreenDevice()->VerticalPixelsToTwips(iAppScreenSizeInPixels.iHeight);
1.378 + iAppRotation=aSar.iRotation;
1.379 + SetScreenDeviceValidStates(this);
1.380 + }
1.381 +
1.382 +void DWsScreenDevice::GetScreenModeOriginCmd(TInt aMode)
1.383 + {
1.384 + if (!iScreen->IsValidScreenSizeMode(aMode))
1.385 + OwnerPanic(EWservPanicScreenModeNumber);
1.386 + CWsClient::ReplyPoint(iScreen->ScreenModeOrigin(aMode));
1.387 + }
1.388 +
1.389 +void DWsScreenDevice::GetCurrentScreenModeAttributes()
1.390 + {
1.391 + TSizeMode aModeData=iScreen->ScreenSizeModeData();
1.392 + CWsClient::ReplyBuf(&aModeData,sizeof(aModeData));
1.393 + }
1.394 +
1.395 +void DWsScreenDevice::SetCurrentScreenModeAttributes(const TSizeMode &aModeData)
1.396 + {
1.397 +#if defined(_DEBUG)
1.398 + if (aModeData.iScreenScale.iWidth==0 || aModeData.iScreenScale.iHeight==0)
1.399 + OwnerPanic(EWservPanicScreenModeNumber);
1.400 +#endif
1.401 + iScreen->SetCurrentScreenModeAttributes(aModeData);
1.402 + }
1.403 +
1.404 +void DWsScreenDevice::GetScreenSizeAndRotationCmd(TInt aMode)
1.405 + {
1.406 + if (!iScreen->IsValidScreenSizeMode(aMode))
1.407 + OwnerPanic(EWservPanicScreenModeNumber);
1.408 + TPixelsTwipsAndRotation sar;
1.409 + iScreen->GetScreenSizeAndRotation(sar,aMode);
1.410 + CWsClient::ReplyBuf(&sar, sizeof(sar));
1.411 + }
1.412 +
1.413 +void DWsScreenDevice::GetScreenSizeAndRotationCmd2(TInt aMode)
1.414 + {
1.415 + if (!iScreen->IsValidScreenSizeMode(aMode))
1.416 + OwnerPanic(EWservPanicScreenModeNumber);
1.417 + TPixelsAndRotation sar;
1.418 + iScreen->GetScreenSizeAndRotation(sar,aMode);
1.419 + CWsClient::ReplyBuf(&sar, sizeof(sar));
1.420 + }
1.421 +
1.422 +void DWsScreenDevice::GetScreenModeDisplayMode(const TInt aMode)
1.423 + {
1.424 + if (!iScreen->IsValidScreenSizeMode(aMode))
1.425 + {
1.426 + OwnerPanic(EWservPanicScreenModeNumber);
1.427 + }
1.428 + SetReply(STATIC_CAST(TInt,iScreen->DefaultDisplayMode(aMode)));
1.429 + }
1.430 +
1.431 +void DWsScreenDevice::GetScreenScale(TInt aMode)
1.432 + {
1.433 + if (!iScreen->IsValidScreenSizeMode(aMode))
1.434 + {
1.435 + OwnerPanic(EWservPanicScreenModeNumber);
1.436 + }
1.437 + CWsClient::ReplySize(iScreen->GetScreenScale(aMode));
1.438 + }
1.439 +
1.440 +void DWsScreenDevice::SetAppScreenMode(TInt aMode)
1.441 + {
1.442 + if (!iScreen->IsValidScreenSizeMode(aMode))
1.443 + {
1.444 + OwnerPanic(EWservPanicScreenModeNumber);
1.445 + }
1.446 + const TSizeMode& sizeMode=iScreen->ScreenSizeModeData(aMode);
1.447 + iAppScreenSizeInPixels=sizeMode.iScreenSize;
1.448 + iAppScreenSizeInTwips=sizeMode.iScreenTwipsSize;
1.449 + iAppMode=aMode;
1.450 + iAppScale=sizeMode.iScreenScale;
1.451 + iAppRotation=sizeMode.iRotation;
1.452 + CWsWindowGroup::SetScreenDeviceValidStates(this);
1.453 + }
1.454 +
1.455 +#define ROTATION_TO_FLAG(x) 1<<x
1.456 +
1.457 +void DWsScreenDevice::SetScreenDeviceValidStates(const DWsScreenDevice *aDevice)
1.458 + {
1.459 + TInt modes=iScreen->NumScreenSizeModes();
1.460 + TInt mode;
1.461 + for (mode=0;mode<modes;++mode)
1.462 + {
1.463 + if (!iScreen->IsValidScreenSizeMode(mode))
1.464 + continue;
1.465 + const TSizeMode& sizeMode=iScreen->ScreenSizeModeData(mode);
1.466 + if (iAppScreenSizeInPixels==sizeMode.iScreenSize && ROTATION_TO_FLAG(iAppRotation)&sizeMode.iAlternativeRotations)
1.467 + {
1.468 + iAppMode=mode;
1.469 + iAppScale=sizeMode.iScreenScale;
1.470 + break;
1.471 + }
1.472 + }
1.473 + CWsWindowGroup::SetScreenDeviceValidStates(aDevice);
1.474 + }
1.475 +
1.476 +void DWsScreenDevice::NewOrientation(TInt aMode,CFbsBitGc::TGraphicsOrientation aRotation)
1.477 + {
1.478 + if (iAppMode==aMode)
1.479 + iAppRotation=aRotation;
1.480 + }
1.481 +
1.482 +void DWsScreenDevice::SetPaletteL()
1.483 + {
1.484 + const TInt size=iWsOwner->ClientMessage().GetDesLength(KRemoteBufferMessageSlot);
1.485 + TInt numEntries=size/sizeof(TRgb);
1.486 + CPalette* palette=CPalette::NewL(numEntries);
1.487 + CleanupStack::PushL(palette);
1.488 + TPtr8 paletteData(NULL,0);
1.489 + palette->GetDataPtr(0,numEntries,paletteData);
1.490 + iWsOwner->RemoteReadL(paletteData,0);
1.491 + SetReply(iScreen->ScreenDevice()->SetCustomPalette(palette));
1.492 + iScreen->Update((RWsRegion&)RootWindow()->WindowArea());
1.493 + CleanupStack::PopAndDestroy(palette);
1.494 + }
1.495 +
1.496 +void DWsScreenDevice::GetPalette(TInt aNumColors)
1.497 + {
1.498 + CPalette* palette;
1.499 + TInt ret=iScreen->ScreenDevice()->GetPalette(palette);
1.500 + if (ret<KErrNone)
1.501 + goto Reply;
1.502 + ret=palette->Entries();
1.503 + if (ret!=aNumColors)
1.504 + {
1.505 + delete palette;
1.506 +Reply:
1.507 + SetReply(ret);
1.508 + return;
1.509 + }
1.510 + TPtr8 paletteData(NULL,0);
1.511 + palette->GetDataPtr(0,ret,paletteData);
1.512 + CWsClient::ReplyBuf(paletteData);
1.513 + SetReply(KErrNone);
1.514 + delete palette;
1.515 + }
1.516 +
1.517 +TUint DWsScreenDevice::ClientDevicePointer()
1.518 + {
1.519 + return iClientScreenDevicePointer;
1.520 + }