From: SeokYeon Hwang Date: Fri, 18 Jul 2014 08:12:47 +0000 (+0900) Subject: display: select display type with display options. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=46c12b6a6226f083a09bb052ae9d83e63327f569;p=sdk%2Femulator%2Fqemu.git display: select display type with display options. Select display type with display options - DT_MARU_SDL, DT_MARU_SHM, DT_MARU_QT. Clean-up definitions and display type names. Narrow scope of VIGS/YaGL cflags. Change-Id: Ic541a1eff745a72dcccfa0ad3df6e4b2f5342f7b Signed-off-by: SeokYeon Hwang --- diff --git a/hw/vigs/Makefile.objs b/hw/vigs/Makefile.objs index 967bf46e7b..ca42e65be8 100644 --- a/hw/vigs/Makefile.objs +++ b/hw/vigs/Makefile.objs @@ -1,6 +1,4 @@ # VIGS -QEMU_CFLAGS += -I$(SRC_PATH)/hw/vigs/vigs_inc - obj-y += vigs_log.o obj-y += vigs_device.o libs_softmmu += $(GLX_LIBS) diff --git a/hw/yagl/Makefile.objs b/hw/yagl/Makefile.objs index 2453ae9f4f..fcd358f7d2 100644 --- a/hw/yagl/Makefile.objs +++ b/hw/yagl/Makefile.objs @@ -1,5 +1,3 @@ -QEMU_CFLAGS += -I$(SRC_PATH)/hw/yagl -I$(SRC_PATH)/hw/yagl/yagl_inc - obj-y += yagl_device.o obj-y += yagl_log.o obj-y += yagl_process.o @@ -29,3 +27,5 @@ obj-y += yagl_egl_surface_attribs.o obj-y += yagl_apis/ obj-y += yagl_backends/ obj-y += yagl_drivers/ + +$(obj)/%.o: QEMU_CFLAGS += -I$(SRC_PATH)/hw/yagl -I$(SRC_PATH)/hw/yagl/yagl_inc diff --git a/hw/yagl/yagl_apis/egl/Makefile.objs b/hw/yagl/yagl_apis/egl/Makefile.objs index 570a379379..f92409ce7d 100644 --- a/hw/yagl/yagl_apis/egl/Makefile.objs +++ b/hw/yagl/yagl_apis/egl/Makefile.objs @@ -9,3 +9,5 @@ obj-y += yagl_egl_surface.o obj-y += yagl_egl_context.o obj-y += yagl_egl_validate.o obj-y += yagl_host_egl_calls.o + +$(obj)/%.o: QEMU_CFLAGS += -I$(SRC_PATH)/hw/yagl -I$(SRC_PATH)/hw/yagl/yagl_inc diff --git a/hw/yagl/yagl_apis/gles/Makefile.objs b/hw/yagl/yagl_apis/gles/Makefile.objs index 1147c7f063..e08c5850a2 100644 --- a/hw/yagl/yagl_apis/gles/Makefile.objs +++ b/hw/yagl/yagl_apis/gles/Makefile.objs @@ -4,3 +4,5 @@ obj-y += yagl_gles_api_ps.o obj-y += yagl_gles_api_ts.o obj-y += yagl_gles_calls.o obj-y += yagl_host_gles_calls.o + +$(obj)/%.o: QEMU_CFLAGS += -I$(SRC_PATH)/hw/yagl -I$(SRC_PATH)/hw/yagl/yagl_inc diff --git a/hw/yagl/yagl_backends/egl_offscreen/Makefile.objs b/hw/yagl/yagl_backends/egl_offscreen/Makefile.objs index 5121b9f67b..2ec845c492 100644 --- a/hw/yagl/yagl_backends/egl_offscreen/Makefile.objs +++ b/hw/yagl/yagl_backends/egl_offscreen/Makefile.objs @@ -4,3 +4,5 @@ obj-y += yagl_egl_offscreen_ts.o obj-y += yagl_egl_offscreen_display.o obj-y += yagl_egl_offscreen_context.o obj-y += yagl_egl_offscreen_surface.o + +$(obj)/%.o: QEMU_CFLAGS += -I$(SRC_PATH)/hw/yagl -I$(SRC_PATH)/hw/yagl/yagl_inc diff --git a/hw/yagl/yagl_backends/egl_onscreen/Makefile.objs b/hw/yagl/yagl_backends/egl_onscreen/Makefile.objs index 922fc679ad..c42718d9fd 100644 --- a/hw/yagl/yagl_backends/egl_onscreen/Makefile.objs +++ b/hw/yagl/yagl_backends/egl_onscreen/Makefile.objs @@ -5,3 +5,4 @@ obj-y += yagl_egl_onscreen_display.o obj-y += yagl_egl_onscreen_context.o obj-y += yagl_egl_onscreen_surface.o +$(obj)/%.o: QEMU_CFLAGS += -I$(SRC_PATH)/hw/yagl -I$(SRC_PATH)/hw/yagl/yagl_inc diff --git a/hw/yagl/yagl_drivers/egl_glx/Makefile.objs b/hw/yagl/yagl_drivers/egl_glx/Makefile.objs index 15df65cd51..5a605f321e 100644 --- a/hw/yagl/yagl_drivers/egl_glx/Makefile.objs +++ b/hw/yagl/yagl_drivers/egl_glx/Makefile.objs @@ -1,2 +1,4 @@ # EGL GLX driver obj-y += yagl_egl_glx.o + +$(obj)/%.o: QEMU_CFLAGS += -I$(SRC_PATH)/hw/yagl -I$(SRC_PATH)/hw/yagl/yagl_inc diff --git a/hw/yagl/yagl_drivers/gles_ogl/Makefile.objs b/hw/yagl/yagl_drivers/gles_ogl/Makefile.objs index a4391feb00..6d558e3e8a 100644 --- a/hw/yagl/yagl_drivers/gles_ogl/Makefile.objs +++ b/hw/yagl/yagl_drivers/gles_ogl/Makefile.objs @@ -1,2 +1,4 @@ # GLES OpenGL driver obj-y += yagl_gles_ogl.o + +$(obj)/%.o: QEMU_CFLAGS += -I$(SRC_PATH)/hw/yagl -I$(SRC_PATH)/hw/yagl/yagl_inc diff --git a/hw/yagl/yagl_drivers/gles_onscreen/Makefile.objs b/hw/yagl/yagl_drivers/gles_onscreen/Makefile.objs index 5878ee9a7b..a0f350b781 100644 --- a/hw/yagl/yagl_drivers/gles_onscreen/Makefile.objs +++ b/hw/yagl/yagl_drivers/gles_onscreen/Makefile.objs @@ -1,3 +1,4 @@ # GLES onscreen driver obj-y += yagl_gles_onscreen.o +$(obj)/%.o: QEMU_CFLAGS += -I$(SRC_PATH)/hw/yagl -I$(SRC_PATH)/hw/yagl/yagl_inc diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 767dcbe45c..3f776d76c2 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -98,8 +98,9 @@ typedef enum DisplayType DT_GTK, DT_NOGRAPHIC, #ifdef CONFIG_MARU - DT_MARU, - DT_QT, + DT_MARU_SDL, + DT_MARU_SHM, + DT_MARU_QT, #endif DT_NONE, } DisplayType; diff --git a/include/ui/console.h b/include/ui/console.h index 080eac69a7..36e2c9ab99 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -363,8 +363,4 @@ int index_from_key(const char *key); /* gtk.c */ void early_gtk_display_init(void); void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover); - -/* qt5.c */ -void qt5_display_init(DisplayState *ds, int full_screen); - #endif diff --git a/tizen/src/display/Makefile.objs b/tizen/src/display/Makefile.objs index 3660db9ee4..00312dffa0 100644 --- a/tizen/src/display/Makefile.objs +++ b/tizen/src/display/Makefile.objs @@ -1,10 +1,16 @@ obj-y += maru_display.o -ifdef CONFIG_USE_SHM -obj-y += maru_shm.o -else -ifdef CONFIG_SDL -obj-y += maru_sdl.o maru_sdl_processing.o maru_finger.o -endif -endif + +obj-$(CONFIG_USE_SHM) += maru_shm.o + +obj-$(CONFIG_SDL) += maru_sdl.o maru_sdl_processing.o maru_finger.o + +obj-$(CONFIG_QT) += qt5.o +obj-$(CONFIG_QT) += qt5_supplement.o moc_qt5_supplement.o $(obj)/maru_display.o $(obj)/maru_sdl.o $(obj)/maru_sdl_processing.o $(obj)/maru_finger.o: QEMU_CFLAGS += $(SDL_CFLAGS) + +$(obj)/qt5_supplement.o: QEMU_CFLAGS += $(QT_CFLAGS) +$(obj)/moc_qt5_supplement.o: $(obj)/moc_qt5_supplement.cpp +$(obj)/moc_qt5_supplement.cpp: $(obj)/qt5_supplement.h + moc $< -o $@ +$(obj)/moc_qt5_supplement.o: QEMU_CFLAGS += $(QT_CFLAGS) diff --git a/tizen/src/display/maru_display.c b/tizen/src/display/maru_display.c index 23dff8f4b6..5c585e6620 100644 --- a/tizen/src/display/maru_display.c +++ b/tizen/src/display/maru_display.c @@ -29,35 +29,24 @@ #include "emulator.h" -#include "emulator_common.h" #include "maru_display.h" #include "debug_ch.h" -#ifndef CONFIG_USE_SHM -#ifdef CONFIG_SDL -#include "maru_sdl.h" -#endif -#else -#include "maru_shm.h" -#endif - MULTI_DEBUG_CHANNEL(tizen, display); MaruScreenShot* screenshot = NULL; +static MaruDisplayChangeListener *mdcl; + static void maru_display_fini(void) { INFO("fini qemu display\n"); g_free(screenshot); -#ifndef CONFIG_USE_SHM -#ifdef CONFIG_SDL - maru_sdl_quit(); -#endif -#else - maru_shm_quit(); -#endif + if (mdcl->fini) { + mdcl->fini(); + } } static void maru_display_notify_exit(Notifier *notifier, void *data) { @@ -66,93 +55,80 @@ static void maru_display_notify_exit(Notifier *notifier, void *data) { static Notifier maru_display_exit = { .notify = maru_display_notify_exit }; //TODO: interface -void maru_display_init(DisplayState *ds) +void maru_display_init(DisplayState *ds, DisplayType display_type, int full_screen) { INFO("init qemu display\n"); -#ifndef CONFIG_USE_SHM -#ifdef CONFIG_SDL - maru_sdl_pre_init(); -#endif -#else - /* do nothing */ -#endif - - /* graphics context information */ - DisplayChangeListener *dcl; - - dcl = g_malloc0(sizeof(DisplayChangeListener)); -#if defined(CONFIG_USE_SHM) || defined(CONFIG_SDL) - //FIXME - dcl->ops = &maru_dcl_ops; -#endif - register_displaychangelistener(dcl); + mdcl = g_malloc0(sizeof(MaruDisplayChangeListener)); + switch (display_type) { +#ifdef CONFIG_SDL + case DT_MARU_SDL: + maru_sdl_pre_init(mdcl); + break; +#endif +#ifdef CONFIG_USE_SHM + case DT_MARU_SHM: + maru_shm_pre_init(mdcl); + break; +#endif +#ifdef CONFIG_QT + case DT_MARU_QT: + maru_qt5_display_init(mdcl, full_screen); + break; +#endif + default: + ERR("can not enter here.\n"); + // can not enter here... + break; + } + + //register_displaychangelistener(mdcl->dcl); screenshot = g_malloc0(sizeof(MaruScreenShot)); screenshot->pixels = NULL; screenshot->request = false; screenshot->ready = false; emulator_add_exit_notifier(&maru_display_exit); + INFO("init qemu display 3\n"); } void maru_display_resize(void) { -#ifndef CONFIG_USE_SHM -#ifdef CONFIG_SDL - maru_sdl_resize(); -#endif -#else - maru_shm_resize(); -#endif + if (mdcl->resize) { + mdcl->resize(); + } } void maru_display_update(void) { -#ifndef CONFIG_USE_SHM -#ifdef CONFIG_SDL - maru_sdl_update(); -#endif -#else - /* do nothing */ -#endif + if (mdcl->update) { + mdcl->update(); + } } -void maru_display_invalidate(bool on) +void maru_display_set_invalidate(bool on) { -#ifndef CONFIG_USE_SHM -#ifdef CONFIG_SDL - maru_sdl_invalidate(on); -#endif -#else - /* do nothing */ -#endif + if (mdcl->set_invalidate) { + mdcl->set_invalidate(on); + } } -void maru_display_interpolation(bool on) +void maru_display_set_interpolation(bool on) { -#ifndef CONFIG_USE_SHM -#ifdef CONFIG_SDL - maru_sdl_interpolation(on); -#endif -#else - /* do nothing */ -#endif + if (mdcl->set_interpolation) { + mdcl->set_interpolation(on); + } } void maru_ds_surface_init(uint64 swt_handle, unsigned int display_width, unsigned int display_height, bool blank_guide) { -#ifndef CONFIG_USE_SHM -#ifdef CONFIG_SDL - maru_sdl_init(swt_handle, - display_width, display_height, blank_guide); -#endif -#else - maru_shm_init(swt_handle, - display_width, display_height, blank_guide); -#endif + if (mdcl->surface_init) { + mdcl->surface_init(swt_handle, display_width, + display_height, blank_guide); + } } MaruScreenShot *get_screenshot(void) diff --git a/tizen/src/display/maru_display.h b/tizen/src/display/maru_display.h index c9c4552912..b1ff6f63d7 100644 --- a/tizen/src/display/maru_display.h +++ b/tizen/src/display/maru_display.h @@ -31,19 +31,33 @@ #ifndef __MARU_DISPLAY_H__ #define __MARU_DISPLAY_H__ +#include "sysemu/sysemu.h" #include "ui/console.h" +typedef struct { + void (*surface_init)(uint64 swt_handle, + unsigned int display_width, unsigned int display_height, + bool blank_guide); + void (*fini)(void); + + void (*resize)(void); + void (*update)(void); + void (*set_invalidate)(bool); + void (*set_interpolation)(bool); +} MaruDisplayChangeListener; + typedef struct MaruScreenShot { unsigned char *pixels; bool request; bool ready; } MaruScreenShot; -void maru_display_init(DisplayState *ds); +void maru_display_init(DisplayState *ds, DisplayType display_type, int full_screen); void maru_display_resize(void); void maru_display_update(void); -void maru_display_invalidate(bool on); -void maru_display_interpolation(bool on); +void maru_display_set_invalidate(bool on); +void maru_display_set_interpolation(bool on); + void maru_ds_surface_init(uint64 swt_handle, unsigned int display_width, unsigned int display_height, bool blank_guide); @@ -51,4 +65,13 @@ void maru_ds_surface_init(uint64 swt_handle, MaruScreenShot *get_screenshot(void); void save_screenshot(DisplaySurface *surface); +// maru_sdl +void maru_sdl_pre_init(MaruDisplayChangeListener *mdcl); + +// maru_shm +void maru_shm_pre_init(MaruDisplayChangeListener *mdcl); + +// maru_qt +void maru_qt5_display_init(MaruDisplayChangeListener *mdcl, int full_screen); + #endif /* __MARU_DISPLAY_H__ */ diff --git a/tizen/src/display/maru_finger.c b/tizen/src/display/maru_finger.c index de365e8460..b3a1182d53 100644 --- a/tizen/src/display/maru_finger.c +++ b/tizen/src/display/maru_finger.c @@ -30,7 +30,9 @@ #include #include + #include + #include "maru_finger.h" #include "emul_state.h" #include "hw/virtio/maru_virtio_touchscreen.h" @@ -230,16 +232,6 @@ void init_multi_touch_state(void) mts->finger_point_surface = (void *)point; } -void set_multi_touch_enable(int enable) -{ - get_emul_multi_touch_state()->multitouch_enable = enable; -} - -int get_multi_touch_enable(void) -{ - return get_emul_multi_touch_state()->multitouch_enable; -} - int add_finger_point(int origin_x, int origin_y, int x, int y) { MultiTouchState *mts = get_emul_multi_touch_state(); diff --git a/tizen/src/display/maru_finger.h b/tizen/src/display/maru_finger.h index d5f071e326..ee4c44c06d 100644 --- a/tizen/src/display/maru_finger.h +++ b/tizen/src/display/maru_finger.h @@ -34,6 +34,8 @@ #include #include +#include "config-host.h" + /* definitions relating to multi-touch */ #define MAX_FINGER_CNT 10 #define DEFAULT_FINGER_POINT_SIZE 32 @@ -62,8 +64,7 @@ typedef struct MultiTouchState { void init_multi_touch_state(void); -void set_multi_touch_enable(int enable); -int get_multi_touch_enable(void); + FingerPoint *get_finger_point_from_slot(int index); FingerPoint *get_finger_point_search(int x, int y); int add_finger_point(int origin_x, int origin_y, int x, int y); @@ -71,7 +72,12 @@ int add_finger_point(int origin_x, int origin_y, int x, int y); void maru_finger_processing_1(int touch_type, int origin_x, int origin_y, int x, int y); void maru_finger_processing_2(int touch_type, int origin_x, int origin_y, int x, int y); int rearrange_finger_points(int lcd_w, int lcd_h, double scale_factor, int rotaton_type); +#ifdef CONFIG_SDL void clear_finger_slot(bool keep_enable); +#else +// FIXME: should be display independant... +static void __attribute__((unused)) clear_finger_slot(bool keep_enable) {} +#endif void cleanup_multi_touch_state(void); diff --git a/tizen/src/display/maru_sdl.c b/tizen/src/display/maru_sdl.c index cdc099de54..2c0cea3145 100644 --- a/tizen/src/display/maru_sdl.c +++ b/tizen/src/display/maru_sdl.c @@ -34,7 +34,6 @@ #include "emulator.h" #include "emul_state.h" #include "maru_display.h" -#include "maru_sdl.h" #include "maru_sdl_processing.h" #include "hw/pci/maru_brightness.h" #include "debug_ch.h" @@ -277,28 +276,13 @@ static void qemu_ds_sdl_refresh(DisplayChangeListener *dcl) #endif } -DisplayChangeListenerOps maru_dcl_ops = { +static DisplayChangeListenerOps dcl_ops = { .dpy_name = "maru_sdl", .dpy_gfx_update = qemu_ds_sdl_update, .dpy_gfx_switch = qemu_ds_sdl_switch, .dpy_refresh = qemu_ds_sdl_refresh, }; -void maru_sdl_interpolation(bool on) -{ - if (on == true) { - INFO("set PIXMAN_FILTER_BEST filter for image processing\n"); - - /* PIXMAN_FILTER_BILINEAR */ - sdl_pixman_filter = PIXMAN_FILTER_BEST; - } else { - INFO("set PIXMAN_FILTER_FAST filter for image processing\n"); - - /* PIXMAN_FILTER_NEAREST */ - sdl_pixman_filter = PIXMAN_FILTER_FAST; - } -} - static void qemu_update(void) { if (sdl_alteration < 0) { @@ -514,46 +498,7 @@ static void maru_sdl_init_bh(void *opaque) #endif } -void maru_sdl_pre_init(void) { - sdl_init_bh = qemu_bh_new(maru_sdl_init_bh, NULL); - sdl_resize_bh = qemu_bh_new(maru_sdl_resize_bh, NULL); - sdl_update_bh = qemu_bh_new(maru_sdl_update_bh, NULL); - -#ifdef SDL_THREAD - qemu_mutex_init(&sdl_mutex); - qemu_cond_init(&sdl_cond); -#endif -} - -void maru_sdl_init(uint64 swt_handle, - unsigned int display_width, unsigned int display_height, - bool blank_guide) -{ - gchar SDL_windowhack[32] = { 0, }; - long window_id = swt_handle; - blank_guide_enable = blank_guide; - - INFO("maru sdl init\n"); - - sprintf(SDL_windowhack, "%ld", window_id); - g_setenv("SDL_WINDOWID", SDL_windowhack, 1); - - INFO("register SDL environment variable. " - "(SDL_WINDOWID = %s)\n", SDL_windowhack); - - set_emul_resolution(display_width, display_height); - set_emul_sdl_bpp(SDL_BPP); - maru_sdl_interpolation(false); - init_multi_touch_state(); - - if (blank_guide_enable == true) { - INFO("blank guide is on\n"); - } - - qemu_bh_schedule(sdl_init_bh); -} - -void maru_sdl_quit(void) +static void maru_sdl_quit(void) { INFO("maru sdl quit\n"); @@ -594,21 +539,87 @@ void maru_sdl_quit(void) #endif } -void maru_sdl_resize(void) +static void maru_sdl_resize(void) { INFO("maru sdl resize\n"); qemu_bh_schedule(sdl_resize_bh); } -void maru_sdl_update(void) +static void maru_sdl_update(void) { if (sdl_update_bh != NULL) { qemu_bh_schedule(sdl_update_bh); } } -void maru_sdl_invalidate(bool on) +static void maru_sdl_set_invalidate(bool on) { sdl_invalidate = on; } + +static void maru_sdl_set_interpolation(bool on) +{ + if (on == true) { + INFO("set PIXMAN_FILTER_BEST filter for image processing\n"); + + /* PIXMAN_FILTER_BILINEAR */ + sdl_pixman_filter = PIXMAN_FILTER_BEST; + } else { + INFO("set PIXMAN_FILTER_FAST filter for image processing\n"); + + /* PIXMAN_FILTER_NEAREST */ + sdl_pixman_filter = PIXMAN_FILTER_FAST; + } +} + +static void maru_sdl_init(uint64 swt_handle, + unsigned int display_width, unsigned int display_height, + bool blank_guide) +{ + gchar SDL_windowhack[32] = { 0, }; + long window_id = swt_handle; + blank_guide_enable = blank_guide; + + INFO("maru sdl init\n"); + + sprintf(SDL_windowhack, "%ld", window_id); + g_setenv("SDL_WINDOWID", SDL_windowhack, 1); + + INFO("register SDL environment variable. " + "(SDL_WINDOWID = %s)\n", SDL_windowhack); + + set_emul_resolution(display_width, display_height); + set_emul_sdl_bpp(SDL_BPP); + maru_sdl_set_interpolation(false); + init_multi_touch_state(); + + if (blank_guide_enable == true) { + INFO("blank guide is on\n"); + } + + qemu_bh_schedule(sdl_init_bh); +} + +void maru_sdl_pre_init(MaruDisplayChangeListener *mdcl) { + DisplayChangeListener *dcl = g_malloc0(sizeof(DisplayChangeListener)); + dcl->ops = &dcl_ops; + register_displaychangelistener(dcl); + + mdcl->surface_init = maru_sdl_init; + mdcl->fini = maru_sdl_quit; + + mdcl->resize = maru_sdl_resize; + mdcl->update = maru_sdl_update; + mdcl->set_invalidate = maru_sdl_set_invalidate; + mdcl->set_interpolation = maru_sdl_set_interpolation; + + sdl_init_bh = qemu_bh_new(maru_sdl_init_bh, NULL); + sdl_resize_bh = qemu_bh_new(maru_sdl_resize_bh, NULL); + sdl_update_bh = qemu_bh_new(maru_sdl_update_bh, NULL); + +#ifdef SDL_THREAD + qemu_mutex_init(&sdl_mutex); + qemu_cond_init(&sdl_cond); +#endif +} diff --git a/tizen/src/display/maru_sdl.h b/tizen/src/display/maru_sdl.h index 87e4ec877d..9fa2f645b6 100644 --- a/tizen/src/display/maru_sdl.h +++ b/tizen/src/display/maru_sdl.h @@ -33,17 +33,8 @@ #define MARU_SDL_H_ #include "ui/console.h" +#include "maru_display.h" -extern DisplayChangeListenerOps maru_dcl_ops; - -void maru_sdl_pre_init(void); -void maru_sdl_init(uint64 swt_handle, - unsigned int display_width, unsigned int display_height, - bool blank_guide); -void maru_sdl_resize(void); -void maru_sdl_update(void); -void maru_sdl_invalidate(bool on); -void maru_sdl_interpolation(bool on); -void maru_sdl_quit(void); +void maru_sdl_pre_init(MaruDisplayChangeListener *mdcl); #endif /* MARU_SDL_H_ */ diff --git a/tizen/src/display/maru_shm.c b/tizen/src/display/maru_shm.c index 77a9cbae17..c1967a173a 100644 --- a/tizen/src/display/maru_shm.c +++ b/tizen/src/display/maru_shm.c @@ -32,7 +32,7 @@ #include #include -#include "maru_shm.h" +#include "maru_display.h" #include "emul_state.h" #include "hw/pci/maru_brightness.h" #include "skin/maruskin_server.h" @@ -191,14 +191,51 @@ static void qemu_ds_shm_refresh(DisplayChangeListener *dcl) } } -DisplayChangeListenerOps maru_dcl_ops = { +static DisplayChangeListenerOps dcl_ops = { .dpy_name = "maru_shm", .dpy_refresh = qemu_ds_shm_refresh, .dpy_gfx_update = qemu_ds_shm_update, .dpy_gfx_switch = qemu_ds_shm_switch, }; -void maru_shm_init(uint64 swt_handle, +static void maru_shm_quit(void) +{ + struct shmid_ds shm_info; + + INFO("maru shm quit\n"); + + if (shmctl(skin_shmid, IPC_STAT, &shm_info) == -1) { + ERR("shmctl failed\n"); + shm_info.shm_nattch = -1; + } + + if (shmdt(shared_memory) == -1) { + ERR("shmdt failed\n"); + perror("maru_vga: "); + return; + } + shared_memory = NULL; + + if (shm_info.shm_nattch == 1) { + /* remove */ + if (shmctl(skin_shmid, IPC_RMID, 0) == -1) { + INFO("segment was already removed\n"); + perror("maru_vga: "); + } else { + INFO("shared memory was removed\n"); + } + } else if (shm_info.shm_nattch != -1) { + INFO("number of current attaches = %d\n", + (int)shm_info.shm_nattch); + } +} + +static void maru_shm_resize(void) +{ + shm_skip_update = 0; +} + +static void maru_shm_init(uint64 swt_handle, unsigned int display_width, unsigned int display_height, bool blank_guide) { @@ -251,39 +288,15 @@ void maru_shm_init(uint64 swt_handle, INFO("Memory attached at 0x%X\n", (int)shared_memory); } -void maru_shm_quit(void) -{ - struct shmid_ds shm_info; - - INFO("maru shm quit\n"); - if (shmctl(skin_shmid, IPC_STAT, &shm_info) == -1) { - ERR("shmctl failed\n"); - shm_info.shm_nattch = -1; - } +void maru_shm_pre_init(MaruDisplayChangeListener *mdcl) { + DisplayChangeListener *dcl = g_malloc0(sizeof(DisplayChangeListener)); + dcl->ops = &dcl_ops; + register_displaychangelistener(dcl); - if (shmdt(shared_memory) == -1) { - ERR("shmdt failed\n"); - perror("maru_vga: "); - return; - } - shared_memory = NULL; + mdcl->surface_init = maru_shm_init; + mdcl->fini = maru_shm_quit; - if (shm_info.shm_nattch == 1) { - /* remove */ - if (shmctl(skin_shmid, IPC_RMID, 0) == -1) { - INFO("segment was already removed\n"); - perror("maru_vga: "); - } else { - INFO("shared memory was removed\n"); - } - } else if (shm_info.shm_nattch != -1) { - INFO("number of current attaches = %d\n", - (int)shm_info.shm_nattch); - } + mdcl->resize = maru_shm_resize; } -void maru_shm_resize(void) -{ - shm_skip_update = 0; -} diff --git a/tizen/src/display/maru_shm.h b/tizen/src/display/maru_shm.h index d24b1b69e0..14eb281971 100644 --- a/tizen/src/display/maru_shm.h +++ b/tizen/src/display/maru_shm.h @@ -32,13 +32,8 @@ #define MARU_SHM_H_ #include "ui/console.h" +#include "maru_display.h" -extern DisplayChangeListenerOps maru_dcl_ops; - -void maru_shm_init(uint64 swt_handle, - unsigned int display_width, unsigned int display_height, - bool blank_guide); -void maru_shm_resize(void); -void maru_shm_quit(void); +void maru_shm_pre_init(MaruDisplayChangeListener *mdcl); #endif /* MARU_SHM_H_ */ diff --git a/tizen/src/display/qt5.c b/tizen/src/display/qt5.c new file mode 100644 index 0000000000..64e3976f6a --- /dev/null +++ b/tizen/src/display/qt5.c @@ -0,0 +1,121 @@ +/* + * Qt UI + * + * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * SeokYeon Hwang + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +#include "ui/console.h" +#include "maru_display.h" +#include "qt5_supplement.h" + +//static Notifier mouse_mode_notifier; +static int qt5_num_outputs; + +static struct qt5_state { + DisplayChangeListener dcl; + DisplaySurface *surface; + + int idx; +} *qt5_console; + +static void qt5_update(DisplayChangeListener *dcl, + int x, int y, int w, int h) +{ + DisplaySurface *surf = qemu_console_surface(dcl->con); + + if (!surf) { + return; + } + + qt5_update_internal(surface_data(surf), surface_width(surf), surface_height(surf)); +} + +static void qt5_switch(DisplayChangeListener *dcl, + DisplaySurface *new_surface) +{ +// fprintf(stdout, "##### qt5_switch\n"); +} + +static void qt5_refresh(DisplayChangeListener *dcl) +{ + graphic_hw_update(dcl->con); + qt5_refresh_internal(); +} + +static void qt5_mouse_warp(DisplayChangeListener *dcl, + int x, int y, int on) +{ +} + +static void qt5_mouse_define(DisplayChangeListener *dcl, + QEMUCursor *c) +{ +} + +static const DisplayChangeListenerOps dcl_ops = { + .dpy_name = "qt5", + .dpy_gfx_update = qt5_update, + .dpy_gfx_switch = qt5_switch, + .dpy_refresh = qt5_refresh, + .dpy_mouse_set = qt5_mouse_warp, + .dpy_cursor_define = qt5_mouse_define, +}; + +void maru_qt5_display_init(MaruDisplayChangeListener *mdcl, int full_screen) +{ + int i; + + // prepare gui + qt5_prepare(); + + for (i = 0;; i++) { + QemuConsole *con = qemu_console_lookup_by_index(i); + if (!con || !qemu_console_is_graphic(con)) { + break; + } + } + qt5_num_outputs = i; + qt5_console = g_new0(struct qt5_state, qt5_num_outputs); + for (i = 0; i < qt5_num_outputs; i++) { + QemuConsole *con = qemu_console_lookup_by_index(i); + qt5_console[i].dcl.ops = &dcl_ops; + qt5_console[i].dcl.con = con; + register_displaychangelistener(&qt5_console[i].dcl); + qt5_console[i].idx = i; + } + + // TODO: show icon + + if (full_screen) { + // TODO + } + + /* TODO + mouse_mode_notifier.notify = qt2_mouse_mode_change; + qemu_add_mouse_mode_change_notifier(&mouse_mode_notifier); + */ + + // TODO: cursor control +} diff --git a/tizen/src/display/qt5_supplement.cpp b/tizen/src/display/qt5_supplement.cpp new file mode 100644 index 0000000000..e72ea75656 --- /dev/null +++ b/tizen/src/display/qt5_supplement.cpp @@ -0,0 +1,99 @@ +/* + * Qt UI + * + * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * SeokYeon Hwang + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +#include +#include "qt5_supplement.h" + +//using namespace std; + +static QApplication *app; + +QT5Console::QT5Console() +{ + label = new QLabel(); + label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + label->setAlignment(Qt::AlignCenter); + label->setFixedSize(720 / 2, 1280 / 2); + + layout = new QVBoxLayout(); + layout->addWidget(label); + layout->setContentsMargins( 0, 0, 0, 0); + setLayout(layout); + + setWindowTitle(tr("Emulator with Qt5")); +} + +QLabel *QT5Console::getLabel() +{ + return label; +} + +static int argc = 0; +static char *argv[0]; +static QT5Console *console; + +void qt5_prepare(void) +{ + app = new QApplication(argc, argv); + console = new QT5Console(); + console->show(); +} + +int qt5_get_win_id(void) +{ + return console->winId(); +} + +void qt5_update_internal(void *data, int width, int height) +{ + QPixmap pixmap = QPixmap(); + QLabel *label = console->getLabel(); + + QImage image = QImage((uchar *)data, width, height, QImage::Format_ARGB32); + pixmap.convertFromImage(image); + + label->setPixmap(pixmap.scaled(label->size(), Qt::KeepAspectRatio, + Qt::SmoothTransformation)); +} + +void qt5_switch_internal(void) +{ +} + +void qt5_refresh_internal(void) +{ + app->processEvents(); +} + +void qt5_mouse_warp(void) +{ +} + +void sdl_mouse_define(void) +{ +} diff --git a/tizen/src/display/qt5_supplement.h b/tizen/src/display/qt5_supplement.h new file mode 100644 index 0000000000..cd6e152f8b --- /dev/null +++ b/tizen/src/display/qt5_supplement.h @@ -0,0 +1,66 @@ +/* + * Qt UI + * + * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * SeokYeon Hwang + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +#ifndef __QT5_INTERNAL_H__ +#define __QT5_INTERNAL_H__ + +#ifdef __cplusplus +#include + +class QT5Console : public QWidget +{ + Q_OBJECT + +public: + QT5Console(); + QLabel *getLabel(); + +protected: + +private: + QLabel *label; + QLayout *layout; +}; +#endif + +#ifdef __cplusplus +extern "C" { +#endif +void qt5_prepare(void); +int qt5_get_win_id(void); + +void qt5_update_internal(void *data, int width, int height); +void qt5_switch_internal(void); +void qt5_refresh_internal(void); +void qt5_mouse_warp_internal(void); +void sdl_mouse_define_internal(void); +#ifdef __cplusplus +} +#endif + +#endif // __QT5_INTERNAL_H__ diff --git a/tizen/src/ecs/ecs_msg.c b/tizen/src/ecs/ecs_msg.c index 0ac6538615..a888300349 100644 --- a/tizen/src/ecs/ecs_msg.c +++ b/tizen/src/ecs/ecs_msg.c @@ -54,9 +54,7 @@ #include "qmp-commands.h" #include "ecs.h" -#ifndef CONFIG_USE_SHM #include "display/maru_finger.h" -#endif #include "hw/virtio/maru_virtio_evdi.h" #include "hw/virtio/maru_virtio_sensor.h" @@ -523,13 +521,9 @@ bool msgproc_device_req(ECS_Client* ccli, ECS__DeviceReq* msg) } } else if (!strncmp(cmd, "TGesture", strlen("TGesture"))) { /* release multi-touch */ -#if !defined(CONFIG_USE_SHM) && defined(CONFIG_SDL) if (get_multi_touch_enable() != 0) { clear_finger_slot(false); } -#else - // TODO: -#endif if (data == NULL) { ERR("touch gesture data is NULL\n"); diff --git a/tizen/src/emul_state.c b/tizen/src/emul_state.c index 7e10d185d9..2137a62c70 100644 --- a/tizen/src/emul_state.c +++ b/tizen/src/emul_state.c @@ -269,6 +269,17 @@ MultiTouchState *get_emul_multi_touch_state(void) return &(_emul_state.qemu_mts); } +void set_multi_touch_enable(int enable) +{ + _emul_state.qemu_mts.multitouch_enable = enable; +} + +int get_multi_touch_enable(void) +{ + return _emul_state.qemu_mts.multitouch_enable; +} + + /* retrieves the status of the host lock key */ int get_host_lock_key_state(int key) { diff --git a/tizen/src/emul_state.h b/tizen/src/emul_state.h index 464becd5cb..865017eca0 100644 --- a/tizen/src/emul_state.h +++ b/tizen/src/emul_state.h @@ -147,11 +147,15 @@ int get_emul_ecs_port(void); int get_emulator_condition(void); short get_emul_rotation(void); -MultiTouchState *get_emul_multi_touch_state(void); int get_host_lock_key_state(int key); int get_host_lock_key_state_darwin(int key); int get_emul_caps_lock_state(void); int get_emul_num_lock_state(void); char* get_emul_vm_name(void); +/* multi-touch */ +MultiTouchState *get_emul_multi_touch_state(void); +void set_multi_touch_enable(int enable); +int get_multi_touch_enable(void); + #endif /* __EMUL_STATE_H__ */ diff --git a/tizen/src/emulator.c b/tizen/src/emulator.c index 572499f5f7..ce3b39cecf 100644 --- a/tizen/src/emulator.c +++ b/tizen/src/emulator.c @@ -79,7 +79,7 @@ void emulator_add_exit_notifier(Notifier *notify) qemu_add_exit_notifier(notify); } -#ifdef CONFIG_SDL +#if defined(CONFIG_SDL) || defined(CONFIG_USE_SHM) static void construct_main_window(int skin_argc, char *skin_argv[], int qemu_argc, char *qemu_argv[]) { @@ -276,7 +276,7 @@ const char *prepare_maru(const gchar * const kernel_cmdline) return maru_kernel_cmdline; } -#ifdef CONFIG_SDL +#if defined(CONFIG_SDL) || defined(CONFIG_USE_SHM) void start_skin(void) { LOG_INFO("Start skin\n"); @@ -297,7 +297,7 @@ static int emulator_main(int argc, char *argv[], char **envp) } #endif -#ifdef CONFIG_WIN32 +#if defined(CONFIG_WIN32) && defined(CONFIG_SDL) // SDL_init() routes stdout and stderr to the respective files in win32. // So we revert it. freopen("CON", "w", stdout); diff --git a/tizen/src/skin/maruskin_client.c b/tizen/src/skin/maruskin_client.c index 5001a1cb52..e6a97dc7a9 100644 --- a/tizen/src/skin/maruskin_client.c +++ b/tizen/src/skin/maruskin_client.c @@ -112,11 +112,17 @@ static void *run_skin_client(void *arg) /* display */ char buf_display_shm[8] = { 0, }; -#ifdef CONFIG_USE_SHM - strcpy(buf_display_shm, OPT_BOOLEAN_TRUE); /* maru_shm */ -#else - strcpy(buf_display_shm, OPT_BOOLEAN_FALSE); /* maru_sdl */ -#endif + switch (display_type) { + case DT_MARU_SDL: + strcpy(buf_display_shm, OPT_BOOLEAN_FALSE); /* maru_sdl */ + break; + case DT_MARU_SHM: + strcpy(buf_display_shm, OPT_BOOLEAN_TRUE); /* maru_shm */ + break; + default: + ERR("Can not enter here.\n"); + break; + } /* input */ char buf_input[12] = { 0, }; diff --git a/tizen/src/skin/maruskin_operation.c b/tizen/src/skin/maruskin_operation.c index 2a1aa64550..10005feabd 100644 --- a/tizen/src/skin/maruskin_operation.c +++ b/tizen/src/skin/maruskin_operation.c @@ -96,7 +96,7 @@ void do_grabbing_enable(bool on) { INFO("skin grabbing enable : %d\n", on); - maru_display_invalidate(on); + maru_display_set_invalidate(on); } void do_mouse_event(int button_type, int event_type, @@ -555,7 +555,7 @@ void do_interpolation_enable(bool on) { INFO("interpolation enable : %d\n", on); - maru_display_interpolation(on); + maru_display_set_interpolation(on); } void do_ram_dump(void) diff --git a/ui/Makefile.objs b/ui/Makefile.objs index 55bd941041..6f2294efda 100644 --- a/ui/Makefile.objs +++ b/ui/Makefile.objs @@ -15,16 +15,6 @@ common-obj-$(CONFIG_CURSES) += curses.o common-obj-$(CONFIG_VNC) += $(vnc-obj-y) common-obj-$(CONFIG_GTK) += gtk.o x_keymap.o -# by caramis -common-obj-$(CONFIG_QT) += qt5.o -common-obj-$(CONFIG_QT) += qt5_supplement.o moc_qt5_supplement.o - $(obj)/sdl.o $(obj)/sdl_zoom.o $(obj)/sdl2.o: QEMU_CFLAGS += $(SDL_CFLAGS) $(obj)/gtk.o: QEMU_CFLAGS += $(GTK_CFLAGS) $(VTE_CFLAGS) - -$(obj)/qt5_supplement.o: QEMU_CFLAGS += $(QT_CFLAGS) -$(obj)/moc_qt5_supplement.o: $(obj)/moc_qt5_supplement.cpp -$(obj)/moc_qt5_supplement.cpp: $(obj)/qt5_supplement.h - moc $< -o $@ -$(obj)/moc_qt5_supplement.o: QEMU_CFLAGS += $(QT_CFLAGS) diff --git a/ui/qt5.c b/ui/qt5.c deleted file mode 100644 index 2a01abb889..0000000000 --- a/ui/qt5.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Qt UI - * - * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: - * SeokYeon Hwang - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - * - * Contributors: - * - S-Core Co., Ltd - * - */ - -#include "ui/console.h" -#include "qt5_supplement.h" - -//static Notifier mouse_mode_notifier; -static int qt5_num_outputs; - -static struct qt5_state { - DisplayChangeListener dcl; - DisplaySurface *surface; - - int idx; -} *qt5_console; - -static void qt5_update(DisplayChangeListener *dcl, - int x, int y, int w, int h) -{ - DisplaySurface *surf = qemu_console_surface(dcl->con); - - if (!surf) { - return; - } - - qt5_update_internal(surface_data(surf), surface_width(surf), surface_height(surf)); -} - -static void qt5_switch(DisplayChangeListener *dcl, - DisplaySurface *new_surface) -{ -// fprintf(stdout, "##### qt5_switch\n"); -} - -static void qt5_refresh(DisplayChangeListener *dcl) -{ - graphic_hw_update(dcl->con); - qt5_refresh_internal(); -} - -static void qt5_mouse_warp(DisplayChangeListener *dcl, - int x, int y, int on) -{ -} - -static void qt5_mouse_define(DisplayChangeListener *dcl, - QEMUCursor *c) -{ -} - -static const DisplayChangeListenerOps dcl_ops = { - .dpy_name = "qt5", - .dpy_gfx_update = qt5_update, - .dpy_gfx_switch = qt5_switch, - .dpy_refresh = qt5_refresh, - .dpy_mouse_set = qt5_mouse_warp, - .dpy_cursor_define = qt5_mouse_define, -}; - -void qt5_display_init(DisplayState *ds, int full_screen) -{ - int i; - - // prepare gui - qt5_prepare(); - - for (i = 0;; i++) { - QemuConsole *con = qemu_console_lookup_by_index(i); - if (!con || !qemu_console_is_graphic(con)) { - break; - } - } - qt5_num_outputs = i; - qt5_console = g_new0(struct qt5_state, qt5_num_outputs); - for (i = 0; i < qt5_num_outputs; i++) { - QemuConsole *con = qemu_console_lookup_by_index(i); - qt5_console[i].dcl.ops = &dcl_ops; - qt5_console[i].dcl.con = con; - register_displaychangelistener(&qt5_console[i].dcl); - qt5_console[i].idx = i; - } - - // TODO: show icon - - if (full_screen) { - // TODO - } - - /* TODO - mouse_mode_notifier.notify = qt2_mouse_mode_change; - qemu_add_mouse_mode_change_notifier(&mouse_mode_notifier); - */ - - // TODO: cursor control -} diff --git a/ui/qt5_supplement.cpp b/ui/qt5_supplement.cpp deleted file mode 100644 index e72ea75656..0000000000 --- a/ui/qt5_supplement.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Qt UI - * - * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: - * SeokYeon Hwang - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - * - * Contributors: - * - S-Core Co., Ltd - * - */ - -#include -#include "qt5_supplement.h" - -//using namespace std; - -static QApplication *app; - -QT5Console::QT5Console() -{ - label = new QLabel(); - label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - label->setAlignment(Qt::AlignCenter); - label->setFixedSize(720 / 2, 1280 / 2); - - layout = new QVBoxLayout(); - layout->addWidget(label); - layout->setContentsMargins( 0, 0, 0, 0); - setLayout(layout); - - setWindowTitle(tr("Emulator with Qt5")); -} - -QLabel *QT5Console::getLabel() -{ - return label; -} - -static int argc = 0; -static char *argv[0]; -static QT5Console *console; - -void qt5_prepare(void) -{ - app = new QApplication(argc, argv); - console = new QT5Console(); - console->show(); -} - -int qt5_get_win_id(void) -{ - return console->winId(); -} - -void qt5_update_internal(void *data, int width, int height) -{ - QPixmap pixmap = QPixmap(); - QLabel *label = console->getLabel(); - - QImage image = QImage((uchar *)data, width, height, QImage::Format_ARGB32); - pixmap.convertFromImage(image); - - label->setPixmap(pixmap.scaled(label->size(), Qt::KeepAspectRatio, - Qt::SmoothTransformation)); -} - -void qt5_switch_internal(void) -{ -} - -void qt5_refresh_internal(void) -{ - app->processEvents(); -} - -void qt5_mouse_warp(void) -{ -} - -void sdl_mouse_define(void) -{ -} diff --git a/ui/qt5_supplement.h b/ui/qt5_supplement.h deleted file mode 100644 index cd6e152f8b..0000000000 --- a/ui/qt5_supplement.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Qt UI - * - * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: - * SeokYeon Hwang - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - * - * Contributors: - * - S-Core Co., Ltd - * - */ - -#ifndef __QT5_INTERNAL_H__ -#define __QT5_INTERNAL_H__ - -#ifdef __cplusplus -#include - -class QT5Console : public QWidget -{ - Q_OBJECT - -public: - QT5Console(); - QLabel *getLabel(); - -protected: - -private: - QLabel *label; - QLayout *layout; -}; -#endif - -#ifdef __cplusplus -extern "C" { -#endif -void qt5_prepare(void); -int qt5_get_win_id(void); - -void qt5_update_internal(void *data, int width, int height); -void qt5_switch_internal(void); -void qt5_refresh_internal(void); -void qt5_mouse_warp_internal(void); -void sdl_mouse_define_internal(void); -#ifdef __cplusplus -} -#endif - -#endif // __QT5_INTERNAL_H__ diff --git a/vl.c b/vl.c index 5ffb66ab7f..bfbd739c8b 100644 --- a/vl.c +++ b/vl.c @@ -2352,8 +2352,20 @@ static DisplayType select_display(const char *p) fprintf(stderr, "GTK support is disabled\n"); exit(1); #endif - } else if (strstart(p, "qt", &opts)) { - display = DT_QT; +#ifdef CONFIG_MARU + } else if (strstart(p, "maru_sdl", &opts)) { +#ifdef CONFIG_SDL + display = DT_MARU_SDL; +#endif + } else if (strstart(p, "maru_shm", &opts)) { +#ifdef CONFIG_USE_SHM + display = DT_MARU_SHM; +#endif + } else if (strstart(p, "maru_qt", &opts)) { +#ifdef CONFIG_QT + display = DT_MARU_QT; +#endif +#endif } else if (strstart(p, "none", &opts)) { display = DT_NONE; } else { @@ -4242,10 +4254,16 @@ int main(int argc, char **argv, char **envp) if (display_type == DT_DEFAULT && !display_remote) { #if defined(CONFIG_MARU) + // FIXME: for compatibility... + // If no display_type is specified, + // we use DT_MARU_SDL on Linux, Windows and + // use DT_MARU_SHM on MacOS. #if defined(CONFIG_SDL) - display_type = DT_MARU; + display_type = DT_MARU_SDL; +#elif defined(CONFIG_USE_SHM) + display_type = DT_MARU_SHM; #elif defined(CONFIG_QT) - display_type = DT_QT; + display_type = DT_MARU_QT; #endif #elif defined(CONFIG_GTK) display_type = DT_GTK; @@ -4584,25 +4602,6 @@ int main(int argc, char **argv, char **envp) curses_display_init(ds, full_screen); break; #endif -#if defined(CONFIG_MARU) -#if defined(CONFIG_SDL) - case DT_MARU: - maru_display_init(ds); - if (skin_disabled == 1) { - /* do not start skin client process */ - set_emul_skin_enable(false); - } else { - set_emul_skin_enable(true); - } - start_skin(); - break; -#endif -#if defined(CONFIG_QT) - case DT_QT: - qt5_display_init(ds, full_screen); - break; -#endif -#endif #if defined(CONFIG_SDL) case DT_SDL: sdl_display_init(ds, full_screen, no_frame); @@ -4616,6 +4615,26 @@ int main(int argc, char **argv, char **envp) case DT_GTK: gtk_display_init(ds, full_screen, grab_on_hover); break; +#endif +#if defined(CONFIG_MARU) +#if defined(CONFIG_SDL) || defined(CONFIG_USE_SHM) + case DT_MARU_SDL: + case DT_MARU_SHM: + maru_display_init(ds, display_type, full_screen); + if (skin_disabled == 1) { + /* do not start skin client process */ + set_emul_skin_enable(false); + } else { + set_emul_skin_enable(true); + } + start_skin(); + break; +#endif +#if defined(CONFIG_QT) + case DT_MARU_QT: + maru_display_init(ds, display_type, full_screen); + break; +#endif #endif default: break;