From b4e570c8fe9419dbf46ed523c08e0e0f74114e20 Mon Sep 17 00:00:00 2001 From: "giwoong.kim" Date: Fri, 18 Jan 2013 11:08:25 +0900 Subject: [PATCH] skin: The window should not be hidden when rotate the Emulator The window should not be hidden when rotate the Emulator for phone shape skin. Signed-off-by: GiWoong Kim --- .../src/org/tizen/emulator/skin/EmulatorSkin.java | 44 +++++++++++----------- .../org/tizen/emulator/skin/EmulatorSkinState.java | 40 +++++++++++++++++--- .../skin/layout/GeneralPurposeSkinComposer.java | 1 + .../skin/layout/PhoneShapeSkinComposer.java | 9 ++++- 4 files changed, 66 insertions(+), 28 deletions(-) diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java index bea6de0..1aa4ac2 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java @@ -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); +// } } }); diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkinState.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkinState.java index d6c69c6..f9f94d1 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkinState.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkinState.java @@ -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; } } diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/GeneralPurposeSkinComposer.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/GeneralPurposeSkinComposer.java index 295cfaa..dbe18d5 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/GeneralPurposeSkinComposer.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/GeneralPurposeSkinComposer.java @@ -230,6 +230,7 @@ public class GeneralPurposeSkinComposer implements ISkinComposer { } logger.info("lcd bounds : " + lcdBounds); + currentState.setDisplayBounds(lcdBounds); lcdCanvas.setBounds(lcdBounds); /* arrange the skin image */ diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/PhoneShapeSkinComposer.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/PhoneShapeSkinComposer.java index e3c1e48..904035e 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/PhoneShapeSkinComposer.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/PhoneShapeSkinComposer.java @@ -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) { -- 2.7.4