48 #include <javastoragenames.h> |
48 #include <javastoragenames.h> |
49 #include <javauid.h> |
49 #include <javauid.h> |
50 #include <javasymbianoslayer.h> |
50 #include <javasymbianoslayer.h> |
51 #ifdef RD_JAVA_S60_RELEASE_9_2 |
51 #ifdef RD_JAVA_S60_RELEASE_9_2 |
52 // Used with partial VKB |
52 // Used with partial VKB |
53 #include <aknpriv.hrh> |
53 #include <AknPriv.hrh> |
54 #endif // RD_JAVA_S60_RELEASE_9_2 |
54 #endif // RD_JAVA_S60_RELEASE_9_2 |
55 |
55 |
56 #include "javaoslayer.h" |
56 #include "javaoslayer.h" |
57 |
57 |
58 // Using constants for S60 LCDUI Plugin internal keys. |
58 // Using constants for S60 LCDUI Plugin internal keys. |
1087 TSize size = iViewRect.Size(); |
1087 TSize size = iViewRect.Size(); |
1088 TInt sizePacked = (size.iWidth << 16) | (size.iHeight); |
1088 TInt sizePacked = (size.iWidth << 16) | (size.iHeight); |
1089 |
1089 |
1090 PostEvent(EPaint, posPacked, sizePacked); |
1090 PostEvent(EPaint, posPacked, sizePacked); |
1091 } |
1091 } |
|
1092 |
|
1093 // If is added first direct content, then NGA is switched off |
|
1094 // and move of iViewRect is needed. |
|
1095 if (iFullScreen && iScalingOn && iDirectContents.Count() == 1) |
|
1096 { |
|
1097 iViewRect.Move(-iPositionRelativeToScreen); |
|
1098 } |
1092 #endif // RD_JAVA_NGA_ENABLED |
1099 #endif // RD_JAVA_NGA_ENABLED |
1093 } |
1100 } |
1094 |
1101 |
1095 |
1102 |
1096 // --------------------------------------------------------------------------- |
1103 // --------------------------------------------------------------------------- |
1108 { |
1115 { |
1109 iDirectContents.Remove(index); |
1116 iDirectContents.Remove(index); |
1110 if (iDirectContents.Count() == 0) |
1117 if (iDirectContents.Count() == 0) |
1111 { |
1118 { |
1112 iRestoreContentWhenUnfaded = EFalse; |
1119 iRestoreContentWhenUnfaded = EFalse; |
|
1120 #ifdef RD_JAVA_NGA_ENABLED |
|
1121 // If is removed last direct content, then NGA is switched on |
|
1122 // and move of iViewRect is needed. |
|
1123 if (iScalingOn && iFullScreen) |
|
1124 { |
|
1125 iViewRect.Move(iPositionRelativeToScreen); |
|
1126 } |
|
1127 #endif // RD_JAVA_NGA_ENABLED |
1113 } |
1128 } |
1114 } |
1129 } |
1115 } |
1130 } |
1116 |
1131 |
1117 |
1132 |
1459 CMIDDisplayable* CMIDCanvas::GetDisplayable() const |
1474 CMIDDisplayable* CMIDCanvas::GetDisplayable() const |
1460 { |
1475 { |
1461 return iDisplayable; |
1476 return iDisplayable; |
1462 } |
1477 } |
1463 #endif // RD_JAVA_S60_RELEASE_9_2 |
1478 #endif // RD_JAVA_S60_RELEASE_9_2 |
|
1479 |
1464 // --------------------------------------------------------------------------- |
1480 // --------------------------------------------------------------------------- |
1465 // CMIDCanvas::SetComponentIndexL |
1481 // CMIDCanvas::SetComponentIndexL |
1466 // Changes the index of the specified custom component. |
1482 // Changes the index of the specified custom component. |
1467 // (other items are commented in the header file) |
1483 // (other items are commented in the header file) |
1468 // --------------------------------------------------------------------------- |
1484 // --------------------------------------------------------------------------- |
1756 } |
1772 } |
1757 |
1773 |
1758 if (!IsEglAvailable()) |
1774 if (!IsEglAvailable()) |
1759 { |
1775 { |
1760 // No M3G content, use pixel source |
1776 // No M3G content, use pixel source |
1761 ActivatePixelSourceL(); |
1777 ActivatePixelSourceL(EFalse); |
1762 DEBUG("CMIDCanvas::Draw - Pixel Source activated"); |
1778 DEBUG("CMIDCanvas::Draw - Pixel Source activated"); |
1763 } |
1779 } |
1764 else // M3G content, use EGL surface |
1780 else // M3G content, use EGL surface |
1765 { |
1781 { |
1766 // Invalidates window so that wserv does not |
1782 // Invalidates window so that wserv does not |
2095 // --------------------------------------------------------------------------- |
2111 // --------------------------------------------------------------------------- |
2096 // |
2112 // |
2097 void CMIDCanvas::HandleResourceChange(TInt aType) |
2113 void CMIDCanvas::HandleResourceChange(TInt aType) |
2098 { |
2114 { |
2099 #ifdef RD_JAVA_S60_RELEASE_9_2 |
2115 #ifdef RD_JAVA_S60_RELEASE_9_2 |
2100 if ((aType == KEikInputLanguageChange) | |
2116 if ((aType == KAknSplitInputEnabled) | |
2101 (aType == KAknSplitInputEnabled) | |
|
2102 (aType == KAknSplitInputDisabled)) |
2117 (aType == KAknSplitInputDisabled)) |
|
2118 { |
|
2119 // We need inform CanvasItems that partial virtual keyboard |
|
2120 // is open or closed. This is needed only when partial VKB changes |
|
2121 // its state. |
|
2122 TBool partialVKBOpen = (aType == KAknSplitInputEnabled); |
|
2123 if (partialVKBOpen != iPartialVKBOpen) |
|
2124 { |
|
2125 iPartialVKBOpen = partialVKBOpen; |
|
2126 for (int i = 0; i < iCustomComponents.Count(); i++) |
|
2127 { |
|
2128 iCustomComponents[i]->HandleResourceChange(aType); |
|
2129 } |
|
2130 } |
|
2131 } |
|
2132 else if (aType == KEikInputLanguageChange) |
2103 #else |
2133 #else |
2104 if (aType == KEikInputLanguageChange) |
2134 if (aType == KEikInputLanguageChange) |
2105 #endif // RD_JAVA_S60_RELEASE_9_2 |
2135 #endif // RD_JAVA_S60_RELEASE_9_2 |
2106 { |
2136 { |
|
2137 // We need inform TextEditor that input language is changed. |
2107 if ((iFocusedComponent != KComponentFocusedNone) && |
2138 if ((iFocusedComponent != KComponentFocusedNone) && |
2108 (iFocusedComponent < iCustomComponents.Count())) |
2139 (iFocusedComponent < iCustomComponents.Count())) |
2109 { |
2140 { |
2110 iCustomComponents[iFocusedComponent]-> |
2141 iCustomComponents[iFocusedComponent]-> |
2111 CustomComponentControl(KComponentMainControl)-> |
2142 CustomComponentControl(KComponentMainControl)-> |
2112 HandleResourceChange(aType); |
2143 HandleResourceChange(aType); |
2113 } |
2144 } |
2114 } |
2145 |
2115 if (aType == KEikDynamicLayoutVariantSwitch) |
2146 } |
|
2147 else if (aType == KEikDynamicLayoutVariantSwitch) |
2116 { |
2148 { |
2117 // If orientation change is done, |
2149 // If orientation change is done, |
2118 // then we have to inform all components about it. |
2150 // then we have to inform all components about it. |
2119 if (iFullScreen && iScalingOn) |
2151 if (iFullScreen && iScalingOn) |
2120 { |
2152 { |
2121 for (int i = 0; i < iCustomComponents.Count(); i++) |
2153 for (int i = 0; i < iCustomComponents.Count(); i++) |
2122 { |
2154 { |
2123 iCustomComponents[i]->HandleResolutionChange(); |
2155 iCustomComponents[i]->HandleResourceChange(aType); |
2124 } |
2156 } |
2125 } |
2157 } |
2126 } |
2158 } |
2127 else if ((aType == KEikMessageUnfadeWindows) || |
2159 else if ((aType == KEikMessageUnfadeWindows) || |
2128 (aType == KEikMessageFadeAllWindows)) |
2160 (aType == KEikMessageFadeAllWindows)) |
2286 // |
2318 // |
2287 // iViewRect.iTl -> (0, 0) |
2319 // iViewRect.iTl -> (0, 0) |
2288 // iViewRect.iBr - TSize(1, 1) -> (iContentSize.iWidth - 1, |
2320 // iViewRect.iBr - TSize(1, 1) -> (iContentSize.iWidth - 1, |
2289 // iContentSize.iHeight - 1) |
2321 // iContentSize.iHeight - 1) |
2290 point -= iViewRect.iTl; |
2322 point -= iViewRect.iTl; |
2291 |
2323 |
2292 #ifdef RD_JAVA_NGA_ENABLED |
2324 #ifdef RD_JAVA_NGA_ENABLED |
2293 if (iFullScreen && iScalingOn) |
2325 // If NGA is started and scaling is on then the drawing rectangle |
|
2326 // is moved. Them we need move pointer events too. |
|
2327 if (iFullScreen && iScalingOn && iDirectContents.Count() == 0) |
2294 { |
2328 { |
2295 // Fix coordinates |
2329 // Fix coordinates |
2296 point += iPositionRelativeToScreen; |
2330 point += iPositionRelativeToScreen; |
2297 } |
2331 } |
2298 #endif // RD_JAVA_NGA_ENABLED |
2332 #endif // RD_JAVA_NGA_ENABLED |
2430 } |
2464 } |
2431 } |
2465 } |
2432 |
2466 |
2433 // To have cursor on focused control. |
2467 // To have cursor on focused control. |
2434 if ((iFocusedComponent != KComponentFocusedNone) && |
2468 if ((iFocusedComponent != KComponentFocusedNone) && |
2435 (iFocusedComponent < iCustomComponents.Count())) |
2469 (iFocusedComponent < iCustomComponents.Count()) && |
|
2470 iCustomComponents[iFocusedComponent]-> |
|
2471 CustomComponentControl(KComponentMainControl)->IsVisible()) |
2436 { |
2472 { |
2437 iCustomComponents[iFocusedComponent]-> |
2473 iCustomComponents[iFocusedComponent]-> |
2438 CustomComponentControl(KComponentMainControl)-> |
2474 CustomComponentControl(KComponentMainControl)-> |
2439 SetFocus(ETrue); |
2475 SetFocus(ETrue); |
2440 } |
2476 } |
2441 |
2477 |
2442 #ifdef RD_JAVA_NGA_ENABLED |
2478 #ifdef RD_JAVA_NGA_ENABLED |
2443 // To avoid situation when Canvas is redrawn but black area remains |
2479 // To avoid situation when Canvas is redrawn but black area remains |
2444 if (iAlfCompositionPixelSource) |
2480 if (iAlfCompositionPixelSource) |
2445 { |
2481 { |
2446 TRAPD(err, ActivatePixelSourceL()); |
2482 TRAPD(err, ActivatePixelSourceL(EFalse)); |
2447 if (err != KErrNone) |
2483 if (err != KErrNone) |
2448 { |
2484 { |
2449 DEBUG_INT("CMIDCanvas::FocusChanged - ActivatePixelSourceL error %d", err); |
2485 DEBUG_INT("CMIDCanvas::FocusChanged - ActivatePixelSourceL error %d", err); |
2450 } |
2486 } |
2451 } |
2487 } |
2472 { |
2508 { |
2473 iDirectContents[j]->MdcContainerVisibilityChanged(EFalse); |
2509 iDirectContents[j]->MdcContainerVisibilityChanged(EFalse); |
2474 } |
2510 } |
2475 } |
2511 } |
2476 |
2512 |
2477 // To cursor on focused control. |
2513 // To remove cursor on focused control. |
2478 if ((iFocusedComponent != KComponentFocusedNone) && |
2514 if ((iFocusedComponent != KComponentFocusedNone) && |
2479 (iFocusedComponent < iCustomComponents.Count())) |
2515 (iFocusedComponent < iCustomComponents.Count()) && |
|
2516 iCustomComponents[iFocusedComponent]-> |
|
2517 CustomComponentControl(KComponentMainControl)->IsVisible()) |
2480 { |
2518 { |
2481 iCustomComponents[iFocusedComponent]-> |
2519 iCustomComponents[iFocusedComponent]-> |
2482 CustomComponentControl(KComponentMainControl)-> |
2520 CustomComponentControl(KComponentMainControl)-> |
2483 SetFocus(EFalse); |
2521 SetFocus(EFalse); |
2484 } |
2522 } |
2522 { |
2560 { |
2523 iOldContentBounds = contentBounds; |
2561 iOldContentBounds = contentBounds; |
2524 |
2562 |
2525 TSize contentSize; |
2563 TSize contentSize; |
2526 |
2564 |
|
2565 #ifdef RD_JAVA_S60_RELEASE_9_2 |
|
2566 if (iFullScreen && (orientedOrgMIDletScrSize != controlSize) |
|
2567 && !iPartialVKBOpen) |
|
2568 #else |
2527 if (iFullScreen && (orientedOrgMIDletScrSize != controlSize)) |
2569 if (iFullScreen && (orientedOrgMIDletScrSize != controlSize)) |
|
2570 #endif // RD_JAVA_S60_RELEASE_9_2 |
2528 { |
2571 { |
2529 contentSize = orientedOrgMIDletScrSize; |
2572 contentSize = orientedOrgMIDletScrSize; |
2530 } |
2573 } |
2531 |
2574 |
2532 if (contentSize == KZeroSize) |
2575 if (contentSize == KZeroSize) |
2908 i3DAccelerated = |
2951 i3DAccelerated = |
2909 iEnv.IsHardwareAcceleratedL(MMIDEnv::EHardware3D) > 0; |
2952 iEnv.IsHardwareAcceleratedL(MMIDEnv::EHardware3D) > 0; |
2910 |
2953 |
2911 InitPixelSourceL(); |
2954 InitPixelSourceL(); |
2912 #endif // RD_JAVA_NGA_ENABLED |
2955 #endif // RD_JAVA_NGA_ENABLED |
|
2956 |
|
2957 #ifdef RD_JAVA_S60_RELEASE_9_2 |
|
2958 iPartialVKBOpen = EFalse; |
|
2959 #endif // RD_JAVA_S60_RELEASE_9_2 |
2913 } |
2960 } |
2914 |
2961 |
2915 |
2962 |
2916 // --------------------------------------------------------------------------- |
2963 // --------------------------------------------------------------------------- |
2917 // CMIDCanvas::SetContainerWindowL |
2964 // CMIDCanvas::SetContainerWindowL |
3140 TSize viewSize; |
3187 TSize viewSize; |
3141 |
3188 |
3142 if (iFullScreen) |
3189 if (iFullScreen) |
3143 { |
3190 { |
3144 #ifdef RD_JAVA_NGA_ENABLED |
3191 #ifdef RD_JAVA_NGA_ENABLED |
3145 if (iScalingOn) |
3192 // If both NGA and scaling are on, then iViewRect is needed move |
|
3193 // for preverifing wrong position of Canvas. |
|
3194 if (iScalingOn && (!iFullScreen || iDirectContents.Count() == 0)) |
3146 { |
3195 { |
3147 // Translate to screen coordinates. |
3196 // Translate to screen coordinates. |
3148 rect.Move(iPositionRelativeToScreen); |
3197 rect.Move(iPositionRelativeToScreen); |
3149 } |
3198 } |
3150 #endif // RD_JAVA_NGA_ENABLED |
3199 #endif // RD_JAVA_NGA_ENABLED |
3163 // scaled to that size. |
3212 // scaled to that size. |
3164 if (iTargetMIDletScrSize != KZeroSize) |
3213 if (iTargetMIDletScrSize != KZeroSize) |
3165 { |
3214 { |
3166 viewSize = iTargetMIDletScrSize; |
3215 viewSize = iTargetMIDletScrSize; |
3167 } |
3216 } |
|
3217 |
|
3218 #ifdef RD_JAVA_S60_RELEASE_9_2 |
|
3219 // If partial VKB is open then MIDlet is not scaled. |
|
3220 // That we need set iViewRect to whole size of Canvas. |
|
3221 if (iPartialVKBOpen) |
|
3222 { |
|
3223 viewSize = Size(); |
|
3224 } |
|
3225 #endif //RD_JAVA_S60_RELEASE_9_2 |
3168 |
3226 |
3169 // If optional JAD parameter Nokia-MIDlet-Target-Display-Size is NOT |
3227 // If optional JAD parameter Nokia-MIDlet-Target-Display-Size is NOT |
3170 // defined and Nokia-MIDlet-Original-Display-Size is defined to |
3228 // defined and Nokia-MIDlet-Original-Display-Size is defined to |
3171 // smaller size than the device's screen size, we will scale the |
3229 // smaller size than the device's screen size, we will scale the |
3172 // Canvas to fit the screen without changing aspect ratio. |
3230 // Canvas to fit the screen without changing aspect ratio. |
3599 // --------------------------------------------------------------------------- |
3657 // --------------------------------------------------------------------------- |
3600 // CMIDCanvas::ActivatePixelSourceL |
3658 // CMIDCanvas::ActivatePixelSourceL |
3601 // In scaling case need to call SetExtent() again if pixel source was suspended. |
3659 // In scaling case need to call SetExtent() again if pixel source was suspended. |
3602 // --------------------------------------------------------------------------- |
3660 // --------------------------------------------------------------------------- |
3603 // |
3661 // |
3604 void CMIDCanvas::ActivatePixelSourceL() |
3662 void CMIDCanvas::ActivatePixelSourceL(TBool aDrawingOngoing) |
3605 { |
3663 { |
3606 ASSERT(iAlfCompositionPixelSource); |
3664 ASSERT(iAlfCompositionPixelSource); |
3607 |
3665 |
3608 if (iDirectContents.Count() > 0) |
3666 if (iDirectContents.Count() > 0) |
3609 { |
3667 { |