From: giwoong.kim Date: Fri, 5 Oct 2012 07:35:36 +0000 (+0900) Subject: skin: added focus listener X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.1~1422 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=69057ec7726fce9bac6433e9c8f1ebb004c0fee3;p=sdk%2Femulator%2Fqemu.git skin: added focus listener Regist a focus listener for emulator window And restore some code line Signed-off-by: GiWoong Kim --- 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 5936915431..2203a584c6 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 @@ -43,6 +43,8 @@ import java.util.logging.Level; import java.util.logging.Logger; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.FocusEvent; +import org.eclipse.swt.events.FocusListener; import org.eclipse.swt.events.KeyEvent; import org.eclipse.swt.events.KeyListener; import org.eclipse.swt.events.MenuDetectEvent; @@ -543,7 +545,7 @@ public class EmulatorSkin { shell.addPaintListener( shellPaintListener ); - /* FocusListener shellFocusListener = new FocusListener() { + FocusListener shellFocusListener = new FocusListener() { @Override public void focusGained(FocusEvent event) { logger.info("gain focus"); @@ -554,7 +556,7 @@ public class EmulatorSkin { } }; - lcdCanvas.addFocusListener(shellFocusListener); */ + lcdCanvas.addFocusListener(shellFocusListener); shellMouseTrackListener = new MouseTrackAdapter() { @Override @@ -835,21 +837,21 @@ public class EmulatorSkin { if ( e.x < 0 ) { e.x = 0; - eventType = MouseEventType.UP.value(); + eventType = MouseEventType.RELEASE.value(); EmulatorSkin.this.isDragStartedInLCD = false; } else if ( e.x >= canvasSize.x ) { e.x = canvasSize.x - 1; - eventType = MouseEventType.UP.value(); + eventType = MouseEventType.RELEASE.value(); EmulatorSkin.this.isDragStartedInLCD = false; } if ( e.y < 0 ) { e.y = 0; - eventType = MouseEventType.UP.value(); + eventType = MouseEventType.RELEASE.value(); EmulatorSkin.this.isDragStartedInLCD = false; } else if ( e.y >= canvasSize.y ) { e.y = canvasSize.y - 1; - eventType = MouseEventType.UP.value(); + eventType = MouseEventType.RELEASE.value(); EmulatorSkin.this.isDragStartedInLCD = false; } @@ -878,7 +880,7 @@ public class EmulatorSkin { logger.info( "mouseUp in LCD" + " x:" + geometry[0] + " y:" + geometry[1] ); MouseEventData mouseEventData = new MouseEventData( - MouseButtonType.LEFT.value(), MouseEventType.UP.value(), + MouseButtonType.LEFT.value(), MouseEventType.RELEASE.value(), e.x, e.y, geometry[0], geometry[1], 0); communicator.sendToQEMU( SendCommand.SEND_MOUSE_EVENT, mouseEventData ); @@ -899,7 +901,7 @@ public class EmulatorSkin { logger.info( "mouseDown in LCD" + " x:" + geometry[0] + " y:" + geometry[1] ); MouseEventData mouseEventData = new MouseEventData( - MouseButtonType.LEFT.value(), MouseEventType.DOWN.value(), + MouseButtonType.LEFT.value(), MouseEventType.PRESS.value(), e.x, e.y, geometry[0], geometry[1], 0); communicator.sendToQEMU( SendCommand.SEND_MOUSE_EVENT, mouseEventData ); @@ -1809,14 +1811,15 @@ public class EmulatorSkin { ProcessBuilder procSdb = new ProcessBuilder(); - if ( SwtUtil.isLinuxPlatform() ) { - procSdb.command( "/usr/bin/gnome-terminal", "--disable-factory", - "--title=" + SkinUtil.makeEmulatorName( config ), "-x", sdbPath, "-s", "emulator-" - + portSdb, "shell" ); - } else if ( SwtUtil.isWindowsPlatform() ) { - procSdb.command( "cmd.exe", "/c", "start", sdbPath, "-s", "emulator-" + portSdb, "shell" ); + if (SwtUtil.isLinuxPlatform()) { + procSdb.command("/usr/bin/gnome-terminal", "--disable-factory", + "--title=" + SkinUtil.makeEmulatorName( config ), "-x", sdbPath, + "-s", "emulator-" + portSdb, "shell"); + } else if (SwtUtil.isWindowsPlatform()) { + procSdb.command("cmd.exe", "/c", "start", sdbPath, "sdb", + "-s", "emulator-" + portSdb, "shell"); } - logger.log( Level.INFO, procSdb.command().toString() ); + logger.log(Level.INFO, procSdb.command().toString()); try { procSdb.start(); // open sdb shell diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/comm/ICommunicator.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/comm/ICommunicator.java index 4817f9e3fd..e806738f68 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/comm/ICommunicator.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/comm/ICommunicator.java @@ -89,11 +89,11 @@ public interface ICommunicator extends Runnable { } public enum MouseEventType { - DOWN( (short)1 ), - UP( (short)2 ), + PRESS( (short)1 ), + RELEASE( (short)2 ), DRAG( (short)3 ), - WHEELUP( (short)4 ), - WHEELDOWN( (short)5 ); + WHEELUP( (short)4 ), + WHEELDOWN( (short)5 ); private short value; MouseEventType( short value ) {