From: giwoong.kim Date: Mon, 14 Jan 2013 05:02:24 +0000 (+0900) Subject: skin: control the focus in general skin on linux X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.1~1187 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f1e057e398cb58063cb2ed73120bd47e7b4e8191;p=sdk%2Femulator%2Fqemu.git skin: control the focus in general skin on linux Added focus listener to Key Window. And sync up the focus between Key Window and Main Window in general purpose skin on linux. 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 ac708a9564..f5eab8fb0c 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 @@ -236,6 +236,8 @@ public class EmulatorSkin { addShellListener(shell); addCanvasListener(shell, lcdCanvas); + setFocus(); + /* attach a menu */ this.isOnKbd = false; setMenu(); @@ -470,8 +472,7 @@ public class EmulatorSkin { logger.info("gain focus"); if (isOnTop == false && isKeyWindow == true) { - if (keyWindow != null && - keyWindow.getDockPosition() != SWT.NONE) { + if (keyWindow != null) { keyWindow.getShell().moveAbove(shell); shell.moveAbove(keyWindow.getShell()); } @@ -936,6 +937,9 @@ public class EmulatorSkin { } } + public void setFocus() { + lcdCanvas.setFocus(); + } protected void openScreenShotWindow() { //TODO: abstract diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/custom/KeyWindow.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/custom/KeyWindow.java index 5f0c31f0e7..49f297096e 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/custom/KeyWindow.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/custom/KeyWindow.java @@ -32,6 +32,8 @@ import java.util.List; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.ScrolledComposite; +import org.eclipse.swt.events.FocusEvent; +import org.eclipse.swt.events.FocusListener; import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.events.MouseListener; import org.eclipse.swt.events.MouseMoveListener; @@ -166,6 +168,21 @@ public class KeyWindow extends SkinWindow { } }); + pairTagCanvas.addFocusListener(new FocusListener() { + @Override + public void focusGained(FocusEvent event) { + logger.info("gain focus"); + + skin.setFocus(); + } + + @Override + public void focusLost(FocusEvent event) { + logger.info("lost focus"); + } + }); + pairTagCanvas.setFocus(); + /* */ ScrolledComposite compositeScroll = new ScrolledComposite(shell, SWT.V_SCROLL); compositeScroll.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, true, 1, 1)); @@ -181,10 +198,11 @@ public class KeyWindow extends SkinWindow { compositeGridLayout.verticalSpacing = BUTTON_VERTICAL_SPACING; compositeBase.setLayout(compositeGridLayout); + /* attach HW keys */ if (keyMapList != null && keyMapList.isEmpty() == false) { for (KeyMapType keyEntry : keyMapList) { - CustomButton HWKeyButton = new CustomButton(compositeBase, SWT.NONE, - imageNormal, imageHover, imagePushed); + CustomButton HWKeyButton = new CustomButton(compositeBase, + SWT.NO_FOCUS, imageNormal, imageHover, imagePushed); HWKeyButton.setText(keyEntry.getEventInfo().getKeyName()); HWKeyButton.setToolTipText(keyEntry.getTooltip()); HWKeyButton.setBackground(colorFrame); 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 53d26f5277..86f461be9b 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 @@ -176,7 +176,7 @@ public class GeneralPurposeSkinComposer implements ISkinComposer { }); /* make a pair tag circle */ - skin.pairTagCanvas = new Canvas(shell, SWT.NONE); + skin.pairTagCanvas = new Canvas(shell, SWT.NO_FOCUS); skin.pairTagCanvas.setBackground( new Color(shell.getDisplay(), new RGB(38, 38, 38)));