From 4bea57913139dc12bf4b50ae38f33f9526196a78 Mon Sep 17 00:00:00 2001 From: GiWoong Kim Date: Fri, 25 Jul 2014 15:31:59 +0900 Subject: [PATCH] skin: detect a system settings change The detecting of host system settings change is not interested on Windows. Change-Id: Ic5dbed6b3686467fca92ee4aeb5819dbfb9a5c7e Signed-off-by: GiWoong Kim (cherry picked from commit d1179936f7218761027e276d93176fc8cf670780) --- .../src/org/tizen/emulator/skin/EmulatorSkin.java | 18 ++++++++++-------- .../skin/layout/GeneralPurposeSkinComposer.java | 5 +++-- .../tizen/emulator/skin/menu/GeneralKeyWindow.java | 21 ++++++++++++--------- 3 files changed, 25 insertions(+), 19 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 0c62d87..e4a959d 100755 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java @@ -617,15 +617,17 @@ public class EmulatorSkin { shell.addMenuDetectListener(shellMenuDetectListener); - /* keep window region while OS theme changing */ - shell.getDisplay().addListener(SWT.Settings, new Listener() { - @Override - public void handleEvent(Event e) { - logger.info("operating system property has been changed"); + if (SwtUtil.isWindowsPlatform() == false) { + /* keep window region while OS theme changing */ + shell.getDisplay().addListener(SWT.Settings, new Listener() { + @Override + public void handleEvent(Event e) { + logger.info("operating system property has been changed"); - rearrangeSkin(); - } - }); + rearrangeSkin(); + } + }); + } } private void removeShellListeners() { 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 dc8f197..e48d5d8 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 @@ -224,7 +224,7 @@ public class GeneralPurposeSkinComposer implements ISkinComposer { /* make window region */ Region region = (SwtUtil.isLinuxPlatform() == false) ? - getTrimmedRegion(shell.getDisplay(), generalSkin) : /* color key */ + getTrimmedRegion(generalSkin) : /* color key */ SkinUtil.getTrimmedRegion(generalSkin); /* update the skin state information */ @@ -320,7 +320,7 @@ public class GeneralPurposeSkinComposer implements ISkinComposer { return displayBounds; } - private static Region getTrimmedRegion(Display display, Image image) { + private static Region getTrimmedRegion(Image image) { if (null == image) { return null; } @@ -332,6 +332,7 @@ public class GeneralPurposeSkinComposer implements ISkinComposer { Region region = new Region(); region.add(new Rectangle(0, 0, width, height)); + Display display = Display.getDefault(); int r = display.getSystemColor(SWT.COLOR_MAGENTA).getRed(); int g = display.getSystemColor(SWT.COLOR_MAGENTA).getGreen(); int b = display.getSystemColor(SWT.COLOR_MAGENTA).getBlue(); diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/menu/GeneralKeyWindow.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/menu/GeneralKeyWindow.java index 5e1a549..6924459 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/menu/GeneralKeyWindow.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/menu/GeneralKeyWindow.java @@ -303,7 +303,7 @@ public class GeneralKeyWindow extends SkinWindow { } } - private static Region getTrimmedRegion(Display display, Image image) { + private static Region getTrimmedRegion(Image image) { if (null == image) { return null; } @@ -315,6 +315,7 @@ public class GeneralKeyWindow extends SkinWindow { Region region = new Region(); region.add(new Rectangle(0, 0, width, height)); + Display display = Display.getDefault(); int r = display.getSystemColor(SWT.COLOR_MAGENTA).getRed(); int g = display.getSystemColor(SWT.COLOR_MAGENTA).getGreen(); int b = display.getSystemColor(SWT.COLOR_MAGENTA).getBlue(); @@ -342,7 +343,7 @@ public class GeneralKeyWindow extends SkinWindow { protected void trimWindow() { /* make window region */ Region region = (SwtUtil.isLinuxPlatform() == false) ? - getTrimmedRegion(shell.getDisplay(), imageFrame) : /* color key */ + getTrimmedRegion(imageFrame) : /* color key */ SkinUtil.getTrimmedRegion(imageFrame); /* custom window shape */ @@ -521,13 +522,15 @@ public class GeneralKeyWindow extends SkinWindow { shell.addMouseListener(shellMouseListener); - /* keep window region while OS theme changing */ - shell.getDisplay().addListener(SWT.Settings, new Listener() { - @Override - public void handleEvent(Event e) { - trimWindow(); - } - }); + if (SwtUtil.isWindowsPlatform() == false) { + /* keep window region while OS theme changing */ + shell.getDisplay().addListener(SWT.Settings, new Listener() { + @Override + public void handleEvent(Event e) { + trimWindow(); + } + }); + } } private void dispose() { -- 2.7.4