skin: close the key window
authorgiwoong.kim <giwoong.kim@samsung.com>
Thu, 6 Dec 2012 01:32:47 +0000 (10:32 +0900)
committergiwoong.kim <giwoong.kim@samsung.com>
Thu, 6 Dec 2012 05:19:57 +0000 (14:19 +0900)
Close the key window instead of making a
invisible shell.

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/layout/GeneralPurposeSkinComposer.java
tizen/src/skin/client/src/org/tizen/emulator/skin/window/ControlPanel.java

index c8db8619489bb2f94e4368e500beabc7b8a5d627..ad4b4b325ae809ac29069b561f9c523082709a4c 100644 (file)
@@ -186,6 +186,12 @@ public class EmulatorSkin {
                        SkinUtil.setTopMost(shell, true);
                }
 
+               /* generate a pair tag color of key window */
+               int red = (int) (Math.random() * 256);
+               int green = (int) (Math.random() * 256);
+               int blue = (int) (Math.random() * 256);
+               this.colorPairTag = new Color(shell.getDisplay(), new RGB(red, green, blue));
+
                this.currentState = state;
        }
 
@@ -352,7 +358,10 @@ public class EmulatorSkin {
                                                                cpShell.close();
                                                        }
                                                        controlPanel = null;
-                                                       colorPairTag.dispose();
+
+                                                       if (colorPairTag != null) {
+                                                               colorPairTag.dispose();
+                                                       }
                                                }
 
                                                /* save config only for emulator close */
@@ -914,10 +923,11 @@ public class EmulatorSkin {
                }
 
                try {
-                       controlPanel = new ControlPanel(shell, communicator, keyMapList);
+                       controlPanel = new ControlPanel(shell, colorPairTag,
+                                       communicator, keyMapList);
                        SkinUtil.setTopMost(controlPanel.getShell(), isOnTop);
 
-                       colorPairTag = controlPanel.getPairTagColor();
+                       //colorPairTag = controlPanel.getPairTagColor();
                        pairTagCanvas.setVisible(true);
 
                        controlPanel.open();
@@ -1011,8 +1021,13 @@ public class EmulatorSkin {
                                if (isControlPanel == true) {
                                        openKeyWindow((controlPanel == null) ?
                                                        true : controlPanel.isAttach());
-                               } else {
-                                       hideKeyWindow();
+                               } else { /* hide a key window */
+                                       if (controlPanel != null && controlPanel.isAttach()) {
+                                               pairTagCanvas.setVisible(false);
+                                               controlPanel.getShell().close();
+                                       } else {
+                                               hideKeyWindow();
+                                       }
                                }
                        }
                } );
index 6745f7c8cd4ac8e2f074cde9cbbfab0fc8332506..286332ef706a6f98d0bef2e758399ab9b9cfabca 100644 (file)
@@ -157,8 +157,9 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
                        @Override
                        public void mouseDown(MouseEvent e) {
                                if (skin.getIsControlPanel() == true) {
+                                       skin.controlPanel.getShell().close();
                                        skin.setIsControlPanel(false);
-                                       skin.hideKeyWindow();
+                                       skin.pairTagCanvas.setVisible(false);
                                } else {
                                        skin.setIsControlPanel(true);
                                        skin.openKeyWindow(true);
@@ -244,12 +245,12 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
                                lcdBounds.y + (lcdBounds.height / 2) - (toggleButton.getImageSize().y / 2),
                                toggleButton.getImageSize().x, toggleButton.getImageSize().y);
 
-               /* arrange the pair tag */
-               skin.pairTagCanvas.setBounds(26, 13, 8, 8);
-
                /* custom window shape */
                trimPatchedShell(shell, currentState.getCurrentImage());
 
+               /* arrange the pair tag */
+               skin.pairTagCanvas.setBounds(26, 13, 8, 8);
+
                /* set window size */
                if (currentState.getCurrentImage() != null) {
                        ImageData imageData = currentState.getCurrentImage().getImageData();
index bdf6f72934cffe9d4894c30c2c39289c933dcb98..d3f8e296ce3b8867a53e0ac3fb534e078e0d9313 100644 (file)
@@ -85,12 +85,13 @@ public class ControlPanel extends SkinWindow {
        private boolean isGrabbedShell;
        private Point grabPosition;
 
-       public ControlPanel(Shell parent,
+       public ControlPanel(Shell parent, Color colorPairTag,
                        SocketCommunicator communicator, List<KeyMapType> keyMapList) {
                super(parent, SWT.RIGHT | SWT.CENTER);
 
                this.shell = new Shell(Display.getDefault(), SWT.NO_TRIM | SWT.RESIZE);
                this.frameMaker = new SkinPatches(PATCH_IMAGES_PATH);
+               this.colorPairTag = colorPairTag;
 
                this.keyMapList = keyMapList;
                this.communicator = communicator;
@@ -116,11 +117,12 @@ public class ControlPanel extends SkinWindow {
                this.imageFrame = frameMaker.getPatchedImage(width, height);
                this.colorFrame = new Color(shell.getDisplay(), new RGB(38, 38, 38));
 
-               /* generate a pair tag color of key window */
-               int red = (int) (Math.random() * 256);
-               int green = (int) (Math.random() * 256);
-               int blue = (int) (Math.random() * 256);
-               this.colorPairTag = new Color(shell.getDisplay(), new RGB(red, green, blue));
+//             /* generate a pair tag color of key window */
+//             int red = (int) (Math.random() * 256);
+//             int green = (int) (Math.random() * 256);
+//             int blue = (int) (Math.random() * 256);
+//             this.colorPairTag = new Color(shell.getDisplay(), new RGB(red, green, blue));
+               this.colorPairTag = colorPairTag;
 
                createContents();
                trimPatchedShell(shell, imageFrame);
@@ -149,9 +151,11 @@ public class ControlPanel extends SkinWindow {
                pairTagCanvas.addPaintListener(new PaintListener() {
                        @Override
                        public void paintControl(PaintEvent e) {
-                               e.gc.setBackground(colorPairTag);
-                               e.gc.setAntialias(SWT.ON);
-                               e.gc.fillOval(0, 0, PAIRTAG_CIRCLE_SIZE, PAIRTAG_CIRCLE_SIZE);
+                               if (colorPairTag != null) {
+                                       e.gc.setBackground(colorPairTag);
+                                       e.gc.setAntialias(SWT.ON);
+                                       e.gc.fillOval(0, 0, PAIRTAG_CIRCLE_SIZE, PAIRTAG_CIRCLE_SIZE);
+                               }
                        }
                });
 
@@ -325,7 +329,6 @@ public class ControlPanel extends SkinWindow {
                                imageHover.dispose();
                                imagePushed.dispose();
                                colorFrame.dispose();
-                               colorPairTag.dispose();
 
                                frameMaker.freePatches();
                        }