skin: The window should not be hidden when rotate the Emulator
authorgiwoong.kim <giwoong.kim@samsung.com>
Fri, 18 Jan 2013 02:08:25 +0000 (11:08 +0900)
committergiwoong.kim <giwoong.kim@samsung.com>
Fri, 18 Jan 2013 02:33:53 +0000 (11:33 +0900)
The window should not be hidden when rotate the Emulator
for phone shape skin.

Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java
tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkinState.java
tizen/src/skin/client/src/org/tizen/emulator/skin/layout/GeneralPurposeSkinComposer.java
tizen/src/skin/client/src/org/tizen/emulator/skin/layout/PhoneShapeSkinComposer.java

index bea6de0..1aa4ac2 100644 (file)
@@ -1296,20 +1296,20 @@ public class EmulatorSkin {
                                shell.getDisplay().syncExec(new Runnable() {
                                        @Override
                                        public void run() {
-                                               Point location = new Point(100, 100);
-
-                                               if (skinInfo.isPhoneShape()) { /* TODO: */
-                                                       location = shell.getLocation();
-                                                       shell.setVisible(false);
-                                               }
+//                                             Point location = new Point(100, 100);
+//
+//                                             if (skinInfo.isPhoneShape()) { /* TODO: */
+//                                                     location = shell.getLocation();
+//                                                     shell.setVisible(false);
+//                                             }
 
                                                skinComposer.arrangeSkin(currentState.getCurrentScale(), rotationId);
 
-                                               if (skinInfo.isPhoneShape()) { /* TODO: */
-                                                       shell.setVisible(true);
-                                                       shell.setLocation(location);
-                                                       SkinUtil.setTopMost(shell, isOnTop);
-                                               }
+//                                             if (skinInfo.isPhoneShape()) { /* TODO: */
+//                                                     shell.setVisible(true);
+//                                                     shell.setLocation(location);
+//                                                     SkinUtil.setTopMost(shell, isOnTop);
+//                                             }
                                        }
                                });
 
@@ -1370,20 +1370,20 @@ public class EmulatorSkin {
                                shell.getDisplay().syncExec(new Runnable() {
                                        @Override
                                        public void run() {
-                                               Point location = new Point(100, 100);
-
-                                               if (skinInfo.isPhoneShape()) { /* TODO: */
-                                                       location = shell.getLocation();
-                                                       shell.setVisible(false);
-                                               }
+//                                             Point location = new Point(100, 100);
+//
+//                                             if (skinInfo.isPhoneShape()) { /* TODO: */
+//                                                     location = shell.getLocation();
+//                                                     shell.setVisible(false);
+//                                             }
 
                                                skinComposer.arrangeSkin(scale, currentState.getCurrentRotationId());
 
-                                               if (skinInfo.isPhoneShape()) { /* TODO: */
-                                                       shell.setVisible(true);
-                                                       shell.setLocation(location);
-                                                       SkinUtil.setTopMost(shell, isOnTop);
-                                               }
+//                                             if (skinInfo.isPhoneShape()) { /* TODO: */
+//                                                     shell.setVisible(true);
+//                                                     shell.setLocation(location);
+//                                                     SkinUtil.setTopMost(shell, isOnTop);
+//                                             }
                                        }
                                });
 
index d6c69c6..f9f94d1 100644 (file)
@@ -31,6 +31,7 @@ package org.tizen.emulator.skin;
 import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
 import org.tizen.emulator.skin.comm.ICommunicator.RotationInfo;
 import org.tizen.emulator.skin.layout.HWKey;
 
@@ -39,7 +40,10 @@ public class EmulatorSkinState {
        private int currentScale;
        private short currentRotationId;
        private int currentAngle;
-       private int maxtouchpoint;
+       private int maxTouchPoint;
+
+       private Rectangle displayBounds;
+       private boolean updateDisplayBounds;
 
        private Image currentImage;
        private Image currentKeyPressedImage;
@@ -53,6 +57,10 @@ public class EmulatorSkinState {
                this.currentScale = 50;
                this.currentRotationId = RotationInfo.PORTRAIT.id();
                this.currentAngle = 0;
+               this.maxTouchPoint = 0;
+
+               this.displayBounds = null;
+               this.updateDisplayBounds = false;
        }
 
        /* resolution */
@@ -114,6 +122,27 @@ public class EmulatorSkinState {
                this.currentAngle = angle;
        }
 
+       /* display bounds */
+       public synchronized Rectangle getDisplayBounds() {
+               if (displayBounds == null) {
+                       return new Rectangle(0, 0, 10, 10);
+               }
+
+               return displayBounds;
+       }
+
+       public synchronized void setDisplayBounds(Rectangle bounds) {
+               this.displayBounds = bounds;
+       }
+
+       public synchronized boolean isUpdateDisplayBounds() {
+               return updateDisplayBounds;
+       }
+
+       public synchronized void setUpdateDisplayBounds(boolean needUpdate) {
+               this.updateDisplayBounds = needUpdate;
+       }
+
        /* skin image */
        public synchronized Image getCurrentImage() {
                return currentImage;
@@ -157,12 +186,13 @@ public class EmulatorSkinState {
        public synchronized void setCurrentHoveredHWKey(HWKey hwKey) {
                this.currentHoveredHWKey = hwKey;
        }
+
        /* max touch point */
-       public synchronized void setMaxTouchPoint(int maxtouchpoint) {
-               this.maxtouchpoint = maxtouchpoint;
+       public synchronized void setMaxTouchPoint(int maxTouchPoint) {
+               this.maxTouchPoint = maxTouchPoint;
        }
-       
+
        public synchronized int getMaxTouchPoint() {
-               return this.maxtouchpoint;
+               return maxTouchPoint;
        }
 }
index 295cfaa..dbe18d5 100644 (file)
@@ -230,6 +230,7 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
                }
                logger.info("lcd bounds : " + lcdBounds);
 
+               currentState.setDisplayBounds(lcdBounds);
                lcdCanvas.setBounds(lcdBounds);
 
                /* arrange the skin image */
index e3c1e48..904035e 100644 (file)
@@ -182,7 +182,9 @@ public class PhoneShapeSkinComposer implements ISkinComposer {
                }
                logger.info("lcd bounds : " + lcdBounds);
 
-               lcdCanvas.setBounds(lcdBounds);
+               currentState.setDisplayBounds(lcdBounds);
+               currentState.setUpdateDisplayBounds(true);
+               //lcdCanvas.setBounds(lcdBounds);
 
                /* arrange the skin image */
                Image tempImage = null;
@@ -263,6 +265,11 @@ public class PhoneShapeSkinComposer implements ISkinComposer {
                shellPaintListener = new PaintListener() {
                        @Override
                        public void paintControl(final PaintEvent e) {
+                               if (currentState.isUpdateDisplayBounds() == true) {
+                                       currentState.setUpdateDisplayBounds(false);
+                                       lcdCanvas.setBounds(currentState.getDisplayBounds());
+                               }
+
                                /* general shell does not support native transparency,
                                 * so draw image with GC. */
                                if (currentState.getCurrentImage() != null) {