Merge remote-tracking branch 'score/develop' into tizen-arm-v1.1.0
authorEvgeny Voevodin <e.voevodin@samsung.com>
Mon, 25 Jun 2012 05:46:03 +0000 (09:46 +0400)
committerEvgeny Voevodin <e.voevodin@samsung.com>
Wed, 27 Jun 2012 10:44:32 +0000 (14:44 +0400)
Conflicts:
hw/pc.c

Restored bios failure message.
It's generated in hw/pc_sysfw.c.

Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
17 files changed:
blockdev.c
hw/pc.c
hw/pc_sysfw.c
package/pkginfo.manifest
tizen/src/VERSION
tizen/src/debug_ch.c
tizen/src/debug_ch.h
tizen/src/guest_server.c
tizen/src/hw/maru_codec.h
tizen/src/maru_err_table.c
tizen/src/maru_err_table.h
tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java
tizen/src/skin/client/src/org/tizen/emulator/skin/dialog/DetailInfoDialog.java
tizen/src/skin/client/src/org/tizen/emulator/skin/screenshot/ScreenShotDialog.java
tizen/src/skin/maruskin_client.c
tizen/src/skin/maruskin_operation.c [changed mode: 0644->0755]
vl.c

index cc9b9a2c9c7985d6f6f55dd168c5cdc0429a574d..15bd25f068a0ddfad3d9fd64f7850ab1505820ed 100644 (file)
@@ -256,6 +256,7 @@ static int parse_block_error_action(const char *buf, int is_read)
 
 #ifdef CONFIG_MARU
 extern int start_simple_client(char* msg);
+extern char* maru_convert_path(char* msg, const char *path);
 #endif
 
 static bool do_check_io_limits(BlockIOLimit *io_limits)
@@ -622,18 +623,13 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi)
                      file, strerror(-ret));
 
 #ifdef CONFIG_MARU
-        const char _msg[] = "Fail to load disk file. Check if the file is corrupted or missing from the following path.\n\n";
-        char* current_path = (char *)g_get_current_dir();
-
-        int len = strlen(_msg) + strlen(current_path) + strlen(file) + 2;
-
-        char* error_msg = g_malloc0(len * sizeof(char));
-        snprintf(error_msg, len, "%s%s/%s", _msg, current_path, file);
-
-        start_simple_client(error_msg);
-
-        g_free(current_path);
-        g_free(error_msg);
+        const char _msg[] = "Failed to load disk file from the following path. Check if the file is corrupted or missing.\n\n";
+           char* err_msg = NULL;
+        err_msg = maru_convert_path((char*)_msg, file);
+        start_simple_client(err_msg);
+        if (err_msg) {
+            g_free(err_msg);
+        }
 #endif
 
         goto err;
diff --git a/hw/pc.c b/hw/pc.c
index 634466e60f38da26147183b88a2bdb2ccc5290db..f2f5b2315889992c95187640b4a51efc2470dd34 100644 (file)
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -700,16 +700,13 @@ static void load_linux(void *fw_cfg,
                kernel_filename, strerror(errno));
 
 #ifdef CONFIG_MARU
-    char* current_path = (char *)g_get_current_dir();
-    int len = strlen(current_path) + strlen(kernel_filename) + 2;
-
-    char* error_msg = g_malloc0(len * sizeof(char));
-    snprintf(error_msg, len, "%s/%s", current_path, kernel_filename);
+       char *error_msg = NULL;
 
+       error_msg = maru_convert_path(error_msg, kernel_filename);
     maru_register_exit_msg(MARU_EXIT_KERNEL_FILE_EXCEPTION, error_msg);
-
-    g_free(current_path);
-    g_free(error_msg);
+       if (error_msg) {
+           g_free(error_msg);
+       }
 #endif
 
        exit(1);
@@ -996,10 +993,6 @@ void pc_cpus_init(const char *cpu_model)
     }
 }
 
-#ifdef CONFIG_MARU
-extern char* qemu_get_data_dir(void);
-#endif
-
 void pc_memory_init(MemoryRegion *system_memory,
                     const char *kernel_filename,
                     const char *kernel_cmdline,
index f4802b65be8290cc7e98b9a2ae78ecae6c4820e0..7873c8efd1c57be43d609fd7f8801eaa5889eddd 100644 (file)
@@ -135,6 +135,10 @@ static void pc_system_flash_init(MemoryRegion *rom_memory,
     pc_isa_bios_init(rom_memory, flash_mem, size);
 }
 
+#ifdef CONFIG_MARU
+extern char* qemu_get_data_dir(void);
+#endif
+
 static void old_pc_system_rom_init(MemoryRegion *rom_memory)
 {
     char *filename;
@@ -165,16 +169,28 @@ static void old_pc_system_rom_init(MemoryRegion *rom_memory)
     bios_error:
         fprintf(stderr, "qemu: could not load PC BIOS '%s'\n", bios_name);
 #ifdef CONFIG_MARU
-        char* current_path = (char *)g_get_current_dir();
-        int len = strlen(current_path) + strlen(bios_name) + 3;
-        char* error_msg = g_malloc0(len * sizeof(char));
-
-        snprintf(error_msg, len, "%s/%s", current_path, bios_name);
+        char *error_msg = NULL;
+        const char *path = qemu_get_data_dir();
+        char *bios_path = NULL;
+        int bios_len = 0;
+
+        bios_len = strlen(path) + strlen("/") + strlen(bios_name) + 1;
+        bios_path = g_malloc(bios_len * sizeof(char));
+        if (!bios_path) {
+            fprintf(stderr, "qemu: failed to allocate memory\n");
+        }
+        snprintf(bios_path, bios_len, "%s/%s", path, bios_name);
+        error_msg = maru_convert_path(error_msg, bios_path);
         maru_register_exit_msg(MARU_EXIT_BIOS_FILE_EXCEPTION, error_msg);
 
-        g_free(current_path);
-        g_free(error_msg);
+        if (bios_path) {
+            g_free(bios_path);
+        }
+        if (error_msg) {
+            g_free(error_msg);
+        }
 #endif
+
         exit(1);
     }
     if (filename) {
index 6900be8a11538756d10243434d418b4fa6dcf587..b60297029331508f41f5423da81adec59a4f1353 100644 (file)
@@ -1,5 +1,5 @@
 Package: emulator
-Version: 1.2.92
+Version: 1.2.94
 OS: linux
 Build-host-os: linux
 Maintainer: Yeong-Kyoon Lee<yeongkyoon.lee@samsung.com>
@@ -8,7 +8,7 @@ Source: emulator
 Description: Tizen Emulator
 
 Package: emulator
-Version: 1.2.92
+Version: 1.2.94
 OS: windows
 Build-host-os: windows
 Maintainer: Yeong-Kyoon Lee<yeongkyoon.lee@samsung.com>
index 85bc6624f62082c051b2a90d69fbfcfbbab18260..daadb8c2fa585759a9bac9d556530f4a917fc83b 100644 (file)
@@ -1 +1 @@
-2.0a1
+2.0a2-rc3
index 7c2e372b192c6e014df21c960de2c9b3fd6c89eb..32da4ecdf8b8078938488a427dd8c80cea72fe08 100644 (file)
@@ -57,6 +57,11 @@ void set_log_path(char *path)
     strcpy(logpath, path);
 }
 
+char *get_log_path(void)
+{
+    return logpath;
+}
+
 static inline int interlocked_xchg_add( int *dest, int incr )
 {
        int ret;
index 0cabc19ddbcc2865b3787c0af2aa38a35ace3937..26c824b8ac494471387883d8c0eab1526109ed68 100644 (file)
@@ -58,6 +58,7 @@ struct _debug_channel
 };
 
 void set_log_path(char *path);
+char *get_log_path(void);
 
 #ifndef NO_DEBUG
 #define MSGSIZE_MAX 2048
index 79b7958ea230794be68b7382c91b9167c90b0fa9..634070653749b5ca4dc452983fb405982f4ee7ed 100644 (file)
@@ -29,6 +29,7 @@
  */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 #include <stdint.h>
index b94e242325b044f0cd9be75274c8c97ac3125976..d1a1dec71af95466fe154f7ceb3e7608ee7842d6 100644 (file)
@@ -132,6 +132,8 @@ void qemu_parser_init (SVCodecState *s, int ctxIndex);
 
 void qemu_restore_context (AVCodecContext *dst, AVCodecContext *src);
 
+void qemu_codec_close (SVCodecState *s, uint32_t value);
+
 void qemu_get_codec_ver (SVCodecState *s, int ctxIndex);
 /*
  *  FFMPEG APIs
index dd7715f4a156fa8f25fe33e444f4e09646d92e15..b2d9d7ec849a3f76e579d59d4ec15c4a692e2bde 100644 (file)
@@ -30,7 +30,9 @@
 
 #include "maru_err_table.h"
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
+#include <glib.h>
 
 #ifdef _WIN32
 #include <windows.h>
@@ -40,8 +42,8 @@
 static char _maru_string_table[][JAVA_MAX_COMMAND_LENGTH] = {
     /* 0 */ "", //MARU_EXIT_UNKNOWN
     /* 1 */ "Failed to allocate memory in qemu.", //MARU_EXIT_MEMORY_EXCEPTION
-    /* 2 */ "Fail to load kernel file. Check if the file is corrupted or missing from the following path.\n\n", //MARU_EXIT_KERNEL_FILE_EXCEPTION
-    /* 3 */ "Fail to load bios file. Check if the file is corrupted or missing from the following path.\n\n", //MARU_EXIT_BIOS_FILE_EXCEPTION
+    /* 2 */ "Failed to load a kernel file the following path. Check if the file is corrupted or missing.\n\n", //MARU_EXIT_KERNEL_FILE_EXCEPTION
+    /* 3 */ "Failed to load a bios file the following path. Check if the file is corrupted or missing.\n\n", //MARU_EXIT_BIOS_FILE_EXCEPTION
     /* 4 */ "Skin process cannot be initialized. Skin server is not ready.",
     /* add here.. */
     "" //MARU_EXIT_NORMAL
@@ -91,11 +93,89 @@ void maru_register_exit_msg(int maru_exit_index, char* additional_msg)
 void maru_atexit(void)
 {
     if (maru_exit_status != MARU_EXIT_NORMAL || strlen(maru_exit_msg) != 0) {
-       maru_dump_backtrace(NULL, 0);
+        maru_dump_backtrace(NULL, 0);
         start_simple_client(maru_exit_msg);
     }
 }
 
+char* maru_convert_path(char *msg, const char *path)
+{
+       char* current_path = NULL;
+       char* err_msg = NULL;
+#ifdef _WIN32
+       char* dos_err_msg = NULL;
+#endif
+       int total_len = 0;
+       int msg_len = 0;
+       int cur_path_len = 0;
+       int path_len = 0;
+       int res = -1;
+
+       res = (int)g_path_is_absolute(path);
+       path_len = (strlen(path) + 1);
+       if (msg) {
+               msg_len = strlen(msg) + 1;
+       }
+
+       if (!res) {
+               current_path = (char*)g_get_current_dir();
+               cur_path_len = strlen(current_path) + strlen("/") + 1;
+               total_len += cur_path_len;
+       }
+       total_len += (path_len + msg_len);
+
+       err_msg = g_malloc0(total_len * sizeof(char));
+       if (!err_msg) {
+               fprintf(stderr, "failed to allocate memory\n");
+               if (current_path) {
+                       g_free(current_path);
+               }
+               return NULL;
+       }
+
+       if (msg) {
+               snprintf(err_msg, msg_len, "%s", msg);
+               total_len = msg_len - 1;
+       } else {
+               total_len = 0;
+       }
+
+       if (!res) {
+               snprintf(err_msg + total_len, cur_path_len, "%s%s", current_path, "/");
+               total_len += (cur_path_len - 1);
+       }
+       snprintf(err_msg + total_len, path_len, "%s", path);
+
+#ifdef _WIN32
+       {
+               int i;
+
+               dos_err_msg = strdup(err_msg);
+               if (!dos_err_msg) {
+                       printf(stderr, "failed to duplicate an error message from %p\n", err_msg);
+                       if (current_path) {
+                               g_free(current_path);
+                       }
+                       g_free(err_msg);
+                       return NULL;
+               }
+
+               for (i = (total_len - 1); dos_err_msg[i]; i++) {
+                       if (dos_err_msg[i] == '/') {
+                               dos_err_msg[i] = '\\';
+                       }
+               }
+               strncpy(err_msg, dos_err_msg, strlen(dos_err_msg));
+               free(dos_err_msg);
+       }
+#endif
+       if (current_path) {
+               g_free(current_path);
+       }
+
+       return err_msg;
+}
+
 // for pirnt 'backtrace'
 #ifdef _WIN32
 struct frame_layout {
index f26593478564d24f384f9fe15e2779dd02eb6367..491bd015844159cb5be39df44c587ce1a6b3b722 100644 (file)
@@ -49,6 +49,7 @@ enum { //This enum must match the table definition
 
 void maru_register_exit_msg(int maru_exit_status, char* additional_msg);
 void maru_atexit(void);
+char* maru_convert_path(char *msg, const char *path);
 void maru_dump_backtrace(void* ptr, int depth);
 
 #endif /* __EMUL_ERR_TABLE_H__ */
index 2d161fc990e2a97e53206de9a47fdd368f26a522..3898a9840ad27f622a032ba0ed80ef86f035e98a 100644 (file)
@@ -978,7 +978,467 @@ public class EmulatorSkin {
        private Object invokeOSMethod( Method method ) {
                return invokeOSMethod( method, new Object[]{} );
        }
-       
+
+       private boolean setTopMost32(boolean isOnTop) {
+               if ( SkinUtil.isLinuxPlatform() ) {
+                       // reference : http://wmctrl.sourcearchive.com/documentation/1.07/main_8c-source.html
+
+                       /* if ( !OS.GDK_WINDOWING_X11() ) {
+                               logger.warning( "There is no x11 system." );
+                               return;
+                       }
+
+                       int eventData0 = isOnTop ? 1 : 0; // 'add' or 'remove'
+
+                       int topHandle = 0;
+
+                       Method m = null;
+                       try {
+                               m = Shell.class.getDeclaredMethod( "topHandle", new Class<?>[] {} );
+                               m.setAccessible( true );
+                               topHandle = (Integer) m.invoke( shell, new Object[] {} );
+                       } catch ( SecurityException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                       } catch ( NoSuchMethodException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                       } catch ( IllegalArgumentException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                       } catch ( IllegalAccessException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                       } catch ( InvocationTargetException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                       }
+
+                       int xWindow = OS.gdk_x11_drawable_get_xid( OS.GTK_WIDGET_WINDOW( topHandle ) );
+                       int xDisplay = OS.GDK_DISPLAY();
+
+                       byte[] messageBuffer = Converter.wcsToMbcs( null, "_NET_WM_STATE", true );
+                       int xMessageAtomType = OS.XInternAtom( xDisplay, messageBuffer, false );
+
+                       messageBuffer = Converter.wcsToMbcs( null, "_NET_WM_STATE_ABOVE", true );
+                       int xMessageAtomAbove = OS.XInternAtom( xDisplay, messageBuffer, false );
+
+                       XClientMessageEvent event = new XClientMessageEvent();
+                       event.type = OS.ClientMessage;
+                       event.window = xWindow;
+                       event.message_type = xMessageAtomType;
+                       event.format = 32;
+                       event.data[0] = eventData0;
+                       event.data[1] = xMessageAtomAbove;
+
+                       int clientEvent = OS.g_malloc( XClientMessageEvent.sizeof );
+                       OS.memmove( clientEvent, event, XClientMessageEvent.sizeof );
+                       int rootWin = OS.XDefaultRootWindow( xDisplay );
+                       // SubstructureRedirectMask:1L<<20 | SubstructureNotifyMask:1L<<19
+                       OS.XSendEvent( xDisplay, rootWin, false, (int) ( 1L << 20 | 1L << 19 ), clientEvent );
+                       OS.g_free( clientEvent ); */
+
+
+                       Boolean gdkWindowingX11  = (Boolean) invokeOSMethod( getOSMethod( "GDK_WINDOWING_X11" ) );
+                       if( null == gdkWindowingX11 ) {
+                               return false;
+                       }
+                       if( !gdkWindowingX11 ) {
+                               logger.warning( "There is no x11 system." );
+                               return false;
+                       }
+
+                       int eventData0 = isOnTop ? 1 : 0; // 'add' or 'remove'
+                       int topHandle = 0;
+
+                       Method m = null;
+                       try {
+                               m = Shell.class.getDeclaredMethod( "topHandle", new Class<?>[] {} );
+                               m.setAccessible( true );
+                               topHandle = (Integer) m.invoke( shell, new Object[] {} );
+                       } catch ( SecurityException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                               return false;
+                       } catch ( NoSuchMethodException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                               return false;
+                       } catch ( IllegalArgumentException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                               return false;
+                       } catch ( IllegalAccessException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                               return false;
+                       } catch ( InvocationTargetException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                               return false;
+                       }
+
+                       Integer gtkWidgetWindow = (Integer) invokeOSMethod(
+                                       getOSMethod( "GTK_WIDGET_WINDOW", int.class ), topHandle );
+                       if( null == gtkWidgetWindow ) {
+                               return false;
+                       }
+
+                       Integer xWindow = (Integer) invokeOSMethod( getOSMethod( "gdk_x11_drawable_get_xid", int.class ),
+                                       gtkWidgetWindow );
+                       if( null == xWindow ) {
+                               return false;
+                       }
+
+                       Integer xDisplay = (Integer) invokeOSMethod( getOSMethod( "GDK_DISPLAY" ) );
+                       if( null == xDisplay ) {
+                               return false;
+                       }
+
+                       Method xInternAtom = getOSMethod( "XInternAtom", int.class, byte[].class, boolean.class );
+
+                       Class<?> converterClass = null;
+                       try {
+                               converterClass = Class.forName( "org.eclipse.swt.internal.Converter" );
+                       } catch ( ClassNotFoundException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                               return false;
+                       }
+
+                       Method wcsToMbcs = null;
+                       byte[] messageBufferState = null;
+                       byte[] messageBufferAbove = null;
+
+                       try {
+                               wcsToMbcs = converterClass.getMethod( "wcsToMbcs", String.class, String.class, boolean.class );
+                       } catch ( SecurityException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                               return false;
+                       } catch ( NoSuchMethodException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                               return false;
+                       }
+
+                       try {
+                               messageBufferState = (byte[]) wcsToMbcs.invoke( null, null, "_NET_WM_STATE", true );
+                               messageBufferAbove = (byte[]) wcsToMbcs.invoke( null, null, "_NET_WM_STATE_ABOVE", true );
+                       } catch ( IllegalArgumentException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                               return false;
+                       } catch ( IllegalAccessException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                               return false;
+                       } catch ( InvocationTargetException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                               return false;
+                       }
+
+                       Integer xMessageAtomType = (Integer) invokeOSMethod( xInternAtom, xDisplay, messageBufferState, false );
+                       if( null == xMessageAtomType ) {
+                               return false;
+                       }
+
+                       Integer xMessageAtomAbove = (Integer) invokeOSMethod( xInternAtom, xDisplay, messageBufferAbove, false );
+                       if( null == xMessageAtomAbove ) {
+                               return false;
+                       }
+
+                       Class<?> eventClazz = null;
+                       Object event = null;
+                       try {
+                               eventClazz = Class.forName( "org.eclipse.swt.internal.gtk.XClientMessageEvent" );
+                               event = eventClazz.newInstance();
+                       } catch ( InstantiationException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                       } catch ( IllegalAccessException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                       } catch ( ClassNotFoundException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                       }
+
+                       if( null == eventClazz || null == event ) {
+                               return false;
+                       }
+
+                       Integer malloc = null;
+                       try {
+
+                               Field type = eventClazz.getField( "type" );
+
+                               Field clientMessageField = getOSField( "ClientMessage" );
+                               if( null == clientMessageField ) {
+                                       return false;
+                               }
+                               type.set( event, clientMessageField.get( null ) );
+
+                               Field window = eventClazz.getField( "window" );
+                               window.set( event, xWindow );
+                               Field messageType = eventClazz.getField( "message_type" );
+                               messageType.set( event, xMessageAtomType );
+                               Field format = eventClazz.getField( "format" );
+                               format.set( event, 32 );
+
+                               Object data = Array.newInstance( int.class, 5 );
+                               Array.setInt( data, 0, eventData0 );
+                               Array.setInt( data, 1, xMessageAtomAbove );
+                               Array.setInt( data, 2, 0 );
+                               Array.setInt( data, 3, 0 );
+                               Array.setInt( data, 4, 0 );
+
+                               Field dataField = eventClazz.getField( "data" );
+                               dataField.set( event, data );
+
+                               Field sizeofField = eventClazz.getField( "sizeof" );
+                               Integer sizeof = (Integer) sizeofField.get( null );
+
+                               Method gMalloc = getOSMethod( "g_malloc", int.class );
+                               malloc = (Integer) invokeOSMethod( gMalloc, sizeof );
+
+                               Method memmove = getOSMethod( "memmove", int.class, eventClazz, int.class );
+                               invokeOSMethod( memmove, malloc, event, sizeof );
+
+                       } catch ( NoSuchFieldException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                               return false;
+                       } catch ( IllegalAccessException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                               return false;
+                       }
+
+                       Method xDefaultRootWindow = getOSMethod( "XDefaultRootWindow", int.class );
+                       Integer rootWin = (Integer) invokeOSMethod( xDefaultRootWindow, xDisplay );
+
+                       Method xSendEvent = getOSMethod( "XSendEvent", int.class, int.class, boolean.class,
+                                       int.class, int.class );
+                       // SubstructureRedirectMask:1L<<20 | SubstructureNotifyMask:1L<<19
+                       invokeOSMethod( xSendEvent, xDisplay, rootWin, false, (int) ( 1L << 20 | 1L << 19 ), malloc );
+                       invokeOSMethod( getOSMethod( "g_free", int.class ), malloc ) ;
+
+               } else if( SkinUtil.isWindowsPlatform() ) {
+                       Point location = shell.getLocation();
+
+                       /* int hWndInsertAfter = 0;
+                       if( isOnTop ) {
+                               hWndInsertAfter = OS.HWND_TOPMOST;
+                       } else {
+                               hWndInsertAfter = OS.HWND_NOTOPMOST;
+                       }
+                       OS.SetWindowPos( shell.handle, hWndInsertAfter, location.x, location.y, 0, 0, OS.SWP_NOSIZE ); */
+
+                       int hWndInsertAfter = 0;
+                       int noSize = 0;
+
+                       try {
+                               if ( isOnTop ) {
+                                       Field topMost = getOSField( "HWND_TOPMOST" );
+                                       if ( null == topMost ) {
+                                               return false;
+                                       }
+                                       hWndInsertAfter = topMost.getInt( null );
+                               } else {
+                                       Field noTopMost = getOSField( "HWND_NOTOPMOST" );
+                                       if ( null == noTopMost ) {
+                                               return false;
+                                       }
+                                       hWndInsertAfter = noTopMost.getInt( null );
+                               }
+
+                               Field noSizeField = getOSField( "SWP_NOSIZE" );
+                               if ( null == noSizeField ) {
+                                       return false;
+                               }
+                               noSize = noSizeField.getInt( null );
+
+                       } catch ( IllegalArgumentException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                               return false;
+                       } catch ( IllegalAccessException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                               return false;
+                       }
+
+                       Method m = getOSMethod( "SetWindowPos", int.class, int.class, int.class, int.class, int.class,
+                                       int.class, int.class );
+
+                       invokeOSMethod( m, shell.handle, hWndInsertAfter, location.x, location.y, 0, 0, noSize );
+               } else if( SkinUtil.isMacPlatform() ) {
+                       //TODO:
+               }
+
+               return true;
+       }
+
+       private boolean setTopMost64(boolean isOnTop)
+       {
+               if ( SkinUtil.isLinuxPlatform() ) {
+                       Boolean gdkWindowingX11 = (Boolean) invokeOSMethod( getOSMethod( "GDK_WINDOWING_X11" ) );
+                       if (null == gdkWindowingX11) {
+                               return false;
+                       }
+                       if (!gdkWindowingX11) {
+                               logger.warning( "There is no x11 system." );
+                               return false;
+                       }
+
+                       int eventData0 = isOnTop ? 1 : 0; // 'add' or 'remove'
+                       long topHandle = 0;
+
+                       Method m = null;
+                       try {
+                               m = Shell.class.getDeclaredMethod( "topHandle", new Class<?>[] {} );
+                               m.setAccessible( true );
+                               topHandle = (Long) m.invoke( shell, new Object[] {} );
+                       } catch ( SecurityException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                               return false;
+                       } catch ( NoSuchMethodException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                               return false;
+                       } catch ( IllegalArgumentException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                               return false;
+                       } catch ( IllegalAccessException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                               return false;
+                       } catch ( InvocationTargetException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                               return false;
+                       }
+
+                       Long gtkWidgetWindow = (Long) invokeOSMethod(
+                                       getOSMethod( "GTK_WIDGET_WINDOW", long.class ), topHandle );
+                       if( null == gtkWidgetWindow ) {
+                               return false;
+                       }
+
+                       Long xWindow = (Long) invokeOSMethod( getOSMethod( "gdk_x11_drawable_get_xid", long.class ),
+                                       gtkWidgetWindow );
+                       if( null == xWindow ) {
+                               return false;
+                       }
+
+                       Long xDisplay = (Long) invokeOSMethod( getOSMethod( "GDK_DISPLAY" ) );
+                       if( null == xDisplay ) {
+                               return false;
+                       }
+
+                       Method xInternAtom = getOSMethod( "XInternAtom", long.class, byte[].class, boolean.class );
+
+                       Class<?> converterClass = null;
+                       try {
+                               converterClass = Class.forName( "org.eclipse.swt.internal.Converter" );
+                       } catch ( ClassNotFoundException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                               return false;
+                       }
+
+                       Method wcsToMbcs = null;
+                       byte[] messageBufferState = null;
+                       byte[] messageBufferAbove = null;
+
+                       try {
+                               wcsToMbcs = converterClass.getMethod( "wcsToMbcs", String.class, String.class, boolean.class );
+                       } catch ( SecurityException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                               return false;
+                       } catch ( NoSuchMethodException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                               return false;
+                       }
+
+                       try {
+                               messageBufferState = (byte[]) wcsToMbcs.invoke( null, null, "_NET_WM_STATE", true );
+                               messageBufferAbove = (byte[]) wcsToMbcs.invoke( null, null, "_NET_WM_STATE_ABOVE", true );
+                       } catch ( IllegalArgumentException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                               return false;
+                       } catch ( IllegalAccessException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                               return false;
+                       } catch ( InvocationTargetException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                               return false;
+                       }
+
+                       Long xMessageAtomType = (Long) invokeOSMethod( xInternAtom, xDisplay, messageBufferState, false );
+                       if( null == xMessageAtomType ) {
+                               return false;
+                       }
+
+                       Long xMessageAtomAbove = (Long) invokeOSMethod( xInternAtom, xDisplay, messageBufferAbove, false );
+                       if( null == xMessageAtomAbove ) {
+                               return false;
+                       }
+
+                       Class<?> eventClazz = null;
+                       Object event = null;
+                       try {
+                               eventClazz = Class.forName( "org.eclipse.swt.internal.gtk.XClientMessageEvent" );
+                               event = eventClazz.newInstance();
+                       } catch ( InstantiationException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                       } catch ( IllegalAccessException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                       } catch ( ClassNotFoundException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                       }
+
+                       if( null == eventClazz || null == event ) {
+                               return false;
+                       }
+
+                       Long malloc = null;
+                       try {
+
+                               Field type = eventClazz.getField( "type" );
+
+                               Field clientMessageField = getOSField( "ClientMessage" );
+                               if( null == clientMessageField ) {
+                                       return false;
+                               }
+                               type.set( event, clientMessageField.get( null ) );
+
+                               Field window = eventClazz.getField( "window" );
+                               window.set( event, xWindow );
+                               Field messageType = eventClazz.getField( "message_type" );
+                               messageType.set( event, xMessageAtomType );
+                               Field format = eventClazz.getField( "format" );
+                               format.set( event, 32 );
+
+                               Object data = Array.newInstance( long.class, 5 );
+                               Array.setLong( data, 0, eventData0 );
+                               Array.setLong( data, 1, xMessageAtomAbove );
+                               Array.setLong( data, 2, 0 );
+                               Array.setLong( data, 3, 0 );
+                               Array.setLong( data, 4, 0 );
+
+                               Field dataField = eventClazz.getField( "data" );
+                               dataField.set( event, data );
+
+                               Field sizeofField = eventClazz.getField( "sizeof" );
+                               Integer sizeof = (Integer) sizeofField.get( null );
+
+                               Method gMalloc = getOSMethod( "g_malloc", long.class );
+                               malloc = (Long) invokeOSMethod( gMalloc, sizeof.longValue() );
+
+                               Method memmove = getOSMethod( "memmove", long.class, eventClazz, long.class );
+                               invokeOSMethod( memmove, malloc, event, sizeof.longValue() );
+
+                       } catch ( NoSuchFieldException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                               return false;
+                       } catch ( IllegalAccessException ex ) {
+                               logger.log( Level.SEVERE, ex.getMessage(), ex );
+                               return false;
+                       }
+
+                       Method xDefaultRootWindow = getOSMethod( "XDefaultRootWindow", long.class );
+                       Long rootWin = (Long) invokeOSMethod( xDefaultRootWindow, xDisplay );
+
+                       Method xSendEvent = getOSMethod( "XSendEvent", long.class, long.class, boolean.class,
+                                       long.class, long.class );
+                       // SubstructureRedirectMask:1L<<20 | SubstructureNotifyMask:1L<<19
+                       invokeOSMethod( xSendEvent, xDisplay, rootWin, false, (long) ( 1L << 20 | 1L << 19 ), malloc );
+                       invokeOSMethod( getOSMethod( "g_free", long.class ), malloc );
+               } else if (SkinUtil.isWindowsPlatform()) {
+                       //TODO:
+               } else if( SkinUtil.isMacPlatform() ) {
+                       //TODO:
+               }
+
+               return true;
+       }
+
        private void addMenuItems( final Shell shell, final Menu menu ) {
 
                final MenuItem detailInfoItem = new MenuItem( menu, SWT.PUSH );
@@ -1005,296 +1465,25 @@ public class EmulatorSkin {
                onTopItem.setSelection( isOnTop );
 
                onTopItem.addSelectionListener( new SelectionAdapter() {
-
                        @Override
                        public void widgetSelected( SelectionEvent e ) {
 
                                final boolean isOnTop = onTopItem.getSelection();
 
                                if ( logger.isLoggable( Level.FINE ) ) {
-                                       logger.fine( "Select Always On Top. : " + isOnTop );
+                                       logger.fine( "Select Always On Top : " + isOnTop );
                                }
 
                                // readyToReopen( EmulatorSkin.this, isOnTop );
 
-                               
-                               if( SkinUtil.isLinuxPlatform() ) {
-
-                                       // reference : http://wmctrl.sourcearchive.com/documentation/1.07/main_8c-source.html
-                                       
-//                                     if ( !OS.GDK_WINDOWING_X11() ) {
-//                                             logger.warning( "There is no x11 system." );
-//                                             return;
-//                                     }
-//
-//                                     int eventData0 = isOnTop ? 1 : 0; // 'add' or 'remove'
-//
-//                                     int topHandle = 0;
-//
-//                                     Method m = null;
-//                                     try {
-//                                             m = Shell.class.getDeclaredMethod( "topHandle", new Class<?>[] {} );
-//                                             m.setAccessible( true );
-//                                             topHandle = (Integer) m.invoke( shell, new Object[] {} );
-//                                     } catch ( SecurityException ex ) {
-//                                             logger.log( Level.SEVERE, ex.getMessage(), ex );
-//                                     } catch ( NoSuchMethodException ex ) {
-//                                             logger.log( Level.SEVERE, ex.getMessage(), ex );
-//                                     } catch ( IllegalArgumentException ex ) {
-//                                             logger.log( Level.SEVERE, ex.getMessage(), ex );
-//                                     } catch ( IllegalAccessException ex ) {
-//                                             logger.log( Level.SEVERE, ex.getMessage(), ex );
-//                                     } catch ( InvocationTargetException ex ) {
-//                                             logger.log( Level.SEVERE, ex.getMessage(), ex );
-//                                     }
-//
-//                                     int xWindow = OS.gdk_x11_drawable_get_xid( OS.GTK_WIDGET_WINDOW( topHandle ) );
-//                                     int xDisplay = OS.GDK_DISPLAY();
-//
-//                                     byte[] messageBuffer = Converter.wcsToMbcs( null, "_NET_WM_STATE", true );
-//                                     int xMessageAtomType = OS.XInternAtom( xDisplay, messageBuffer, false );
-//
-//                                     messageBuffer = Converter.wcsToMbcs( null, "_NET_WM_STATE_ABOVE", true );
-//                                     int xMessageAtomAbove = OS.XInternAtom( xDisplay, messageBuffer, false );
-//
-//                                     XClientMessageEvent event = new XClientMessageEvent();
-//                                     event.type = OS.ClientMessage;
-//                                     event.window = xWindow;
-//                                     event.message_type = xMessageAtomType;
-//                                     event.format = 32;
-//                                     event.data[0] = eventData0;
-//                                     event.data[1] = xMessageAtomAbove;
-//
-//                                     int clientEvent = OS.g_malloc( XClientMessageEvent.sizeof );
-//                                     OS.memmove( clientEvent, event, XClientMessageEvent.sizeof );
-//                                     int rootWin = OS.XDefaultRootWindow( xDisplay );
-//                                     // SubstructureRedirectMask:1L<<20 | SubstructureNotifyMask:1L<<19
-//                                     OS.XSendEvent( xDisplay, rootWin, false, (int) ( 1L << 20 | 1L << 19 ), clientEvent );
-//                                     OS.g_free( clientEvent );
-
-                                       Boolean gdkWindowingX11  = (Boolean) invokeOSMethod( getOSMethod( "GDK_WINDOWING_X11" ) );
-                                       if( null == gdkWindowingX11 ) {
-                                               return;
-                                       }
-                                       if( !gdkWindowingX11 ) {
-                                               logger.warning( "There is no x11 system." );
-                                               return;
-                                       }
-                                       
-                                       int eventData0 = isOnTop ? 1 : 0; // 'add' or 'remove'
-                                       
-                                       int topHandle = 0;
-                                       
-                                       Method m = null;
-                                       try {
-                                               m = Shell.class.getDeclaredMethod( "topHandle", new Class<?>[] {} );
-                                               m.setAccessible( true );
-                                               topHandle = (Integer) m.invoke( shell, new Object[] {} );
-                                       } catch ( SecurityException ex ) {
-                                               logger.log( Level.SEVERE, ex.getMessage(), ex );
-                                               return;
-                                       } catch ( NoSuchMethodException ex ) {
-                                               logger.log( Level.SEVERE, ex.getMessage(), ex );
-                                               return;
-                                       } catch ( IllegalArgumentException ex ) {
-                                               logger.log( Level.SEVERE, ex.getMessage(), ex );
-                                               return;
-                                       } catch ( IllegalAccessException ex ) {
-                                               logger.log( Level.SEVERE, ex.getMessage(), ex );
-                                               return;
-                                       } catch ( InvocationTargetException ex ) {
-                                               logger.log( Level.SEVERE, ex.getMessage(), ex );
-                                               return;
-                                       }
-                                       
-                                       Integer gtkWidgetWindow = (Integer) invokeOSMethod(
-                                                       getOSMethod( "GTK_WIDGET_WINDOW", int.class ), topHandle );
-                                       if( null == gtkWidgetWindow ) {
-                                               return;
-                                       }
-                                       
-                                       Integer xWindow = (Integer) invokeOSMethod( getOSMethod( "gdk_x11_drawable_get_xid", int.class ),
-                                                       gtkWidgetWindow );
-                                       if( null == xWindow ) {
-                                               return;
-                                       }
-                                       
-                                       Integer xDisplay = (Integer) invokeOSMethod( getOSMethod( "GDK_DISPLAY" ) );
-                                       if( null == xDisplay ) {
-                                               return;
-                                       }
-                                       
-                                       Method xInternAtom = getOSMethod( "XInternAtom", int.class, byte[].class, boolean.class );
-                                       
-                                       Class<?> converterClass = null;
-                                       try {
-                                               converterClass = Class.forName( "org.eclipse.swt.internal.Converter" );
-                                       } catch ( ClassNotFoundException ex ) {
-                                               logger.log( Level.SEVERE, ex.getMessage(), ex );
-                                               return;
-                                       }
-                                       
-                                       Method wcsToMbcs = null;
-                                       byte[] messageBufferState = null;
-                                       byte[] messageBufferAbove = null;
-                                       
-                                       try {
-                                               wcsToMbcs = converterClass.getMethod( "wcsToMbcs", String.class, String.class, boolean.class );
-                                       } catch ( SecurityException ex ) {
-                                               logger.log( Level.SEVERE, ex.getMessage(), ex );
-                                               return;
-                                       } catch ( NoSuchMethodException ex ) {
-                                               logger.log( Level.SEVERE, ex.getMessage(), ex );
-                                               return;
-                                       }
-                                       
-                                       try {
-                                               messageBufferState = (byte[]) wcsToMbcs.invoke( null, null, "_NET_WM_STATE", true );
-                                               messageBufferAbove = (byte[]) wcsToMbcs.invoke( null, null, "_NET_WM_STATE_ABOVE", true );
-                                       } catch ( IllegalArgumentException ex ) {
-                                               logger.log( Level.SEVERE, ex.getMessage(), ex );
-                                               return;
-                                       } catch ( IllegalAccessException ex ) {
-                                               logger.log( Level.SEVERE, ex.getMessage(), ex );
-                                               return;
-                                       } catch ( InvocationTargetException ex ) {
-                                               logger.log( Level.SEVERE, ex.getMessage(), ex );
-                                               return;
-                                       }
-                                       
-                                       Integer xMessageAtomType = (Integer) invokeOSMethod( xInternAtom, xDisplay, messageBufferState, false );
-                                       if( null == xMessageAtomType ) {
-                                               return;
-                                       }
-
-                                       Integer xMessageAtomAbove = (Integer) invokeOSMethod( xInternAtom, xDisplay, messageBufferAbove, false );
-                                       if( null == xMessageAtomAbove ) {
-                                               return;
-                                       }
-                                       
-                                       Class<?> eventClazz = null;
-                                       Object event = null;
-                                       try {
-                                               eventClazz = Class.forName( "org.eclipse.swt.internal.gtk.XClientMessageEvent" );
-                                               event = eventClazz.newInstance();
-                                       } catch ( InstantiationException ex ) {
-                                               logger.log( Level.SEVERE, ex.getMessage(), ex );
-                                       } catch ( IllegalAccessException ex ) {
-                                               logger.log( Level.SEVERE, ex.getMessage(), ex );
-                                       } catch ( ClassNotFoundException ex ) {
-                                               logger.log( Level.SEVERE, ex.getMessage(), ex );
-                                       }
-                                       
-                                       if( null == eventClazz || null == event ) {
-                                               return;
-                                       }
-                                       
-                                       Integer malloc = null;
-                                       try {
-                                               
-                                               Field type = eventClazz.getField( "type" );
-                                               
-                                               Field clientMessageField = getOSField( "ClientMessage" );
-                                               if( null == clientMessageField ) {
-                                                       return;
-                                               }
-                                               type.set( event, clientMessageField.get( null ) );
-                                               
-                                               Field window = eventClazz.getField( "window" );
-                                               window.set( event, xWindow );
-                                               Field messageType = eventClazz.getField( "message_type" );
-                                               messageType.set( event, xMessageAtomType );
-                                               Field format = eventClazz.getField( "format" );
-                                               format.set( event, 32 );
-                                               
-                                               Object data = Array.newInstance( int.class, 5 );
-                                               Array.setInt( data, 0, eventData0 );
-                                               Array.setInt( data, 1, xMessageAtomAbove );
-                                               Array.setInt( data, 2, 0 );
-                                               Array.setInt( data, 3, 0 );
-                                               Array.setInt( data, 4, 0 );
-                                               
-                                               Field dataField = eventClazz.getField( "data" );
-                                               dataField.set( event, data );
-                                               
-                                               Field sizeofField = eventClazz.getField( "sizeof" );
-                                               Integer sizeof = (Integer) sizeofField.get( null );
-                                               
-                                               Method gMalloc = getOSMethod( "g_malloc", int.class );
-                                               malloc = (Integer) invokeOSMethod( gMalloc, sizeof );
-                                               
-                                               Method memmove = getOSMethod( "memmove", int.class, eventClazz, int.class );
-                                               invokeOSMethod( memmove, malloc, event, sizeof );
-                                               
-                                       } catch ( NoSuchFieldException ex ) {
-                                               logger.log( Level.SEVERE, ex.getMessage(), ex );
-                                               return;
-                                       } catch ( IllegalAccessException ex ) {
-                                               logger.log( Level.SEVERE, ex.getMessage(), ex );
-                                               return;
-                                       }
-                                       
-                                       Method xDefaultRootWindow = getOSMethod( "XDefaultRootWindow", int.class );
-                                       Integer rootWin = (Integer) invokeOSMethod( xDefaultRootWindow, xDisplay );
-                                       
-                                       Method xSendEvent = getOSMethod( "XSendEvent", int.class, int.class, boolean.class, int.class,
-                                                       int.class );
-                                       // SubstructureRedirectMask:1L<<20 | SubstructureNotifyMask:1L<<19
-                                       invokeOSMethod( xSendEvent, xDisplay, rootWin, false, (int) ( 1L << 20 | 1L << 19 ), malloc );
-                                       invokeOSMethod( getOSMethod( "g_free", int.class ), malloc ) ;
-                                       
-                               }else if( SkinUtil.isWindowsPlatform() ) {
-                                       
-                                       Point location = shell.getLocation();
-                                       
-//                                     int hWndInsertAfter = 0;
-//                                     if( isOnTop ) {
-//                                             hWndInsertAfter = OS.HWND_TOPMOST;
-//                                     }else {
-//                                             hWndInsertAfter = OS.HWND_NOTOPMOST;
-//                                     }
-//                                     
-//                                     OS.SetWindowPos( shell.handle, hWndInsertAfter, location.x, location.y, 0, 0, OS.SWP_NOSIZE );
-
-                                       int hWndInsertAfter = 0;
-                                       int noSize = 0;
-
-                                       try {
-                                               if ( isOnTop ) {
-                                                       Field topMost = getOSField( "HWND_TOPMOST" );
-                                                       if ( null == topMost ) {
-                                                               return;
-                                                       }
-                                                       hWndInsertAfter = topMost.getInt( null );
-                                               } else {
-                                                       Field noTopMost = getOSField( "HWND_NOTOPMOST" );
-                                                       if ( null == noTopMost ) {
-                                                               return;
-                                                       }
-                                                       hWndInsertAfter = noTopMost.getInt( null );
-                                               }
-
-                                               Field noSizeField = getOSField( "SWP_NOSIZE" );
-                                               if ( null == noSizeField ) {
-                                                       return;
-                                               }
-                                               noSize = noSizeField.getInt( null );
-
-                                       } catch ( IllegalArgumentException ex ) {
-                                               logger.log( Level.SEVERE, ex.getMessage(), ex );
-                                               return;
-                                       } catch ( IllegalAccessException ex ) {
-                                               logger.log( Level.SEVERE, ex.getMessage(), ex );
-                                               return;
-                                       }
-
-                                       Method m = getOSMethod( "SetWindowPos", int.class, int.class, int.class, int.class, int.class,
-                                                       int.class, int.class );
-
-                                       invokeOSMethod( m, shell.handle, hWndInsertAfter, location.x, location.y, 0, 0, noSize );
-
+                               String osArch = System.getProperty("os.arch"); //$NON-NLS-1$
+                               if (osArch.equals ("i386") || osArch.equals ("i686")) { //$NON-NLS-1$ $NON-NLS-2$ $NON-NLS-3$
+                                       logger.info("32bit architecture");
+                                       setTopMost32(isOnTop);
+                               } else { //64bit OS
+                                       logger.info("64bit architecture");
+                                       setTopMost64(isOnTop);
                                }
-                               
                        }
                } );
 
index be8d2bd3fca3411e26fc4e0378f6a219e9cc0ebe..b01d402384b3e335719f7339f69d4ef2b0e38a49 100644 (file)
 
 package org.tizen.emulator.skin.dialog;
 
+import java.io.File;
+import java.io.IOException;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.Map.Entry;
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
 import org.eclipse.swt.layout.FillLayout;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.widgets.Button;
@@ -66,6 +70,8 @@ public class DetailInfoDialog extends SkinDialog {
 
        private SocketCommunicator communicator;
        private EmulatorConfig config;
+       private Table table;
+       private LinkedHashMap<String, String> refinedData;
 
        public DetailInfoDialog( Shell parent, String emulatorName, SocketCommunicator communicator, EmulatorConfig config ) {
                super( parent, "Detail Info" + " - " + emulatorName, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE
@@ -85,7 +91,7 @@ public class DetailInfoDialog extends SkinDialog {
                Composite composite = new Composite( parent, SWT.NONE );
                composite.setLayout( new FillLayout() );
 
-               Table table = new Table( composite, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION );
+               table = new Table( composite, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION );
                table.setHeaderVisible( true );
                table.setLinesVisible( true );
 
@@ -99,7 +105,7 @@ public class DetailInfoDialog extends SkinDialog {
 
                int index = 0;
 
-               LinkedHashMap<String, String> refinedData = composeAndParseData( infoData );
+               refinedData = composeAndParseData( infoData );
                Iterator<Entry<String, String>> iterator = refinedData.entrySet().iterator();
 
                while ( iterator.hasNext() ) {
@@ -114,9 +120,48 @@ public class DetailInfoDialog extends SkinDialog {
 
                column[0].pack();
                column[1].pack();
-
                table.pack();
 
+               /* browse the log path when log path item is selected */
+               table.addSelectionListener(new SelectionListener() {
+                       @Override
+                       public void widgetSelected(SelectionEvent event) {
+                               //do nothing
+                       }
+
+                       @Override
+                       public void widgetDefaultSelected(SelectionEvent event) {
+                               if (table.getSelectionCount() > 1) {
+                                       return;
+                               }
+
+                               TableItem tableItem = ((TableItem)table.getSelection()[0]);
+                               final String logKey = "Log Path";
+
+                               if (tableItem.getText().compareTo(logKey) == 0) {
+                                       String logPath = refinedData.get(logKey);
+                                       ProcessBuilder procBrowser = new ProcessBuilder();
+
+                                       if (SkinUtil.isLinuxPlatform()) {
+                                               procBrowser.command("nautilus", "--browser", logPath);
+                                       } else if (SkinUtil.isWindowsPlatform()) {
+                                               procBrowser.command("explorer", "\"" + logPath + "\"");
+                                       } else if (SkinUtil.isMacPlatform()) {
+                                               //TODO:
+                                       }
+
+                                       if (procBrowser.command().isEmpty() == false) {
+                                               try {
+                                                       procBrowser.start();
+                                               } catch (Exception e) {
+                                                       logger.log( Level.SEVERE, e.getMessage(), e);
+                                               }
+                                       }
+                               }
+
+                       }
+               });
+
                return composite;
 
        }
@@ -124,9 +169,9 @@ public class DetailInfoDialog extends SkinDialog {
        @Override
        protected void setShellSize() {
                if( SkinUtil.isLinuxPlatform() ) {
-                       shell.setSize( (int) ( 380 * 1.618 ), 380 );
-               }else {
-                       shell.setSize( (int) ( 350 * 1.618 ), 350 );
+                       shell.setSize( (int) ( 402 * 1.618 ), 402 );
+               } else {
+                       shell.setSize( (int) ( 372 * 1.618 ), 372 );
                }
        }
 
@@ -161,7 +206,7 @@ public class DetailInfoDialog extends SkinDialog {
                String sharedPath = "";
                boolean isHwVirtual = false;
                String hwVirtualCompare = "";
-               String haxError = "hax_error=";
+               String logPath = "";
                boolean isHaxError = false;
                
                if ( SkinUtil.isLinuxPlatform() ) {
@@ -252,11 +297,20 @@ public class DetailInfoDialog extends SkinDialog {
 
                                        } else if ( hwVirtualCompare.equals( arg ) ) {
                                                isHwVirtual = true;
-                                       } else if ( arg.startsWith( haxError ) ) {
+                                       } else if ( arg.startsWith("hax_error=") ) {
                                                String[] sp = arg.split( "=" );
                                                if( 1 < sp.length ) {
                                                        isHaxError = Boolean.parseBoolean( sp[1] );
                                                }
+                                       } else if (arg.startsWith("log_path=")) {
+                                               String[] sp = arg.split("=");
+                                               if( 1 < sp.length ) {
+                                                       final String logSuffix = "/logs/";
+
+                                                       logPath = sp[1];
+                                                       logPath = logPath.substring(0, logPath.lastIndexOf(logSuffix) + logSuffix.length());
+                                                       logger.info("log path = " + logPath); //without filename
+                                               }
                                        }
 
                                }
@@ -285,7 +339,7 @@ public class DetailInfoDialog extends SkinDialog {
 
                result.put( "RAM Size", ram );
 
-               if( SkinUtil.isLinuxPlatform() ) {
+               if ( SkinUtil.isLinuxPlatform() ) {
                        if ( StringUtil.isEmpty( sharedPath ) ) {
                                result.put( "File Sharing", "Not Supported" );
                                result.put( "File Shared Path", "None" );
@@ -295,7 +349,7 @@ public class DetailInfoDialog extends SkinDialog {
                        }
                }
 
-               if( isHwVirtual ) {
+               if ( isHwVirtual ) {
                        if( isHaxError ) {
                                result.put( "HW Virtualization State", "Disable(insufficient memory for driver)" );
                        }else {
@@ -311,6 +365,17 @@ public class DetailInfoDialog extends SkinDialog {
                        result.put( "Image Path", imagePath );                  
                }
 
+               if (logPath.isEmpty() == false) {
+                       File logFile = new File(logPath);
+                       try {
+                               logPath = logFile.getCanonicalPath();
+                       } catch (IOException e) {
+                               logger.log(Level.SEVERE, e.getMessage(), e);
+                       }
+
+                       result.put("Log Path", logPath);
+               }
+
                return result;
 
        }
index c09a2c406ec1261f964c6272ef05e1d83fe4001b..2442e3fdff61395be1faf64183eddef6ce86277e 100644 (file)
@@ -169,8 +169,9 @@ public class ScreenShotDialog {
                                if ( null != image && !image.isDisposed() ) {
                                        //e.gc.drawImage( image, CANVAS_MARGIN, CANVAS_MARGIN );
                                        Rectangle r = image.getBounds();
+                                       logger.info("r.width: " +r.width +", r.height " + r.height);
                                        e.gc.drawImage(image, 0, 0, r.width, r.height,
-                                                       CANVAS_MARGIN, CANVAS_MARGIN, (int)(r.width * scaleLevel * 1/100), (int)(r.height * scaleLevel * 1/100));
+                                                       CANVAS_MARGIN, CANVAS_MARGIN, (int)(r.width  * scaleLevel * 1/100), (int)(r.height * scaleLevel * 1/100));
                                }
 
                        }
@@ -296,16 +297,16 @@ public class ScreenShotDialog {
 
        }
        
-       public double getScaleLevel() {
+       private double getScaleLevel() {
                return scaleLevel;
        }
 
-       public void DownScaleLevel() {
+       private void DownScaleLevel() {
                scaleLevel /= 2;
                logger.info("down scaling level : " + scaleLevel);
        }
        
-       public void UpScaleLevel() {
+       private void UpScaleLevel() {
                scaleLevel *= 2;
                logger.info("up scaling level : " + scaleLevel);
        }
@@ -313,12 +314,33 @@ public class ScreenShotDialog {
        private void arrageImageLayout() {
 
                ImageData imageData = image.getImageData();
-
+               scaleLevel = 100d;
                int width = imageData.width + ( 2 * CANVAS_MARGIN );
                int height = imageData.height + ( 2 * CANVAS_MARGIN );
-
+               logger.info("arrageImageLayout width:" + width + ", height: "+ height);
                scrollComposite.setMinSize( width, height );
+               
+               RotationInfo rotation = getCurrentRotation();
+               if ( !currentRotation.equals( rotation ) ) { // reserve changed shell size by user
+                       shell.pack();
+               }
+
+               currentRotation = rotation;
 
+       }
+       
+       private void scaledImageLayout() {
+
+               ImageData imageData = image.getImageData();
+
+               int width = imageData.width + ( 2 * CANVAS_MARGIN );
+               int height = imageData.height + ( 2 * CANVAS_MARGIN );
+               logger.info("arrageImageLayout2 width:" + width + ", height: "+ height);
+               int reWidth = (int)(width * scaleLevel * 1/100);
+               int reHeight = (int)(height * scaleLevel * 1/100);
+               logger.info("arrageImageLayout2 Rewidth:" + reWidth + ", Reheight: "+ reHeight);
+               scrollComposite.setMinSize( (int)(imageData.width * scaleLevel * 1/100) + ( 2 * CANVAS_MARGIN ), (int)(imageData.height * scaleLevel * 1/100) + ( 2 * CANVAS_MARGIN ));
+               
                RotationInfo rotation = getCurrentRotation();
                if ( !currentRotation.equals( rotation ) ) { // reserve changed shell size by user
                        shell.pack();
@@ -327,6 +349,7 @@ public class ScreenShotDialog {
                currentRotation = rotation;
 
        }
+       
 
        private ImageData rotateImageData( ImageData srcData, RotationInfo rotation ) {
 
@@ -549,7 +572,7 @@ public class ScreenShotDialog {
                                
                                UpScaleLevel();
                                imageCanvas.redraw();
-                               arrageImageLayout();
+                               scaledImageLayout();
                                label.setText(" Resolution : " + config.getArgInt(ArgsConstants.RESOLUTION_WIDTH) +
                                                "x" + config.getArgInt(ArgsConstants.RESOLUTION_HEIGHT) + " " + scaleLevel + "%");
                                label.update();
@@ -581,7 +604,7 @@ public class ScreenShotDialog {
                                
                                DownScaleLevel();
                                imageCanvas.redraw();
-                               arrageImageLayout();
+                               scaledImageLayout();
                                label.setText(" Resolution : " + config.getArgInt(ArgsConstants.RESOLUTION_WIDTH) +
                                                "x" + config.getArgInt(ArgsConstants.RESOLUTION_HEIGHT) + " " + scaleLevel + "%");
                                label.update();
index 3d50cb03c506387b26836f77bdf77999bf0c9ca6..50e60c49124a18a30c1b84b6179fb170ac6a7c1f 100644 (file)
@@ -151,7 +151,7 @@ static void* run_skin_client(void* arg)
         }
         INFO("child return value : %d\n", dwRet);
 
-        if (dwRet == -1) {
+        if (dwRet != 0) {
             //child process is terminated with some problem.
             //so qemu process will terminate, too. immediately.
             exit(1);
@@ -177,7 +177,7 @@ static void* run_skin_client(void* arg)
         //The low-order 8 bits are zero if the process exited normally.
         INFO("child return value : %d\n", ret);
 
-        if (ret == 0xff) {
+        if (ret != 0) {
             //child process is terminated with some problem.
             //so qemu process will terminate, too. immediately.
             exit(1);
old mode 100644 (file)
new mode 100755 (executable)
index 7a0ce1a..3d60e28
@@ -281,12 +281,14 @@ DetailInfo* get_detail_info( int qemu_argc, char** qemu_argv ) {
     int total_len = 0;
     int delimiter_len = strlen( DATA_DELIMITER );
 
+    /* collect QEMU information */
     for ( i = 0; i < qemu_argc; i++ ) {
         total_len += strlen( qemu_argv[i] );
         total_len += delimiter_len;
     }
 
 #ifdef _WIN32
+    /* collect HAXM information */
     const int HAX_LEN = 32;
     char hax_error[HAX_LEN];
     memset( hax_error, 0, HAX_LEN );
@@ -300,10 +302,17 @@ DetailInfo* get_detail_info( int qemu_argc, char** qemu_argv ) {
             error = 1;
         }
     }
-    hax_err_len += sprintf( hax_error + hax_err_len, "%s", error ? "true" : "false" );
-    total_len += hax_err_len;
+    hax_err_len += sprintf( hax_error + hax_err_len, "%s#", error ? "true" : "false" );
+    total_len += (hax_err_len + 1);
 #endif
 
+    /* collect log path information */
+#define LOGPATH_TEXT "log_path="
+    char* log_path = get_log_path();
+    int log_path_len = strlen(LOGPATH_TEXT) + strlen(log_path) + delimiter_len;
+    total_len += (log_path_len + 1);
+
+    /* memory allocation */
     char* info_data = g_malloc0( total_len + 1 );
     if ( !info_data ) {
         g_free( detail_info );
@@ -311,8 +320,10 @@ DetailInfo* get_detail_info( int qemu_argc, char** qemu_argv ) {
         return NULL;
     }
 
+
+    /* write informations */
     int len = 0;
-    total_len = 0;
+    total_len = 0; //recycle
 
     for ( i = 0; i < qemu_argc; i++ ) {
         len = strlen( qemu_argv[i] );
@@ -321,10 +332,13 @@ DetailInfo* get_detail_info( int qemu_argc, char** qemu_argv ) {
     }
 
 #ifdef _WIN32
-    snprintf( info_data + total_len, total_len + 1, "%s", hax_error );
+    snprintf( info_data + total_len, hax_err_len + 1, "%s#", hax_error );
     total_len += hax_err_len;
 #endif
 
+    snprintf( info_data + total_len, log_path_len + 1, "%s%s#", LOGPATH_TEXT, log_path );
+    total_len += log_path_len;
+
     INFO( "################## detail info data ####################\n" );
     INFO( "%s\n", info_data );
 
@@ -332,7 +346,6 @@ DetailInfo* get_detail_info( int qemu_argc, char** qemu_argv ) {
     detail_info->data_length = total_len;
 
     return detail_info;
-
 }
 
 void free_detail_info( DetailInfo* detail_info ) {
@@ -345,6 +358,7 @@ void free_detail_info( DetailInfo* detail_info ) {
 }
 
 void open_shell( void ) {
+    INFO("open shell\n");
 }
 
 void onoff_usb_kbd( int on )
diff --git a/vl.c b/vl.c
index 4a516f346bec68c1595ba687c6af9ad23e30a749..9ce9d987c170c35c62e0fb5ab849bb08d3087498 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -184,6 +184,7 @@ int qemu_main(int argc, char **argv, char **envp);
 #include "tizen/src/option.h"
 #include "tizen/src/emul_state.h"
 #include "tizen/src/skin/maruskin_operation.h"
+#include "tizen/src/maru_err_table.h"
 #endif
 
 //#define DEBUG_NET
@@ -1877,6 +1878,15 @@ char *qemu_find_file(int type, const char *name)
     return buf;
 }
 
+#ifdef CONFIG_MARU
+const char *qemu_get_data_dir(void);
+
+const char *qemu_get_data_dir(void)
+{
+    return data_dir;
+}
+#endif
+
 static int device_help_func(QemuOpts *opts, void *opaque)
 {
     return qdev_device_help(opts);
@@ -2246,6 +2256,9 @@ static int configure_accelerator(void)
 
     if (!accel_initialised) {
         fprintf(stderr, "No accelerator found!\n");
+#ifdef CONFIG_MARU
+        maru_register_exit_msg(MARU_EXIT_UNKNOWN, "No accelerator found.");
+#endif
         exit(1);
     }
 
@@ -2298,6 +2311,9 @@ static const QEMUOption *lookup_opt(int argc, char **argv,
     for(;;) {
         if (!popt->name) {
             error_report("invalid option");
+#ifdef CONFIG_MARU
+            maru_register_exit_msg(MARU_EXIT_UNKNOWN, "invalid option.");
+#endif
             exit(1);
         }
         if (!strcmp(popt->name, r + 1))
@@ -2307,6 +2323,9 @@ static const QEMUOption *lookup_opt(int argc, char **argv,
     if (popt->flags & HAS_ARG) {
         if (optind >= argc) {
             error_report("requires an argument");
+#ifdef CONFIG_MARU
+            maru_register_exit_msg(MARU_EXIT_UNKNOWN, "requires an argument.");
+#endif
             exit(1);
         }
         optarg = argv[optind++];