77 |
81 |
78 CActiveScheduler *ac = new (ELeave) CActiveScheduler; |
82 CActiveScheduler *ac = new (ELeave) CActiveScheduler; |
79 CActiveScheduler::Install(ac); |
83 CActiveScheduler::Install(ac); |
80 iTimer = CHighResTimer::NewL(TCallBack(TimerFunc, this),CActive::EPriorityStandard); |
84 iTimer = CHighResTimer::NewL(TCallBack(TimerFunc, this),CActive::EPriorityStandard); |
81 iThemeRepositoryListener = CThemeRepositoryListener::NewL(&iRunning); |
85 iThemeRepositoryListener = CThemeRepositoryListener::NewL(&iRunning); |
|
86 #if !defined(SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS) |
82 iSCPropertyListener = CScreenSaverPropertyListener::NewL(TCallBack(ScreenSaverCallback, this)); |
87 iSCPropertyListener = CScreenSaverPropertyListener::NewL(TCallBack(ScreenSaverCallback, this)); |
|
88 #endif |
83 |
89 |
84 CreateWindowL(); |
90 CreateWindowL(); |
85 |
91 |
|
92 User::LeaveIfError(iSkinSrv.Connect()); |
86 // load the initial plugin |
93 // load the initial plugin |
|
94 GetPluginConfigurationL(); |
87 LoadPluginL(); |
95 LoadPluginL(); |
88 InitEGLL(); |
96 InitEGLL(); |
89 CreateWindowSurfaceL(); |
97 CreateWindowSurfaceL(); |
90 |
98 |
91 User::LeaveIfError(iPlugin->gpuresourcesavailable(1)); |
99 User::LeaveIfError(iPlugin->gpuresourcesavailable(1)); |
92 iThemeRepositoryListener->IssueRequest(); |
100 iThemeRepositoryListener->IssueRequest(); |
|
101 #if !defined(SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS) |
93 iSCPropertyListener->IssueRequest(); |
102 iSCPropertyListener->IssueRequest(); |
|
103 #endif |
94 } |
104 } |
95 |
105 |
96 void CBgAnimHost::CreateWindowL() |
106 void CBgAnimHost::CreateWindowL() |
97 { |
107 { |
98 iScreenDevice = new (ELeave) CWsScreenDevice(iWsSession); |
108 iScreenDevice = new (ELeave) CWsScreenDevice(iWsSession); |
383 iCompSource->SetExtent(TRect(TPoint(0,0),iRealDisplaySize),0); |
393 iCompSource->SetExtent(TRect(TPoint(0,0),iRealDisplaySize),0); |
384 break; |
394 break; |
385 } |
395 } |
386 else |
396 else |
387 { |
397 { |
388 User::After(5000000); |
398 User::After(1000000); |
389 } |
399 } |
390 } |
400 } |
391 |
401 |
392 iSurfaceInitialized = ETrue; |
402 iSurfaceInitialized = ETrue; |
393 |
403 |
394 } |
404 } |
395 |
405 |
396 void CBgAnimHost::LoadPluginL() |
406 TBool CBgAnimHost::GetPluginConfigurationL() |
397 { |
407 { |
398 // dig out the skin config from skin server |
408 // dig out the skin config from skin server |
399 HBufC* configstr = NULL; |
409 HBufC* configstr = NULL; |
400 RAknsSrvSession skinsrv; |
410 CAknsSrvChunkLookup* cl = iSkinSrv.CreateChunkLookupL(); |
401 User::LeaveIfError(skinsrv.Connect()); |
|
402 CleanupClosePushL(skinsrv); |
|
403 CAknsSrvChunkLookup* cl = skinsrv.CreateChunkLookupL(); |
|
404 CleanupStack::PushL(cl); |
411 CleanupStack::PushL(cl); |
405 CAknsStringItemDef* configitem = static_cast<CAknsStringItemDef*>(cl->LookupAndCreateDefL( KAknsIIDPropertyAnimBgParam )); |
412 CAknsStringItemDef* configitem = static_cast<CAknsStringItemDef*>(cl->LookupAndCreateDefL( KAknsIIDPropertyAnimBgParam )); |
406 User::LeaveIfNull(configitem); |
413 User::LeaveIfNull(configitem); |
407 CleanupStack::PushL(configitem); |
414 CleanupStack::PushL(configitem); |
408 configstr = configitem->String().AllocL(); |
415 configstr = configitem->String().AllocL(); |
409 CleanupStack::PopAndDestroy(3); // skinsrv, cl, configitem |
416 CleanupStack::PopAndDestroy(2); // cl, configitem |
410 CleanupStack::PushL(configstr); |
417 CleanupStack::PushL(configstr); |
411 RDebug::Print(_L("----------------------")); |
|
412 RDebug::Print(_L("backgroundhost config:")); |
|
413 RDebug::Print(*configstr); |
|
414 RDebug::Print(_L("----------------------")); |
|
415 |
418 |
416 TLex lex(*configstr); |
419 TLex lex(*configstr); |
417 TPtrC dllname = lex.NextToken(); |
420 HBufC* dllname = lex.NextToken().AllocL(); |
418 if (!dllname.Length()) |
421 CleanupStack::PushL(dllname); |
|
422 if (!dllname || !dllname->Length()) |
419 { |
423 { |
420 User::Leave(KErrNotFound); |
424 User::Leave(KErrNotFound); |
421 } |
425 } |
422 |
426 |
423 User::LeaveIfError(iPluginLibrary.Load(dllname)); |
427 HBufC* assetdir = lex.NextToken().AllocL(); |
|
428 CleanupStack::PushL(assetdir); |
|
429 if (!assetdir || !assetdir->Length()) |
|
430 { |
|
431 User::Leave(KErrNotFound); |
|
432 } |
|
433 |
|
434 TBool confchanged = EFalse; |
|
435 if (!iCurrentPluginDllName || !iCurrentPluginAssetDir || |
|
436 (iCurrentPluginDllName && !iCurrentPluginDllName->CompareF(*dllname)) || |
|
437 (iCurrentPluginAssetDir && !iCurrentPluginAssetDir->CompareF(*assetdir)) ) |
|
438 |
|
439 { |
|
440 confchanged = ETrue; |
|
441 delete iCurrentPluginDllName; |
|
442 delete iCurrentPluginAssetDir; |
|
443 iCurrentPluginDllName = dllname; |
|
444 iCurrentPluginAssetDir = assetdir; |
|
445 CleanupStack::Pop(2); // dllname, assetdir |
|
446 } |
|
447 else |
|
448 { |
|
449 CleanupStack::PopAndDestroy(2); // dllname, assetdir |
|
450 } |
|
451 |
|
452 CleanupStack::PopAndDestroy(); // configstr |
|
453 |
|
454 return confchanged; |
|
455 } |
|
456 |
|
457 void CBgAnimHost::LoadPluginL() |
|
458 { |
|
459 User::LeaveIfError(iPluginLibrary.Load(*iCurrentPluginDllName)); |
424 plugingetinterfacefunc getif = (plugingetinterfacefunc)iPluginLibrary.Lookup(1); |
460 plugingetinterfacefunc getif = (plugingetinterfacefunc)iPluginLibrary.Lookup(1); |
425 if (!getif) |
461 if (!getif) |
426 { |
462 { |
427 iPluginLibrary.Close(); |
463 iPluginLibrary.Close(); |
428 User::Leave(KErrNotFound); |
464 User::Leave(KErrNotFound); |
429 } |
465 } |
430 |
466 |
431 iPlugin = (plugin_export_v1_t*) getif(1); |
467 iPlugin = (plugin_export_v1_t*) getif(1); |
432 |
468 |
433 TPtrC configpath = lex.NextToken(); |
|
434 if (!configpath.Length()) |
|
435 { |
|
436 User::Leave(KErrNotFound); |
|
437 } |
|
438 TBuf8<256> pluginpath; |
469 TBuf8<256> pluginpath; |
439 pluginpath.Copy(configpath); |
470 pluginpath.Copy(*iCurrentPluginAssetDir); |
440 User::LeaveIfError(iPlugin->initialize((const char*)pluginpath.PtrZ(), KMaxGPUMemUsage)); |
471 User::LeaveIfError(iPlugin->initialize((const char*)pluginpath.PtrZ(), KMaxGPUMemUsage)); |
441 |
472 |
442 // } |
|
443 // else |
|
444 // { |
|
445 // User::LeaveIfError(iPlugin->initialize("z:\\private\\200286D3", KMaxGPUMemUsage)); |
|
446 // } |
|
447 |
|
448 CleanupStack::PopAndDestroy(); // configstr |
|
449 |
|
450 iPlugin->setdisplaydimensions(iDisplaySize.iWidth, iDisplaySize.iHeight); |
473 iPlugin->setdisplaydimensions(iDisplaySize.iWidth, iDisplaySize.iHeight); |
451 if (iPlugin->desiredsensors && iPlugin->receivesensordata) |
474 if (iPlugin->desiredsensors && iPlugin->receivesensordata) |
452 { |
475 { |
453 const unsigned int* sensors = iPlugin->desiredsensors(); |
476 const unsigned int* sensors = iPlugin->desiredsensors(); |
454 while (*sensors) |
477 while (*sensors) |
571 } |
615 } |
572 } |
616 } |
573 |
617 |
574 void CBgAnimHost::HandleScreenSaverEvent() |
618 void CBgAnimHost::HandleScreenSaverEvent() |
575 { |
619 { |
576 RDebug::Print(_L("-----------------------------------")); |
620 #if !defined(SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS) |
577 RDebug::Print(_L("CBgAnimHost::HandleScreenSaverEvent")); |
|
578 TInt scStatus = iSCPropertyListener->GetScreenSaverStatus(); |
621 TInt scStatus = iSCPropertyListener->GetScreenSaverStatus(); |
579 RDebug::Print(_L("status: %d, timerrunning %d, surfacecreated %d"),scStatus, iTimerRunning, iSurfaceInitialized); |
|
580 RDebug::Print(_L("-----------------------------------")); |
|
581 if (scStatus) |
622 if (scStatus) |
582 { |
623 { |
583 // screensaver is ON |
624 // screensaver is ON |
584 if (iTimerRunning) |
625 if (iTimerRunning) |
585 { |
626 { |
586 RDebug::Print(_L("--- screensaver on, stopping timer ---")); |
|
587 iTimer->Cancel(); |
627 iTimer->Cancel(); |
588 iTimerRunning = EFalse; |
628 iTimerRunning = EFalse; |
589 } |
629 } |
590 } |
630 } |
591 else |
631 else |
592 { |
632 { |
593 // screensaver is OFF |
633 // screensaver is OFF |
594 if (!iTimerRunning && iSurfaceInitialized) |
634 if (!iTimerRunning && iSurfaceInitialized) |
595 { |
635 { |
596 RDebug::Print(_L("--- screensaver off, starting timer ---")); |
|
597 |
|
598 iTimerRunning = ETrue; |
636 iTimerRunning = ETrue; |
599 iTimer->CallBack(1); |
637 iTimer->CallBack(1); |
600 } |
638 } |
601 } |
639 } |
|
640 #endif |
602 } |
641 } |
603 |
642 |
604 TInt CBgAnimHost::ScreenSaverCallback(TAny* aPtr) |
643 TInt CBgAnimHost::ScreenSaverCallback(TAny* aPtr) |
605 { |
644 { |
606 CBgAnimHost* me = (CBgAnimHost*) aPtr; |
645 CBgAnimHost* me = (CBgAnimHost*) aPtr; |