|
1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Screen device |
|
15 // |
|
16 // |
|
17 |
|
18 #include "ScrDev.H" |
|
19 #include "Direct.H" |
|
20 |
|
21 #include <e32hal.h> |
|
22 #include <hal.h> |
|
23 #include "server.h" |
|
24 #include "gc.h" |
|
25 #include "rootwin.h" |
|
26 #include "windowgroup.h" |
|
27 #include "wstop.h" |
|
28 #include "EVENT.H" |
|
29 #include "panics.h" |
|
30 #include "../CLIENT/w32comm.h" |
|
31 #include <w32std.h> |
|
32 |
|
33 const TInt KEikSrvsSid=0x10003a4a; |
|
34 |
|
35 static _LIT_SECURITY_POLICY_C1(KSecurityPolicy_WriteDeviceData,ECapabilityWriteDeviceData); |
|
36 |
|
37 /*DWsScreenDevice*/ |
|
38 |
|
39 DWsScreenDevice::DWsScreenDevice(CWsClient* aOwner, TInt aDefaultScreenNumber, TUint aClientScreenDevicePointer) |
|
40 : CWsScreenObject(aOwner, WS_HANDLE_SCREEN_DEVICE, CWsTop::Screen( aDefaultScreenNumber )), |
|
41 iClientScreenDevicePointer(aClientScreenDevicePointer) |
|
42 {} |
|
43 |
|
44 DWsScreenDevice::~DWsScreenDevice() |
|
45 {} |
|
46 |
|
47 void DWsScreenDevice::CopyScreenToBitmapL(const TRect &aRect, TInt aHandle) |
|
48 { |
|
49 CFbsBitmap *bitmap=new(ELeave) CFbsBitmap(); |
|
50 CleanupStack::PushL(bitmap); |
|
51 TInt ret = bitmap->Duplicate(aHandle); |
|
52 if (ret == KErrNoMemory) |
|
53 { |
|
54 User::Leave(ret); |
|
55 } |
|
56 if (ret != KErrNone) |
|
57 OwnerPanic(EWservPanicBitmap); |
|
58 |
|
59 CFbsBitmapDevice *device=CFbsBitmapDevice::NewL(bitmap); |
|
60 CleanupStack::PushL(device); |
|
61 CFbsBitGc *gc; |
|
62 User::LeaveIfError(device->CreateContext(gc)); |
|
63 CleanupStack::PushL(gc); //Don't need to push this, but this is probably the eaiest way to delete it |
|
64 gc->SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha ); |
|
65 gc->BitBlt(TPoint(), *iScreen->ScreenGdi(), aRect); |
|
66 CleanupStack::PopAndDestroy(3); |
|
67 } |
|
68 |
|
69 void DWsScreenDevice::CommandL(TInt aOpcode, const TAny *aCmdData) |
|
70 { |
|
71 TWsSdCmdUnion pData; |
|
72 pData.any=aCmdData; |
|
73 switch(aOpcode) |
|
74 { |
|
75 case EWsSdOpGetNumScreenModes: |
|
76 SetReply(iScreen->NumScreenSizeModes()); |
|
77 break; |
|
78 case EWsSdOpGetScreenMode: |
|
79 SetReply(iScreen->ScreenSizeMode()); |
|
80 break; |
|
81 case EWsSdOpSetScreenMode: |
|
82 { |
|
83 if(!KSecurityPolicy_WriteDeviceData().CheckPolicy(iWsOwner->ClientMessage(),__PLATSEC_DIAGNOSTIC_STRING("Capability check failed for CWsScreenDevice::SetScreenMode API"))) |
|
84 { |
|
85 iWsOwner->PPanic(EWservPanicPermissionDenied); |
|
86 } |
|
87 SetScreenMode(*pData.Int); |
|
88 } |
|
89 break; |
|
90 case EWsSdOpSetModeRotation: |
|
91 { |
|
92 if(KSecurityPolicy_WriteDeviceData().CheckPolicy(iWsOwner->ClientMessage(),__PLATSEC_DIAGNOSTIC_STRING("Capability check failed for CWsScreenDevice::SetModeRotation API"))) |
|
93 { |
|
94 TClientPanic panic=iScreen->SetModeRotation(pData.SetScreenRotation->mode,pData.SetScreenRotation->rotation); |
|
95 if (panic) |
|
96 OwnerPanic(panic); |
|
97 } |
|
98 } |
|
99 break; |
|
100 case EWsSdOpGetRotationList: |
|
101 if (!iScreen->IsValidScreenSizeMode(*pData.Int)) |
|
102 OwnerPanic(EWservPanicScreenModeNumber); |
|
103 SetReply(iScreen->ScreenSizeModeData(*pData.Int).iAlternativeRotations); |
|
104 break; |
|
105 case EWsSdOpGetScreenModeSizeAndRotation: |
|
106 GetScreenSizeAndRotationCmd(*pData.Int); |
|
107 break; |
|
108 case EWsSdOpGetScreenModeSizeAndRotation2: |
|
109 GetScreenSizeAndRotationCmd2(*pData.Int); |
|
110 break; |
|
111 case EWsSdOpSetScreenSizeAndRotation: |
|
112 SetScreenSizeAndRotation(*pData.PixelsTwipsAndRotation); |
|
113 break; |
|
114 case EWsSdOpSetScreenSizeAndRotation2: |
|
115 SetScreenSizeAndRotation(*pData.PixelsAndRotation); |
|
116 break; |
|
117 case EWsSdOpGetDefaultScreenSizeAndRotation: |
|
118 GetScreenSizeAndRotationCmd(iScreen->ScreenSizeMode()); |
|
119 break; |
|
120 case EWsSdOpGetDefaultScreenSizeAndRotation2: |
|
121 GetScreenSizeAndRotationCmd2(iScreen->ScreenSizeMode()); |
|
122 break; |
|
123 case EWsSdOpGetScreenModeDisplayMode: |
|
124 GetScreenModeDisplayMode(*pData.Int); |
|
125 break; |
|
126 case EWsSdOpGetScreenModeScale: |
|
127 GetScreenScale(*pData.Int); |
|
128 break; |
|
129 case EWsSdOpGetCurrentScreenModeScale: |
|
130 GetScreenScale(iScreen->ScreenSizeMode()); |
|
131 break; |
|
132 case EWsSdOpSetAppScreenMode: |
|
133 SetAppScreenMode(*pData.Int); |
|
134 break; |
|
135 case EWsSdOpGetCurrentScreenModeScaledOrigin: |
|
136 CWsClient::ReplyPoint(iScreen->CurrentScreenModeScaledOrigin()); |
|
137 break; |
|
138 case EWsSdOpGetScreenModeScaledOrigin: |
|
139 if (!iScreen->IsValidScreenSizeMode(*pData.Int)) |
|
140 OwnerPanic(EWservPanicScreenModeNumber); |
|
141 CWsClient::ReplyPoint(iScreen->ScreenModeScaledOrigin(*pData.Int)); |
|
142 break; |
|
143 case EWsSdOpGetCurrentScreenModeAttributes: |
|
144 GetCurrentScreenModeAttributes(); |
|
145 break; |
|
146 case EWsSdOpSetCurrentScreenModeAttributes: |
|
147 if(!KSecurityPolicy_WriteDeviceData().CheckPolicy(iWsOwner->ClientMessage(),__PLATSEC_DIAGNOSTIC_STRING("Capability check failed for CWsScreenDevice::SetCurrentScreenModeAttributes API, API should be used for test purposes only"))) |
|
148 { |
|
149 iWsOwner->PPanic(EWservPanicPermissionDenied); |
|
150 } |
|
151 SetCurrentScreenModeAttributes(*pData.ScreenSizeMode); |
|
152 break; |
|
153 case EWsSdOpSetScreenModeEnforcement: |
|
154 { |
|
155 if(!KSecurityPolicy_WriteDeviceData().CheckPolicy(iWsOwner->ClientMessage(),__PLATSEC_DIAGNOSTIC_STRING("Capability check failed for CWsScreenDevice::SetScreenModeEnforcement API"))) |
|
156 { |
|
157 iWsOwner->PPanic(EWservPanicPermissionDenied); |
|
158 } |
|
159 if (!iScreen->SetScreenModeEnforcement(*pData.Int)) |
|
160 OwnerPanic(EWservPanicScreenEnforcementMode); |
|
161 } |
|
162 break; |
|
163 case EWsSdOpScreenModeEnforcement: |
|
164 SetReply(iScreen->SizeEnforcementMode()); |
|
165 break; |
|
166 case EWsSdOpGetDefaultScreenModeOrigin: |
|
167 GetScreenModeOriginCmd(iScreen->ScreenSizeMode()); |
|
168 break; |
|
169 case EWsSdOpGetScreenModeOrigin: |
|
170 GetScreenModeOriginCmd(*pData.Int); |
|
171 break; |
|
172 case EWsSdOpPixel: |
|
173 { |
|
174 TRgb rgb; |
|
175 iScreen->ScreenDevice()->GetPixel(rgb,*pData.Point); |
|
176 SetReply(rgb.Internal()); |
|
177 } |
|
178 break; |
|
179 case EWsSdOpGetScanLine: |
|
180 iScreen->GetScanLine(pData.GetScanLine); |
|
181 break; |
|
182 case EWsSdOpTwipsSize: |
|
183 CWsClient::ReplySize(iAppScreenSizeInTwips); |
|
184 break; |
|
185 case EWsSdOpPixelSize: |
|
186 CWsClient::ReplySize(iAppScreenSizeInPixels); |
|
187 break; |
|
188 case EWsSdOpHorizontalTwipsToPixels: |
|
189 SetReply(iScreen->ScreenDevice()->HorizontalTwipsToPixels(*pData.UInt)); |
|
190 break; |
|
191 case EWsSdOpVerticalTwipsToPixels: |
|
192 SetReply(iScreen->ScreenDevice()->VerticalTwipsToPixels(*pData.UInt)); |
|
193 break; |
|
194 case EWsSdOpHorizontalPixelsToTwips: |
|
195 SetReply(iScreen->ScreenDevice()->HorizontalPixelsToTwips(*pData.UInt)); |
|
196 break; |
|
197 case EWsSdOpVerticalPixelsToTwips: |
|
198 SetReply(iScreen->ScreenDevice()->VerticalPixelsToTwips(*pData.UInt)); |
|
199 break; |
|
200 case EWsSdOpPointerRect: |
|
201 { |
|
202 TMachineInfoV1Buf macInfo; |
|
203 UserHal::MachineInfo(macInfo); |
|
204 TRect rect(-macInfo().iOffsetToDisplayInPixels,macInfo().iXYInputSizeInPixels); |
|
205 CWsClient::ReplyRect(rect); |
|
206 } |
|
207 break; |
|
208 case EWsSdOpFree: |
|
209 { |
|
210 // Mark any group windows associated with the screen device being deleted |
|
211 CWsRootWindow* root=iScreen->RootWindow(); |
|
212 for (CWsWindowGroup* grp = root->Child(); grp; grp = grp->NextSibling()) |
|
213 { |
|
214 if (grp->Device() == this) |
|
215 { |
|
216 #if defined(_DEBUG) |
|
217 grp->SetScreenDeviceDeleted(); |
|
218 #endif |
|
219 grp->SetScreenDevice(NULL); |
|
220 } |
|
221 } |
|
222 } |
|
223 // Let our owner (CWsClient) know that a screen device is being deleted so it |
|
224 // can check whether to reset its iPrimaryScreenDevice member or not |
|
225 if (WsOwner()) |
|
226 WsOwner()->NotifyScreenDeviceDeleted(this); |
|
227 delete this; |
|
228 break; |
|
229 case EWsSdOpDisplayMode: |
|
230 iScreen->ScreenGdi(); // To force display mode update if required |
|
231 SetReply(iScreen->CurrentDisplayMode()); |
|
232 break; |
|
233 case EWsSdOpRectCompare: |
|
234 { |
|
235 // if (pData.RectCompare->flags&CWsScreenDevice::EIncludeSprite) |
|
236 // { |
|
237 // SpriteManager()->IncrementProcessingSprites(); |
|
238 // } |
|
239 |
|
240 RWsTextCursor * cursor = 0; |
|
241 if (!pData.RectCompare->flags&CWsScreenDevice::EIncludeTextCursor) |
|
242 cursor = CWsTop::CurrentTextCursor(); |
|
243 if (cursor) |
|
244 cursor->Disable(); |
|
245 |
|
246 SetReply(iScreen->ScreenDevice()->RectCompare(pData.RectCompare->rect1,*iScreen->ScreenDevice(),pData.RectCompare->rect2)); |
|
247 |
|
248 if (cursor) |
|
249 cursor->Enable(); |
|
250 |
|
251 // if (pData.RectCompare->flags&CWsScreenDevice::EIncludeSprite) |
|
252 // { |
|
253 // SpriteManager()->DecrementProcessingSprites(); |
|
254 // } |
|
255 } |
|
256 break; |
|
257 case EWsSdOpCopyScreenToBitmap: |
|
258 CopyScreenToBitmapL(TRect(iScreen->ScreenDevice()->SizeInPixels()),pData.CopyScreenToBitmap->handle); |
|
259 break; |
|
260 case EWsSdOpCopyScreenToBitmap2: |
|
261 CopyScreenToBitmapL(pData.CopyScreenToBitmap2->rect,pData.CopyScreenToBitmap2->handle); |
|
262 break; |
|
263 case EWsSdOpPaletteAttributes: |
|
264 { |
|
265 TBool modifiable; |
|
266 TInt numEntries; |
|
267 iScreen->ScreenDevice()->PaletteAttributes(modifiable,numEntries); |
|
268 if (modifiable) |
|
269 numEntries|=EWsSdSetableBitFlag; |
|
270 SetReply(numEntries); |
|
271 } |
|
272 break; |
|
273 case EWsSdOpSetPalette: |
|
274 { |
|
275 if(!KSecurityPolicy_WriteDeviceData().CheckPolicy(iWsOwner->ClientMessage(),__PLATSEC_DIAGNOSTIC_STRING("Capability check failed for CWsScreenDevice::SetPalette API"))) |
|
276 { |
|
277 User::Leave(KErrPermissionDenied); |
|
278 } |
|
279 SetPaletteL(); |
|
280 } |
|
281 break; |
|
282 case EWsSdOpGetPalette: |
|
283 GetPalette(*pData.Int); |
|
284 break; |
|
285 |
|
286 case EWsSdOpGetScreenNumber: |
|
287 SetReply(iScreen->ScreenNumber()); |
|
288 break; |
|
289 case EWsSdOpGetScreenSizeModeList: |
|
290 SetReply(iScreen->GetScreenSizeModeListL()); |
|
291 break; |
|
292 case EWsClOpSetBackLight: |
|
293 { |
|
294 TInt err=KErrNone; |
|
295 if(Screen()->BackLightFlag() && iWsOwner->ClientMessage().SecureId()==KEikSrvsSid) |
|
296 { |
|
297 TWindowServerEvent::ProcessErrorMessages(TWsErrorMessage::EBackLight, err=HAL::Set(iScreen->ScreenNumber(),HALData::EBacklightState,*pData.Int)); |
|
298 SetReply(err); |
|
299 } |
|
300 else |
|
301 { |
|
302 User::Leave(KErrPermissionDenied); |
|
303 } |
|
304 } |
|
305 break; |
|
306 default: |
|
307 OwnerPanic(EWservPanicOpcode); |
|
308 break; |
|
309 } |
|
310 } |
|
311 |
|
312 |
|
313 void DWsScreenDevice::SetScreenMode(TInt aMode) |
|
314 { |
|
315 if (!iScreen->IsValidScreenSizeMode(aMode)) |
|
316 OwnerPanic(EWservPanicScreenModeNumber); |
|
317 iScreen->doSetScreenMode(aMode); |
|
318 } |
|
319 |
|
320 TBool DWsScreenDevice::ScreenDeviceValidState() const |
|
321 { |
|
322 WS_ASSERT_DEBUG(iScreen->IsValidScreenSizeMode(iScreen->ScreenSizeMode()), EWsPanicInvalidScreenSizeMode); |
|
323 const TSizeMode& currentMode=iScreen->ScreenSizeModeData(); |
|
324 TBool state=ETrue; |
|
325 // In all enforcement modes scale should match, so check scale first |
|
326 if (currentMode.iScreenScale!=iAppScale) |
|
327 { |
|
328 state=EFalse; |
|
329 } |
|
330 else |
|
331 { |
|
332 if (iScreen->SizeEnforcementMode()!=ESizeEnforcementNone) |
|
333 { |
|
334 if (currentMode.iRotation!=iAppRotation) |
|
335 state=EFalse; |
|
336 else if (currentMode.iScreenSize!=iAppScreenSizeInPixels) |
|
337 state=EFalse; |
|
338 } |
|
339 if (iScreen->SizeEnforcementMode()==ESizeEnforcementPixelsTwipsAndRotation) |
|
340 { |
|
341 if (currentMode.iScreenTwipsSize!=iAppScreenSizeInTwips) |
|
342 state=EFalse; |
|
343 } |
|
344 } |
|
345 return(state); |
|
346 } |
|
347 |
|
348 void DWsScreenDevice::ConstructL() |
|
349 // |
|
350 // App specific construct |
|
351 // |
|
352 { |
|
353 NewObjL(); |
|
354 const TSizeMode& mode=iScreen->ScreenSizeModeData(iScreen->ScreenSizeMode()); |
|
355 iAppScreenSizeInPixels=mode.iScreenSize; |
|
356 iAppScreenSizeInTwips=mode.iScreenTwipsSize; |
|
357 iAppRotation=mode.iRotation; |
|
358 iAppMode=iScreen->ScreenSizeMode(); |
|
359 iAppScale=mode.iScreenScale; |
|
360 } |
|
361 |
|
362 void DWsScreenDevice::SetScreenSizeAndRotation(const TPixelsTwipsAndRotation &aSar) |
|
363 { |
|
364 iAppScreenSizeInPixels=aSar.iPixelSize; |
|
365 iAppScreenSizeInTwips=aSar.iTwipsSize; |
|
366 iAppRotation=aSar.iRotation; |
|
367 SetScreenDeviceValidStates(this); |
|
368 } |
|
369 |
|
370 void DWsScreenDevice::SetScreenSizeAndRotation(const TPixelsAndRotation &aSar) |
|
371 { |
|
372 iAppScreenSizeInPixels=aSar.iPixelSize; |
|
373 iAppScreenSizeInTwips.iWidth=iScreen->ScreenDevice()->HorizontalPixelsToTwips(iAppScreenSizeInPixels.iWidth); |
|
374 iAppScreenSizeInTwips.iHeight=iScreen->ScreenDevice()->VerticalPixelsToTwips(iAppScreenSizeInPixels.iHeight); |
|
375 iAppRotation=aSar.iRotation; |
|
376 SetScreenDeviceValidStates(this); |
|
377 } |
|
378 |
|
379 void DWsScreenDevice::GetScreenModeOriginCmd(TInt aMode) |
|
380 { |
|
381 if (!iScreen->IsValidScreenSizeMode(aMode)) |
|
382 OwnerPanic(EWservPanicScreenModeNumber); |
|
383 CWsClient::ReplyPoint(iScreen->ScreenModeOrigin(aMode)); |
|
384 } |
|
385 |
|
386 void DWsScreenDevice::GetCurrentScreenModeAttributes() |
|
387 { |
|
388 TSizeMode aModeData=iScreen->ScreenSizeModeData(); |
|
389 CWsClient::ReplyBuf(&aModeData,sizeof(aModeData)); |
|
390 } |
|
391 |
|
392 void DWsScreenDevice::SetCurrentScreenModeAttributes(const TSizeMode &aModeData) |
|
393 { |
|
394 #if defined(_DEBUG) |
|
395 if (aModeData.iScreenScale.iWidth==0 || aModeData.iScreenScale.iHeight==0) |
|
396 OwnerPanic(EWservPanicScreenModeNumber); |
|
397 #endif |
|
398 iScreen->SetCurrentScreenModeAttributes(aModeData); |
|
399 } |
|
400 |
|
401 void DWsScreenDevice::GetScreenSizeAndRotationCmd(TInt aMode) |
|
402 { |
|
403 if (!iScreen->IsValidScreenSizeMode(aMode)) |
|
404 OwnerPanic(EWservPanicScreenModeNumber); |
|
405 TPixelsTwipsAndRotation sar; |
|
406 iScreen->GetScreenSizeAndRotation(sar,aMode); |
|
407 CWsClient::ReplyBuf(&sar, sizeof(sar)); |
|
408 } |
|
409 |
|
410 void DWsScreenDevice::GetScreenSizeAndRotationCmd2(TInt aMode) |
|
411 { |
|
412 if (!iScreen->IsValidScreenSizeMode(aMode)) |
|
413 OwnerPanic(EWservPanicScreenModeNumber); |
|
414 TPixelsAndRotation sar; |
|
415 iScreen->GetScreenSizeAndRotation(sar,aMode); |
|
416 CWsClient::ReplyBuf(&sar, sizeof(sar)); |
|
417 } |
|
418 |
|
419 void DWsScreenDevice::GetScreenModeDisplayMode(const TInt aMode) |
|
420 { |
|
421 if (!iScreen->IsValidScreenSizeMode(aMode)) |
|
422 { |
|
423 OwnerPanic(EWservPanicScreenModeNumber); |
|
424 } |
|
425 SetReply(STATIC_CAST(TInt,iScreen->DefaultDisplayMode(aMode))); |
|
426 } |
|
427 |
|
428 void DWsScreenDevice::GetScreenScale(TInt aMode) |
|
429 { |
|
430 if (!iScreen->IsValidScreenSizeMode(aMode)) |
|
431 { |
|
432 OwnerPanic(EWservPanicScreenModeNumber); |
|
433 } |
|
434 CWsClient::ReplySize(iScreen->GetScreenScale(aMode)); |
|
435 } |
|
436 |
|
437 void DWsScreenDevice::SetAppScreenMode(TInt aMode) |
|
438 { |
|
439 if (!iScreen->IsValidScreenSizeMode(aMode)) |
|
440 { |
|
441 OwnerPanic(EWservPanicScreenModeNumber); |
|
442 } |
|
443 const TSizeMode& sizeMode=iScreen->ScreenSizeModeData(aMode); |
|
444 iAppScreenSizeInPixels=sizeMode.iScreenSize; |
|
445 iAppScreenSizeInTwips=sizeMode.iScreenTwipsSize; |
|
446 iAppMode=aMode; |
|
447 iAppScale=sizeMode.iScreenScale; |
|
448 iAppRotation=sizeMode.iRotation; |
|
449 CWsWindowGroup::SetScreenDeviceValidStates(this); |
|
450 } |
|
451 |
|
452 #define ROTATION_TO_FLAG(x) 1<<x |
|
453 |
|
454 void DWsScreenDevice::SetScreenDeviceValidStates(const DWsScreenDevice *aDevice) |
|
455 { |
|
456 TInt modes=iScreen->NumScreenSizeModes(); |
|
457 TInt mode; |
|
458 for (mode=0;mode<modes;++mode) |
|
459 { |
|
460 if (!iScreen->IsValidScreenSizeMode(mode)) |
|
461 continue; |
|
462 const TSizeMode& sizeMode=iScreen->ScreenSizeModeData(mode); |
|
463 if (iAppScreenSizeInPixels==sizeMode.iScreenSize && ROTATION_TO_FLAG(iAppRotation)&sizeMode.iAlternativeRotations) |
|
464 { |
|
465 iAppMode=mode; |
|
466 iAppScale=sizeMode.iScreenScale; |
|
467 break; |
|
468 } |
|
469 } |
|
470 CWsWindowGroup::SetScreenDeviceValidStates(aDevice); |
|
471 } |
|
472 |
|
473 void DWsScreenDevice::NewOrientation(TInt aMode,CFbsBitGc::TGraphicsOrientation aRotation) |
|
474 { |
|
475 if (iAppMode==aMode) |
|
476 iAppRotation=aRotation; |
|
477 } |
|
478 |
|
479 void DWsScreenDevice::SetPaletteL() |
|
480 { |
|
481 const TInt size=iWsOwner->ClientMessage().GetDesLength(KRemoteBufferMessageSlot); |
|
482 TInt numEntries=size/sizeof(TRgb); |
|
483 CPalette* palette=CPalette::NewL(numEntries); |
|
484 CleanupStack::PushL(palette); |
|
485 TPtr8 paletteData(NULL,0); |
|
486 palette->GetDataPtr(0,numEntries,paletteData); |
|
487 iWsOwner->RemoteReadL(paletteData,0); |
|
488 SetReply(iScreen->ScreenDevice()->SetCustomPalette(palette)); |
|
489 iScreen->Update((RWsRegion&)RootWindow()->WindowArea()); |
|
490 CleanupStack::PopAndDestroy(palette); |
|
491 } |
|
492 |
|
493 void DWsScreenDevice::GetPalette(TInt aNumColors) |
|
494 { |
|
495 CPalette* palette; |
|
496 TInt ret=iScreen->ScreenDevice()->GetPalette(palette); |
|
497 if (ret<KErrNone) |
|
498 goto Reply; |
|
499 ret=palette->Entries(); |
|
500 if (ret!=aNumColors) |
|
501 { |
|
502 delete palette; |
|
503 Reply: |
|
504 SetReply(ret); |
|
505 return; |
|
506 } |
|
507 TPtr8 paletteData(NULL,0); |
|
508 palette->GetDataPtr(0,ret,paletteData); |
|
509 CWsClient::ReplyBuf(paletteData); |
|
510 SetReply(KErrNone); |
|
511 delete palette; |
|
512 } |
|
513 |
|
514 TUint DWsScreenDevice::ClientDevicePointer() |
|
515 { |
|
516 return iClientScreenDevicePointer; |
|
517 } |