|
1 // Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This material, including documentation and any related |
|
4 // computer programs, is protected by copyright controlled by |
|
5 // Nokia. All rights are reserved. Copying, including |
|
6 // reproducing, storing, adapting or translating, any |
|
7 // or all of this material requires the prior written consent of |
|
8 // Nokia. This material also contains confidential |
|
9 // information which may not be disclosed to others without the |
|
10 // prior written consent of Nokia. |
|
11 // |
|
12 // Description: |
|
13 // Render Orientation Tracking and Publication |
|
14 // |
|
15 |
|
16 #include <hal.h> |
|
17 #include <e32std.h> |
|
18 #include "renderorientationtracker.h" |
|
19 #include "rootwin.h" |
|
20 #include "windowgroup.h" |
|
21 #include "wstop.h" |
|
22 #include "..\debuglog\DEBUGLOG.H" |
|
23 |
|
24 extern CDebugLogBase* wsDebugLog; |
|
25 |
|
26 /** Convert a TRenderOrientation value into a TDigitiserOrientation. |
|
27 Note: The algorithm used makes use of the ordering of the values of the respective enums, |
|
28 thus this is checked for (at compile time) at the start of the function. |
|
29 @param aWservOrientation A value from the TRenderOrientation enums. |
|
30 @return The equivalent value from the TDigitiserOrientation enums. |
|
31 */ |
|
32 inline HALData::TDigitiserOrientation WservToDigitiser(TRenderOrientation aWservOrientation) |
|
33 { |
|
34 __ASSERT_COMPILE(EDisplayOrientationNormal+1 == EDisplayOrientation90CW); |
|
35 __ASSERT_COMPILE(EDisplayOrientationNormal+2 == EDisplayOrientation180); |
|
36 __ASSERT_COMPILE(EDisplayOrientationNormal+3 == EDisplayOrientation270CW); |
|
37 __ASSERT_COMPILE(HALData::EDigitiserOrientation_000+1 == HALData::EDigitiserOrientation_090); |
|
38 __ASSERT_COMPILE(HALData::EDigitiserOrientation_000+2 == HALData::EDigitiserOrientation_180); |
|
39 __ASSERT_COMPILE(HALData::EDigitiserOrientation_000+3 == HALData::EDigitiserOrientation_270); |
|
40 HALData::TDigitiserOrientation ret=static_cast<HALData::TDigitiserOrientation> |
|
41 (HALData::EDigitiserOrientation_000 + (aWservOrientation - EDisplayOrientationNormal)); |
|
42 return ret; |
|
43 } |
|
44 |
|
45 // Todo remove/undefine this for release |
|
46 #define TECHVIEW_TESTMODE |
|
47 |
|
48 CWsRenderOrienationTracker* CWsRenderOrienationTracker::NewL() |
|
49 { |
|
50 CWsRenderOrienationTracker* self = new(ELeave)CWsRenderOrienationTracker(); |
|
51 CleanupStack::PushL(self); |
|
52 self->ConstructL(); |
|
53 CleanupStack::Pop(); |
|
54 return self; |
|
55 } |
|
56 |
|
57 CWsRenderOrienationTracker::CWsRenderOrienationTracker() |
|
58 : CActive(CActive::EPriorityStandard), |
|
59 iRenderOrientationTrackingType(EDisplayOrientationNormal), |
|
60 iPublishedRenderOrientation(EDisplayOrientationNormal) |
|
61 { |
|
62 CActiveScheduler::Add(this); |
|
63 } |
|
64 |
|
65 void CWsRenderOrienationTracker::ConstructL() |
|
66 { |
|
67 const TSecurityPolicy KRenderOrientationReadSecurityPolicy(ECapability_None); |
|
68 const TSecurityPolicy KRenderOrientationWriteSecurityPolicy(ECapabilityWriteDeviceData); |
|
69 |
|
70 // Define P&S Property to publish to |
|
71 TInt error = RProperty::Define( KRenderOrientationCategory, |
|
72 KRenderOrientationKey, |
|
73 RProperty::EInt, |
|
74 KRenderOrientationReadSecurityPolicy, |
|
75 KRenderOrientationWriteSecurityPolicy); |
|
76 |
|
77 // Attach the publisher for real-time publishing |
|
78 if(KErrNone == error) |
|
79 error = iRenderOrientationPublisher.Attach( KRenderOrientationCategory, |
|
80 KRenderOrientationKey); |
|
81 |
|
82 // Publish the initial value |
|
83 if(KErrNone == error) |
|
84 error = DoPublishOrientation(EDisplayOrientationNormal); |
|
85 |
|
86 //Set the initial value to HAL |
|
87 if(KErrNone == error) |
|
88 SetHALOrientation(EDisplayOrientationNormal); |
|
89 |
|
90 if (wsDebugLog && KErrNone!=error) |
|
91 { |
|
92 _LIT(logText,"Orientation Tracker: failed to initialise with error %d"); |
|
93 wsDebugLog->MiscMessage(CDebugLogBase::ELogImportant,logText,error); |
|
94 } |
|
95 User::LeaveIfError(error); |
|
96 } |
|
97 |
|
98 CWsRenderOrienationTracker::~CWsRenderOrienationTracker() |
|
99 { |
|
100 Cancel(); |
|
101 iRenderOrientationPublisher.Delete(KRenderOrientationCategory, KRenderOrientationKey); |
|
102 iRenderOrientationPublisher.Close(); |
|
103 } |
|
104 |
|
105 /** |
|
106 If the orientation of the given window group is useable updates aOrientationTrackingType with the orientation |
|
107 |
|
108 @param Input: the window group to check |
|
109 @param Output: the window group's orientation if usable ( otherwise unchanged ) |
|
110 @return KErrNone if the orienation is usable, KErrNotFound if the orientation is not useable, KErrNotSupported if the orientation is unknown |
|
111 */ |
|
112 TInt CWsRenderOrienationTracker::CheckWindowGroupOrientation(const CWsWindowGroup& aWinGroup, TRenderOrientationTrackingType& aOrientationTrackingType) |
|
113 { |
|
114 TInt error = KErrNone; |
|
115 TRenderOrientationTrackingType tempOrientationTrackingType = static_cast<TRenderOrientationTrackingType>(aWinGroup.WsOwner()->GetIndicatedAppOrientation()); |
|
116 switch(tempOrientationTrackingType) |
|
117 { |
|
118 case EDisplayOrientationNormal: |
|
119 case EDisplayOrientation90CW: |
|
120 case EDisplayOrientation180: |
|
121 case EDisplayOrientation270CW: |
|
122 case EDisplayOrientationAuto: |
|
123 aOrientationTrackingType = tempOrientationTrackingType; |
|
124 break; |
|
125 |
|
126 case EDisplayOrientationIgnore: |
|
127 error = KErrNotFound; |
|
128 if (wsDebugLog) |
|
129 { |
|
130 _LIT(logText,"Orientation Tracker: winGroup %08x orientation is set to be ignored"); |
|
131 wsDebugLog->MiscMessage(CDebugLogBase::ELogEverything,logText,reinterpret_cast<TInt>(&aWinGroup)); |
|
132 } |
|
133 break; |
|
134 |
|
135 default: |
|
136 error = KErrNotSupported; |
|
137 if (wsDebugLog) |
|
138 { |
|
139 _LIT(logText,"Orientation Tracker: winGroup %08x has undefined orientation, Error %d"); |
|
140 TBuf<LogTBufSize> buf; |
|
141 buf.Format(logText, &aWinGroup, error); |
|
142 wsDebugLog->MiscMessage(CDebugLogBase::ELogIntermediate,buf); |
|
143 } |
|
144 break; |
|
145 } |
|
146 |
|
147 return error; |
|
148 } |
|
149 |
|
150 /** |
|
151 Checks that the given group window is appropriate for dictating the render orientation |
|
152 |
|
153 @param Input: The group window to check |
|
154 @return ETrue is the group window is usable, else EFalse |
|
155 */ |
|
156 TBool CWsRenderOrienationTracker::UseableGroupWindow(const CWsWindowGroup& aWinGroup) const |
|
157 { |
|
158 #ifdef TECHVIEW_TESTMODE |
|
159 // for some reason IsFocusable seems to return 0 and 2, not 0 and 1 |
|
160 return NULL!=aWinGroup.Child() && |
|
161 (aWinGroup.IsFocusable() ? ETrue : EFalse); |
|
162 #else |
|
163 return (NULL!=aWinGroup.Child()); |
|
164 #endif |
|
165 } |
|
166 |
|
167 /** |
|
168 Finds the topmost usable windowgroup which has a usable orientation, and outputs that orientation |
|
169 |
|
170 @param Output: The current render orientation |
|
171 @return KErrNone if successful, KErrNotFound if the focus window group is not usable, KErrNotSupported if an invalid orientation is found |
|
172 */ |
|
173 TInt CWsRenderOrienationTracker::GetFocusWindowOrientation(TRenderOrientationTrackingType& aOrientationTrackingType) |
|
174 { |
|
175 TInt error = KErrNone; |
|
176 CWsWindowGroup* focusWinGroup = CWsTop::FocusWindowGroup(); |
|
177 if(!focusWinGroup) |
|
178 { |
|
179 _LIT(logText,"Orientation Tracker: focusWinGroup not found"); |
|
180 wsDebugLog->MiscMessage(CDebugLogBase::ELogEverything,logText); |
|
181 error = KErrNotFound; |
|
182 } |
|
183 else |
|
184 { |
|
185 error = CheckWindowGroupOrientation(*focusWinGroup, aOrientationTrackingType); |
|
186 } |
|
187 return error; |
|
188 } |
|
189 |
|
190 /** |
|
191 Finds the topmost usable windowgroup which has a usable orientation, and outputs that orientation |
|
192 |
|
193 @param Output: The current render orientation |
|
194 @return KErrNone if successful, KErrNotSupported if an invalid orientation is found |
|
195 */ |
|
196 TInt CWsRenderOrienationTracker::FindOrientationFromWindowTree(TRenderOrientationTrackingType& aOrientationTrackingType) |
|
197 { |
|
198 TInt error = KErrNone; |
|
199 TRenderOrientationTrackingType tempOrientationTrackingType = iRenderOrientationTrackingType; |
|
200 CWsRootWindow* rootWin = CWsTop::CurrentFocusScreen()->RootWindow(); |
|
201 TBool finished = EFalse; |
|
202 for(CWsWindowGroup* winGroup = rootWin->Child(); !finished && NULL != winGroup; winGroup = winGroup->NextSibling()) |
|
203 { |
|
204 if (wsDebugLog) |
|
205 { |
|
206 _LIT(logText,"Orientation Tracker: winGroup %08x has priority %d, Orientation %d, Focusable %d, Child %08x"); |
|
207 TBuf<LogTBufSize> buf; |
|
208 buf.Format(logText, winGroup, winGroup->OrdinalPriority(), winGroup->WsOwner()->GetIndicatedAppOrientation(), |
|
209 winGroup->IsFocusable()?ETrue:EFalse, winGroup->Child()); |
|
210 wsDebugLog->MiscMessage(CDebugLogBase::ELogEverything,buf); |
|
211 } |
|
212 // winGroup is a higher priority ordinal, so see if it has an orientation that can be used |
|
213 // although we're only interested in window groups with child windows otherwise nothing is visible anyway |
|
214 if(UseableGroupWindow(*winGroup)) |
|
215 { |
|
216 error = CheckWindowGroupOrientation(*winGroup, tempOrientationTrackingType); |
|
217 switch(error) |
|
218 { |
|
219 case KErrNone: |
|
220 { |
|
221 // List is in order, so just find the first one |
|
222 if (wsDebugLog) |
|
223 { |
|
224 _LIT(logText,"Orientation Tracker: Found winGroup %08x with Orientation %d"); |
|
225 TBuf<LogTBufSize> buf; |
|
226 buf.Format(logText, winGroup, winGroup->WsOwner()->GetIndicatedAppOrientation()); |
|
227 wsDebugLog->MiscMessage(CDebugLogBase::ELogEverything,buf); |
|
228 } |
|
229 finished = ETrue; |
|
230 break; |
|
231 } |
|
232 |
|
233 case KErrNotFound: |
|
234 // so keep searching |
|
235 break; |
|
236 |
|
237 case KErrNotSupported: |
|
238 default: |
|
239 finished = ETrue; |
|
240 break; |
|
241 |
|
242 } |
|
243 |
|
244 } |
|
245 } |
|
246 // Safe even in error code as won't have been changed by CheckWindowGroupOrientation |
|
247 aOrientationTrackingType = tempOrientationTrackingType; |
|
248 |
|
249 return error; |
|
250 } |
|
251 |
|
252 /** |
|
253 First checks to see if the focus window group has a usable orientation, if so that is output. |
|
254 Otherwise, finds the topmost usable windowgroup which has a usable orientation, and outputs that |
|
255 |
|
256 @param Output: The current render orientation |
|
257 @return KErrNone if successful, KErrNotSupported if an invalid orientation is found |
|
258 */ |
|
259 TInt CWsRenderOrienationTracker::GetIndicatedOrientation(TRenderOrientationTrackingType& aOrientationTrackingType) |
|
260 { |
|
261 // First check the focus window group |
|
262 TInt error = GetFocusWindowOrientation(aOrientationTrackingType); |
|
263 |
|
264 // Don't look for another window if the focus window is usable |
|
265 // or if an error has occured, then don't change current orientation |
|
266 switch(error) |
|
267 { |
|
268 case KErrNone: |
|
269 { |
|
270 if(wsDebugLog) |
|
271 { |
|
272 _LIT(logText,"Orientation Tracker: Using focus window %08x for orientation"); |
|
273 wsDebugLog->MiscMessage(CDebugLogBase::ELogEverything,logText,reinterpret_cast<TInt>(CWsTop::FocusWindowGroup())); |
|
274 } |
|
275 break; |
|
276 } |
|
277 |
|
278 case KErrNotFound: |
|
279 { |
|
280 // Can't use focus window group, so find the topmost windowgroup with a valid orientation |
|
281 error = FindOrientationFromWindowTree(aOrientationTrackingType); |
|
282 break; |
|
283 } |
|
284 |
|
285 default: |
|
286 // Unrecoverable error, abort and leave published orientation unchanged |
|
287 break; |
|
288 } |
|
289 |
|
290 return error; |
|
291 } |
|
292 |
|
293 /** |
|
294 Checks to see if the render orientation has changed, and publishes any new orientaion |
|
295 via publish and subscribe |
|
296 |
|
297 @see KRenderOrientationCategory |
|
298 @see KRenderOrientationKey |
|
299 */ |
|
300 void CWsRenderOrienationTracker::CheckRenderOrientation() |
|
301 { |
|
302 TRenderOrientationTrackingType newOrientationTrackingType = iRenderOrientationTrackingType; |
|
303 TInt error = GetIndicatedOrientation(newOrientationTrackingType); |
|
304 |
|
305 // if the tracking type has changed... |
|
306 if(KErrNone == error && iRenderOrientationTrackingType != newOrientationTrackingType) |
|
307 { |
|
308 if(EDisplayOrientationAuto == iRenderOrientationTrackingType) |
|
309 { |
|
310 // change from auto type, so we need to cancel request for updates from the theme server |
|
311 Cancel(); |
|
312 } |
|
313 iRenderOrientationTrackingType = newOrientationTrackingType; |
|
314 if(EDisplayOrientationAuto == iRenderOrientationTrackingType) |
|
315 { |
|
316 // Change to auto type, so we need to request updates from the theme server |
|
317 // Attach to the Theme server to get orientation change updates |
|
318 error = iThemeOrientationProperty.Attach( KThemeOrientationCategory, KThemeOrientationKey ); |
|
319 if (wsDebugLog) |
|
320 { |
|
321 if(KErrNone == error) |
|
322 { |
|
323 // Information Log |
|
324 _LIT(logText,"Orientation Tracker: Attached to theme orientation property"); |
|
325 wsDebugLog->MiscMessage(CDebugLogBase::ELogEverything,logText); |
|
326 } |
|
327 else |
|
328 { |
|
329 // Error Log |
|
330 _LIT(logText,"Orientation Tracker: Error %d attaching to theme orientation property"); |
|
331 wsDebugLog->MiscMessage(CDebugLogBase::ELogIntermediate,logText, error); |
|
332 } |
|
333 } |
|
334 |
|
335 RequestDeviceOrientationNotification(); |
|
336 } |
|
337 // See if the has changed, and publish if it has |
|
338 error = DoOrientationTracking(); |
|
339 } |
|
340 |
|
341 if (wsDebugLog && KErrNone != error) |
|
342 { |
|
343 _LIT(logText,"Orientation Tracker: Error %d Checking Render Orientation"); |
|
344 wsDebugLog->MiscMessage(CDebugLogBase::ELogImportant,logText, error); |
|
345 } |
|
346 } |
|
347 |
|
348 /** |
|
349 Requests notification of change of the theme server orientation |
|
350 |
|
351 @Pre iThemeOrientationProperty has had Attach called on it |
|
352 */ |
|
353 void CWsRenderOrienationTracker::RequestDeviceOrientationNotification() |
|
354 { |
|
355 if(!IsActive()) |
|
356 { |
|
357 if (wsDebugLog) |
|
358 { |
|
359 _LIT(logText,"Orientation Tracker: Subscribing to theme orientation property"); |
|
360 wsDebugLog->MiscMessage(CDebugLogBase::ELogEverything,logText); |
|
361 } |
|
362 // Request for Theme Server Orientation P&S |
|
363 iThemeOrientationProperty.Subscribe(iStatus); |
|
364 SetActive(); |
|
365 } |
|
366 } |
|
367 |
|
368 /** |
|
369 Cancels and closes (detaches) from the theme orientation publish and subscribe |
|
370 */ |
|
371 void CWsRenderOrienationTracker::CancelDeviceOrientationNotification() |
|
372 { |
|
373 // Cancel Request for Theme Server Orientation P&S |
|
374 iThemeOrientationProperty.Cancel(); |
|
375 iThemeOrientationProperty.Close(); |
|
376 |
|
377 if (wsDebugLog) |
|
378 { |
|
379 _LIT(logText,"Orientation Tracker: Cancelled/closed theme orientation property"); |
|
380 wsDebugLog->MiscMessage(CDebugLogBase::ELogEverything,logText); |
|
381 } |
|
382 } |
|
383 |
|
384 /** |
|
385 Called when the theme servers orientation has changed. |
|
386 Re-requests unless cancelled |
|
387 */ |
|
388 void CWsRenderOrienationTracker::RunL() |
|
389 { |
|
390 TInt error = iStatus.Int(); |
|
391 if(KErrNone == error) |
|
392 { |
|
393 // Re-request |
|
394 RequestDeviceOrientationNotification(); |
|
395 |
|
396 TInt error = DoOrientationTracking(); |
|
397 if (wsDebugLog && KErrNone != error) |
|
398 { |
|
399 _LIT(logText,"Orientation Tracker: Error %d processing theme orientation property"); |
|
400 wsDebugLog->MiscMessage(CDebugLogBase::ELogImportant,logText, error); |
|
401 } |
|
402 } |
|
403 else if (wsDebugLog && KErrCancel != error) |
|
404 { |
|
405 _LIT(logText,"Orientation Tracker: Error %d from theme orientation property, not resubscribed"); |
|
406 wsDebugLog->MiscMessage(CDebugLogBase::ELogImportant,logText, error); |
|
407 } |
|
408 } |
|
409 |
|
410 /** |
|
411 Cancels the request for notification for changes to theme orientation |
|
412 */ |
|
413 void CWsRenderOrienationTracker::DoCancel() |
|
414 { |
|
415 CancelDeviceOrientationNotification(); |
|
416 } |
|
417 |
|
418 /** |
|
419 Gets the orientation published from theme server |
|
420 |
|
421 @param Output: the theme server orientation |
|
422 @return KErrNone if successful, KErrNotSupported if the theme server returns an unknown orientation, else any of the system wide error codes |
|
423 */ |
|
424 TInt CWsRenderOrienationTracker::GetThemeOrientation(TRenderOrientation& aThemeOrientation) |
|
425 { |
|
426 TInt themeOrientation=EDisplayOrientationNormal; |
|
427 TInt error = iThemeOrientationProperty.Get(themeOrientation); |
|
428 if(wsDebugLog && KErrNone != error) |
|
429 { |
|
430 _LIT(logText,"Orientation Tracker: Error %d getting theme orientation property"); |
|
431 wsDebugLog->MiscMessage(CDebugLogBase::ELogIntermediate,logText, error); |
|
432 } |
|
433 |
|
434 if(KErrNone == error) |
|
435 { |
|
436 // Translate the received orientation |
|
437 switch(themeOrientation) |
|
438 { |
|
439 case EDisplayOrientationNormal: |
|
440 case EDisplayOrientation90CW: |
|
441 case EDisplayOrientation180: |
|
442 case EDisplayOrientation270CW: |
|
443 // only update if orientation is supported |
|
444 aThemeOrientation = static_cast<TRenderOrientation>(themeOrientation); |
|
445 break; |
|
446 |
|
447 default: |
|
448 error = KErrNotSupported; |
|
449 if (wsDebugLog) |
|
450 { |
|
451 _LIT(logText,"Orientation Tracker: Unsupported orientation %d from theme orientation property, Error %d"); |
|
452 TBuf<LogTBufSize> buf; |
|
453 buf.Format(logText, themeOrientation, error); |
|
454 wsDebugLog->MiscMessage(CDebugLogBase::ELogIntermediate,buf); |
|
455 } |
|
456 break; |
|
457 } |
|
458 } |
|
459 return error; |
|
460 } |
|
461 |
|
462 /** |
|
463 Processes the indicated orientation into an actual orientation |
|
464 |
|
465 @return KErrNone for success, KErrNotSupported if the orientation is unknown, else any of the system wide error codes |
|
466 */ |
|
467 TInt CWsRenderOrienationTracker::DoOrientationTracking() |
|
468 { |
|
469 TInt error = KErrNone; |
|
470 TRenderOrientation newDeviceOrientation; |
|
471 switch(iRenderOrientationTrackingType) |
|
472 { |
|
473 case EDisplayOrientationNormal: |
|
474 case EDisplayOrientation90CW: |
|
475 case EDisplayOrientation180: |
|
476 case EDisplayOrientation270CW: |
|
477 newDeviceOrientation = iRenderOrientationTrackingType; |
|
478 break; |
|
479 |
|
480 case EDisplayOrientationAuto: |
|
481 error = GetThemeOrientation(newDeviceOrientation); |
|
482 break; |
|
483 |
|
484 default: |
|
485 error = KErrNotSupported; |
|
486 if (wsDebugLog) |
|
487 { |
|
488 _LIT(logText,"Orientation Tracker: Unsupported orientation tracking type %d, error %d"); |
|
489 TBuf<LogTBufSize> buf; |
|
490 buf.Format(logText, iRenderOrientationTrackingType, error); |
|
491 wsDebugLog->MiscMessage(CDebugLogBase::ELogIntermediate,buf); |
|
492 } |
|
493 break; |
|
494 } |
|
495 |
|
496 if(KErrNone == error) |
|
497 { |
|
498 error = PublishOrientation(newDeviceOrientation); |
|
499 } |
|
500 |
|
501 return error; |
|
502 } |
|
503 |
|
504 /** |
|
505 Publishes the given value |
|
506 |
|
507 @param The render orientation to publish |
|
508 @return KErrNone for success, else any of the system wide erro codes |
|
509 */ |
|
510 TInt CWsRenderOrienationTracker::DoPublishOrientation(const TRenderOrientation aRenderOrientation) |
|
511 { |
|
512 TInt error = iRenderOrientationPublisher.Set(aRenderOrientation); |
|
513 |
|
514 // if it's published OK, then remember the newly published value |
|
515 if(KErrNone == error) |
|
516 { |
|
517 iPublishedRenderOrientation = aRenderOrientation; |
|
518 if(wsDebugLog) |
|
519 { |
|
520 _LIT(logText,"Orientation Tracker: Published render orientation %d"); |
|
521 wsDebugLog->MiscMessage(CDebugLogBase::ELogEverything, logText, aRenderOrientation); |
|
522 } |
|
523 } |
|
524 else if(wsDebugLog) |
|
525 { |
|
526 _LIT(logText,"Orientation Tracker: Error %d setting render orientation property"); |
|
527 wsDebugLog->MiscMessage(CDebugLogBase::ELogIntermediate, logText, error); |
|
528 } |
|
529 return error; |
|
530 } |
|
531 |
|
532 void CWsRenderOrienationTracker::SetHALOrientation(const TRenderOrientation aRenderOrientation) |
|
533 { |
|
534 // If the render orientation is EDisplayOrientationAuto then don't update HAL |
|
535 // The application and HAL should always have the same state for the orientation. |
|
536 if(EDisplayOrientationAuto != aRenderOrientation) |
|
537 { |
|
538 TInt error = HAL::Set(CWsTop::CurrentFocusScreen()->ScreenNumber(), HALData::EDigitiserOrientation, WservToDigitiser(iPublishedRenderOrientation)); |
|
539 //Just log the error if there is one. |
|
540 if(wsDebugLog && error != KErrNone) |
|
541 { |
|
542 _LIT(logText,"Orientation Tracker: Error %d setting digitiser orientation"); |
|
543 wsDebugLog->MiscMessage(CDebugLogBase::ELogIntermediate, logText, error); |
|
544 } |
|
545 } |
|
546 } |
|
547 |
|
548 /** |
|
549 If the current orientation differs from the previously published value then publishes the current value |
|
550 |
|
551 @param The render orientation to check and publish |
|
552 @return KErrNone for success, else any of the system wide erro codes |
|
553 */ |
|
554 TInt CWsRenderOrienationTracker::PublishOrientation(const TRenderOrientation aRenderOrientation) |
|
555 { |
|
556 TInt error = KErrNone; |
|
557 |
|
558 if(aRenderOrientation != iPublishedRenderOrientation) |
|
559 { |
|
560 // If the device Orientation has changed, publish it |
|
561 error = DoPublishOrientation(aRenderOrientation); |
|
562 if(KErrNone == error) |
|
563 SetHALOrientation(aRenderOrientation); |
|
564 } |
|
565 return error; |
|
566 } |
|
567 |