[Title] disable multitouch in qemu side when USE_SHM & etc
authorgiwoong.kim <giwoong.kim@samsung.com>
Wed, 25 Jul 2012 07:21:39 +0000 (16:21 +0900)
committergiwoong.kim <giwoong.kim@samsung.com>
Wed, 25 Jul 2012 07:21:39 +0000 (16:21 +0900)
[Type] feature
[Module] Emulator
[Priority] major
[Jira#]
[Redmine#]
[Problem]
[Cause] supprot mac
[Solution]
[TestCase]

tizen/src/maru_display.c
tizen/src/maru_display.h
tizen/src/maru_sdl.c
tizen/src/maru_sdl.h
tizen/src/maru_shm.c
tizen/src/maru_shm.h
tizen/src/skin/maruskin_operation.c

index 5783cb5..928f0b7 100644 (file)
@@ -44,6 +44,7 @@
 MULTI_DEBUG_CHANNEL(tizen, display);
 
 
+//TODO: interface
 void maru_display_init(DisplayState *ds)
 {
     INFO("init qemu display\n");
@@ -71,6 +72,29 @@ void maru_display_fini(void)
 {
     INFO("fini qemu display\n");
 
+#ifndef USE_SHM
+    maruskin_sdl_quit();
+#else
+    //TODO:
+#endif
+}
+
+void maruskin_init(uint64 swt_handle, int lcd_size_width, int lcd_size_height, bool is_resize)
+{
+#ifndef USE_SHM
+    maruskin_sdl_init(swt_handle, lcd_size_width, lcd_size_height, is_resize);
+#else
+    maruskin_shm_init(swt_handle, lcd_size_width, lcd_size_height, is_resize);
+#endif
+}
+
+DisplaySurface* get_qemu_display_surface(void) {
+#ifndef USE_SHM
+    return maruskin_sdl_get_display();
+#else
     //TODO:
+#endif
+
+    return NULL;
 }
 
index 6b0c2c1..d0d3c31 100644 (file)
@@ -36,5 +36,7 @@
 
 void maru_display_init(DisplayState *ds);
 void maru_display_fini(void);
+void maruskin_init(uint64 swt_handle, int lcd_size_width, int lcd_size_height, bool is_resize);
+DisplaySurface* get_qemu_display_surface(void);
 
 #endif /* MARU_DISPLAY_H_ */
index f7203d3..54d2289 100644 (file)
@@ -411,7 +411,7 @@ void maruskin_sdl_init(uint64 swt_handle, int lcd_size_width, int lcd_size_heigh
 
     INFO("maru sdl initialization = %d\n", is_resize);
 
-    if (is_resize == FALSE) {
+    if (is_resize == FALSE) { //once
         sprintf(SDL_windowhack, "%ld", window_id);
         g_setenv("SDL_WINDOWID", SDL_windowhack, 1);
         INFO("register SDL environment variable. (SDL_WINDOWID = %s)\n", SDL_windowhack);
@@ -477,7 +477,7 @@ void maruskin_sdl_resize(void)
     SDL_PushEvent(&ev);
 }
 
-DisplaySurface* get_qemu_display_surface( void ) {
+DisplaySurface* maruskin_sdl_get_display(void) {
     return qemu_display_surface;
 }
 
index d0e3a70..5ead7a3 100644 (file)
@@ -45,7 +45,6 @@ void maruskin_sdl_init(uint64 swt_handle, int lcd_size_width, int lcd_size_heigh
 void maruskin_sdl_resize(void);
 void maruskin_sdl_quit(void);
 
-
-DisplaySurface* get_qemu_display_surface( void );
+DisplaySurface* maruskin_sdl_get_display(void);
 
 #endif /* MARU_SDL_H_ */
index 4210022..248445c 100644 (file)
@@ -29,6 +29,7 @@
 
 
 #include "maru_shm.h"
+#include "emul_state.h"
 #include "debug_ch.h"
 
 MULTI_DEBUG_CHANNEL(tizen, maru_shm);
@@ -49,3 +50,13 @@ void qemu_ds_shm_refresh(DisplayState *ds)
     //TODO:
 }
 
+void maruskin_shm_init(uint64 swt_handle, int lcd_size_width, int lcd_size_height, bool is_resize)
+{
+    INFO("maru shm initialization = %d\n", is_resize);
+
+    if (is_resize == FALSE) { //once
+        set_emul_lcd_size(lcd_size_width, lcd_size_height);
+        set_emul_sdl_bpp(32);
+    }
+}
+
index af06336..12035b4 100644 (file)
@@ -37,5 +37,6 @@
 void qemu_ds_shm_update(DisplayState *ds, int x, int y, int w, int h);
 void qemu_ds_shm_resize(DisplayState *ds);
 void qemu_ds_shm_refresh(DisplayState *ds);
+void maruskin_shm_init(uint64 swt_handle, int lcd_size_width, int lcd_size_height, bool is_resize);
 
 #endif /* MARU_SHM_H_ */
index d93f807..0175d8e 100644 (file)
  */
 
 
+#ifdef CONFIG_DARWIN
+#define USE_SHM //shared memory
+#endif
+
 #include <unistd.h>
 #include <stdio.h>
 #include <pthread.h>
 #include "maruskin_operation.h"
 #include "hw/maru_brightness.h"
-#include "maru_sdl.h"
+#include "maru_display.h"
 #include "debug_ch.h"
 #include "sdb.h"
 #include "nbd.h"
@@ -44,7 +48,7 @@
 #include "hw/maru_pm.h"
 #include "sysemu.h"
 
-#ifdef _WIN32
+#ifdef CONFIG_WIN32
 #include "target-i386/hax-i386.h"
 #endif
 
@@ -58,8 +62,8 @@ MULTI_DEBUG_CHANNEL(qemu, skin_operation);
 
 static int requested_shutdown_qemu_gracefully = 0;
 
-static void* run_timed_shutdown_thread( void* args );
-static void send_to_emuld( const char* request_type, int request_size, const char* send_buf, int buf_size );
+static void* run_timed_shutdown_thread(void* args);
+static void send_to_emuld(const char* request_type, int request_size, const char* send_buf, int buf_size);
 
 void start_display(uint64 handle_id, int lcd_size_width, int lcd_size_height, double scale_factor, short rotation_type)
 {
@@ -67,7 +71,7 @@ void start_display(uint64 handle_id, int lcd_size_width, int lcd_size_height, do
         (long)handle_id, lcd_size_width, lcd_size_height, scale_factor, rotation_type);
 
     set_emul_win_scale(scale_factor);
-    maruskin_sdl_init(handle_id, lcd_size_width, lcd_size_height, false);
+    maruskin_init(handle_id, lcd_size_width, lcd_size_height, false);
 }
 
 void do_mouse_event( int event_type, int origin_x, int origin_y, int x, int y, int z )
@@ -77,23 +81,31 @@ void do_mouse_event( int event_type, int origin_x, int origin_y, int x, int y, i
         return;
     }
 
-    TRACE( "mouse_event event_type:%d, origin:(%d, %d), x:%d, y:%d, z:%d\n", event_type, origin_x, origin_y, x, y, z );
+    TRACE("mouse_event event_type:%d, origin:(%d, %d), x:%d, y:%d, z:%d\n",
+        event_type, origin_x, origin_y, x, y, z);
 
+#ifndef USE_SHM
+    /* multi-touch */
     if (get_emul_multi_touch_state()->multitouch_enable == 1) {
         maru_finger_processing_A(event_type, origin_x, origin_y, x, y);
+        return;
     } else if (get_emul_multi_touch_state()->multitouch_enable == 2) {
         maru_finger_processing_B(event_type, origin_x, origin_y, x, y);
+        return;
     }
-    else if ( MOUSE_DOWN == event_type || MOUSE_DRAG == event_type) { //single touch
+#endif
+
+    /* single touch */
+    if (MOUSE_DOWN == event_type || MOUSE_DRAG == event_type) {
         kbd_mouse_event(x, y, z, 1);
     } else if (MOUSE_UP == event_type) {
         kbd_mouse_event(x, y, z, 0);
     } else {
-        ERR( "undefined mouse event type:%d\n", event_type );
+        ERR("undefined mouse event type:%d\n", event_type);
     }
 
 #if 0
-#ifdef _WIN32
+#ifdef CONFIG_WIN32
     Sleep(1);
 #else
     usleep(1000);
@@ -105,6 +117,7 @@ void do_key_event( int event_type, int keycode, int key_location )
 {
     TRACE( "key_event event_type:%d, keycode:%d, key_location:%d\n", event_type, keycode, key_location );
 
+#ifndef USE_SHM
     //is multi-touch mode ?
     if (get_emul_max_touch_point() > 1) {
         if (keycode == JAVA_KEYCODE_BIT_CTRL) {
@@ -133,6 +146,7 @@ void do_key_event( int event_type, int keycode, int key_location )
             }
         }
     }
+#endif
 
     if (!mloop_evcmd_get_usbkbd_status()) {
        return;
@@ -164,7 +178,7 @@ void do_hardkey_event( int event_type, int keycode )
                 if ( ( HARD_KEY_HOME == keycode ) || ( HARD_KEY_POWER == keycode ) ) {
                     INFO( "user requests system resume.\n" );
                     resume();
-#ifdef _WIN32
+#ifdef CONFIG_WIN32
                     Sleep( RESUME_KEY_SEND_INTERVAL );
 #else
                     usleep( RESUME_KEY_SEND_INTERVAL * 1000 );
@@ -285,7 +299,7 @@ DetailInfo* get_detail_info( int qemu_argc, char** qemu_argv ) {
         total_len += delimiter_len;
     }
 
-#ifdef _WIN32
+#ifdef CONFIG_WIN32
     /* collect HAXM information */
     const int HAX_LEN = 32;
     char hax_error[HAX_LEN];
@@ -329,7 +343,7 @@ DetailInfo* get_detail_info( int qemu_argc, char** qemu_argv ) {
         total_len += len + delimiter_len;
     }
 
-#ifdef _WIN32
+#ifdef CONFIG_WIN32
     snprintf( info_data + total_len, hax_err_len + 1, "%s#", hax_error );
     total_len += hax_err_len;
 #endif
@@ -373,7 +387,7 @@ void request_close( void )
 
     do_hardkey_event( KEY_PRESSED, HARD_KEY_POWER );
 
-#ifdef _WIN32
+#ifdef CONFIG_WIN32
         Sleep( CLOSE_POWER_KEY_INTERVAL );
 #else
         usleep( CLOSE_POWER_KEY_INTERVAL * 1000 );
@@ -407,7 +421,7 @@ static void* run_timed_shutdown_thread( void* args ) {
 
     int i;
     for ( i = 0; i < TIMEOUT_FOR_SHUTDOWN; i++ ) {
-#ifdef _WIN32
+#ifdef CONFIG_WIN32
         Sleep( sleep_interval_time );
 #else
         usleep( sleep_interval_time * 1000 );
@@ -440,7 +454,7 @@ static void send_to_emuld( const char* request_type, int request_size, const cha
     INFO( "send to emuld [req_type:%s, send_data:%s, send_size:%d] 127.0.0.1:%d/tcp \n",
         request_type, send_buf, buf_size, tizen_base_port + SDB_TCP_EMULD_INDEX );
 
-#ifdef _WIN32
+#ifdef CONFIG_WIN32
     closesocket( s );
 #else
     close( s );