javauis/lcdui_qt/src/javax/microedition/lcdui/Canvas.java
changeset 61 bf7ee68962da
parent 48 e0d6e9bd3ca7
child 79 2f468c1958d0
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/Canvas.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/Canvas.java	Wed Aug 18 09:43:15 2010 +0300
@@ -28,7 +28,6 @@
 import org.eclipse.swt.widgets.*;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.extension.CompositeExtension;
 import org.eclipse.swt.internal.qt.graphics.WindowSurface;
 import org.eclipse.swt.internal.extension.MobileShellExtension;
 import org.eclipse.swt.internal.qt.SymbianWindowVisibilityListener;
@@ -191,7 +190,6 @@
     //private Composite keypadComposite;
     private CanvasKeypad onScreenkeypad;
     private static CanvasKeypad sharedKeypad;
-    private int oskHeight;
 
     // Vector of flags that a certain key was pressed but was not released.
     // Used to implement keyRepeated since eSWT does not support
@@ -372,7 +370,7 @@
     Composite eswtConstructContent(int style)
     {
         // Get JAD attribute
-        setMode(NO_BACKGROUND, JadAttributeUtil.isValue(JadAttributeUtil.ATTRIB_NOKIA_UI_ENHANCEMENT,
+        setMode(NO_BACKGROUND, !JadAttributeUtil.isValue(JadAttributeUtil.ATTRIB_NOKIA_UI_ENHANCEMENT,
                                                 JadAttributeUtil.VALUE_CANVAS_HAS_BACKGROUND));
         if(isMode(NO_BACKGROUND))
         {
@@ -434,11 +432,12 @@
         canvasComp.setVisible(false);
 
         createOnScreenKeypad();
+        return canvasComp;
+    }
 
+    void eswtInitGraphics() {
         // create graphics buffer
-        graphicsBuffer = Buffer.createInstance(this, canvasComp);
-
-        return canvasComp;
+       graphicsBuffer = Buffer.createInstance(this, canvasComp);
     }
 
     /**
@@ -753,26 +752,6 @@
     {
         return KeyTable.getKeyName(keyCode);
     }
-    /**
-     * Gets height.
-     *
-     * @return Height of the Displayable in pixels.
-     */
-    public int getHeight()
-    {
-        ESWTUIThreadRunner.syncExec(new Runnable()
-        {
-            public void run()
-            {
-                if(onScreenkeypad != null)
-                {
-                    oskHeight = onScreenkeypad.getHeight();
-                }
-            }
-        });
-        return (super.getHeight() - oskHeight);
-
-    }
 
     /**
      * Callback to be implemented by the application to render the
@@ -1563,9 +1542,11 @@
     class CanvasShellVisibilityListener implements SymbianWindowVisibilityListener
     {
         public void handleSymbianWindowVisibilityChange(Widget widget, boolean visible) {
-            if (javax.microedition.lcdui.Canvas.this.getShell() == widget)
+            if (javax.microedition.lcdui.Canvas.this.getShell() == widget && graphicsBuffer != null)
             {
-                graphicsBuffer.getWindowSurface().handleSymbianWindowVisibilityChange(visible);
+                WindowSurface surface = graphicsBuffer.getWindowSurface();
+                if (surface != null)
+                    surface.handleSymbianWindowVisibilityChange(visible);
             }
         }
     }