skin: Key Window is docked when PhoneShapeSkin is moved
authorGiWoong Kim <giwoong.kim@samsung.com>
Mon, 15 Jul 2013 10:52:04 +0000 (19:52 +0900)
committerGiWoong Kim <giwoong.kim@samsung.com>
Mon, 15 Jul 2013 10:52:04 +0000 (19:52 +0900)
Key Window is docked when PhoneShapeSkin is moved

Change-Id: I2df17a62c814a91899a96dad40b7576a36cd29b0
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/EmulatorSkinMain.java
tizen/src/skin/client/src/org/tizen/emulator/skin/layout/PhoneShapeSkinComposer.java

index ef3f5be..6d2c7f1 100644 (file)
@@ -1262,7 +1262,7 @@ public class EmulatorSkin {
                final MenuItem scaleThreeQtrItem = new MenuItem(menu, SWT.RADIO);
                scaleThreeQtrItem.setText("3/4x");
                scaleThreeQtrItem.setData(Scale.SCALE_75);
-               scaleList.add( scaleThreeQtrItem );
+               scaleList.add(scaleThreeQtrItem);
 
                final MenuItem scalehalfItem = new MenuItem(menu, SWT.RADIO);
                scalehalfItem.setText("1/2x");
index d50a289..fe13555 100644 (file)
@@ -153,7 +153,7 @@ public class EmulatorSkinMain {
                                logger.severe("Fail to load skin information file.");
 
                                Shell temp = new Shell(Display.getDefault());
-                               MessageBox messageBox = new MessageBox( temp, SWT.ICON_ERROR );
+                               MessageBox messageBox = new MessageBox(temp, SWT.ICON_ERROR);
                                messageBox.setText("Emulator");
                                messageBox.setMessage("Fail to load \"" + SKIN_INFO_FILE_NAME + "\" file\n" +
                                                "Check if the file is corrupted or missing from the following path.\n" +
@@ -200,7 +200,7 @@ public class EmulatorSkinMain {
                        EmulatorConfig.validateSkinConfigProperties(configProperties);
 
                        /* load dbi file */
-                       EmulatorUI dbiContents = loadDbi(skinPath);
+                       EmulatorUI dbiContents = loadXMLForSkin(skinPath);
                        if (null == dbiContents) {
                                logger.severe("Fail to load dbi file.");
 
@@ -439,7 +439,7 @@ public class EmulatorSkinMain {
                return map;
        }
 
-       private static EmulatorUI loadDbi(String skinPath) {
+       private static EmulatorUI loadXMLForSkin(String skinPath) {
                String dbiPath = skinPath + File.separator + DBI_FILE_NAME;
                logger.info("load dbi file from " + dbiPath);
 
@@ -447,25 +447,22 @@ public class EmulatorSkinMain {
                EmulatorUI emulatorUI = null;
 
                try {
-                       
                        fis = new FileInputStream(dbiPath);
-                       logger.info( "============ dbi contents ============" );
-                       byte[] bytes = IOUtil.getBytes( fis );
-                       logger.info( new String( bytes, "UTF-8" ) );
-                       logger.info( "=======================================" );
-                       
-                       emulatorUI = JaxbUtil.unmarshal( bytes, EmulatorUI.class );
-                       
-               } catch ( IOException e ) {
-                       logger.log( Level.SEVERE, e.getMessage(), e );
-               } catch ( JaxbException e ) {
-                       logger.log( Level.SEVERE, e.getMessage(), e );
+                       logger.info("============ dbi contents ============");
+                       byte[] bytes = IOUtil.getBytes(fis);
+                       logger.info(new String(bytes, "UTF-8"));
+                       logger.info("=======================================");
+
+                       emulatorUI = JaxbUtil.unmarshal(bytes, EmulatorUI.class);
+               } catch (IOException e) {
+                       logger.log(Level.SEVERE, e.getMessage(), e);
+               } catch (JaxbException e) {
+                       logger.log(Level.SEVERE, e.getMessage(), e);
                } finally {
-                       IOUtil.close( fis );
+                       IOUtil.close(fis);
                }
 
                return emulatorUI;
-
        }
 
        private static Properties loadProperties( String filePath, boolean create ) {
index b1e8559..3413214 100644 (file)
@@ -333,6 +333,11 @@ public class PhoneShapeSkinComposer implements ISkinComposer {
                                        int y = previousLocation.y + (e.y - grabPosition.y);
 
                                        shell.setLocation(x, y);
+
+                                       if (skin.keyWindow != null) {
+                                               skin.keyWindow.redock(false, false);
+                                       }
+
                                        return;
                                }
 
@@ -394,6 +399,11 @@ public class PhoneShapeSkinComposer implements ISkinComposer {
                                        isGrabbedShell = false;
                                        grabPosition.x = grabPosition.y = 0;
 
+                                       if (skin.keyWindow != null) {
+                                               skin.keyWindow.redock(false, true);
+                                       }
+
+                                       /* HW key handling */
                                        HWKey pressedHWKey = currentState.getCurrentPressedHWKey();
                                        if (pressedHWKey == null) {
                                                return;
@@ -430,6 +440,7 @@ public class PhoneShapeSkinComposer implements ISkinComposer {
                                        grabPosition.x = e.x;
                                        grabPosition.y = e.y;
 
+                                       /* HW key handling */
                                        final HWKey hwKey = SkinUtil.getHWKey(e.x, e.y,
                                                        currentState.getCurrentRotationId(), currentState.getCurrentScale());
                                        if (hwKey == null) {