Hello,
I have been for a long time using the following code to create a custom floating window that is display on top of all other windows in the phone. This works on S60v2 and v3 devices. The problem is, on devices where multiple screen modes are available (E70 for example), the window is only visible in the first (portrait) mode. When I flip the device, it is not visible. It is also not visible when the application is started from the second (landscape) mode.
I understand that the windows and/or screen devices have to be manually set to the new screen mode, otherwise the window will not be show, as is described in Symbian documentation:
"When the screen mode changes, window groups that are incorrectly set up, according to these requirements, are locked out. The windows are notified of the change, and will be displayed if they are updated (according to the current enforcement requirement) to match the new screen mode."
The question is, how to update current window settings so that it is visible in the new screen mode?
My code is here, please note that I already do SetScreenSizeAndRotation and SetScreenMode:
User::LeaveIfError(iWsSession.Connect());
iWindowGroup = new(ELeave) RWindowGroup(iWsSession);
User::LeaveIfError(iWindowGroup->Construct((TUint32) iWindowGroup, EFalse));
iWindowGroup->EnableReceiptOfFocus(EFalse);
iWindowGroup->SetOrdinalPosition(1, ECoeWinPriorityAlwaysAtFront + 1);
iWindowGroup->EnableScreenChangeEvents();
iWindowGroup->SetNonFading(ETrue);
// Create window handle.
iWindow = new (ELeave) RWindow(iWsSession);
User::LeaveIfError(iWindow->Construct(*iWindowGroup, (TUint32) iWindow));
iWindow->Activate();
iWindow->SetExtent(UserInterfaceConfigurator::FloatingWindowRect().iTl,UserInterfaceConfigurator::FloatingWindowRect().Size());
iWindow->SetOrdinalPosition(1, ECoeWinPriorityAlwaysAtFront + 1);
iWindow->SetNonFading(ETrue);
iWindow->SetVisible(ETrue);
iVisible = ETrue;
// Get the screen device.
iScreenDevice = new (ELeave) CWsScreenDevice(iWsSession);
User::LeaveIfError(iScreenDevice->Construct());
TPixelsTwipsAndRotation defaultSizeAndRotation;
iScreenDevice->GetDefaultScreenSizeAndRotation( defaultSizeAndRotation);
iScreenDevice->SetScreenSizeAndRotation( defaultSizeAndRotation );
iScreenDevice->SetScreenMode( iScreenDevice->CurrentScreenMode() );
iScreenDevice->SetAppScreenMode( iScreenDevice->CurrentScreenMode() );
// Create graphics context from the screen device -> to draw splash screen.
User::LeaveIfError(iScreenDevice->CreateContext(iWindowGc));

Reply With Quote






