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 <syeon.hwang@samsung.com>
# VIGS
-QEMU_CFLAGS += -I$(SRC_PATH)/hw/vigs/vigs_inc
-
obj-y += vigs_log.o
obj-y += vigs_device.o
libs_softmmu += $(GLX_LIBS)
-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
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
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
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
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
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
# 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
# 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
# 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
DT_GTK,
DT_NOGRAPHIC,
#ifdef CONFIG_MARU
- DT_MARU,
- DT_QT,
+ DT_MARU_SDL,
+ DT_MARU_SHM,
+ DT_MARU_QT,
#endif
DT_NONE,
} DisplayType;
/* 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
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)
#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) {
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)
#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);
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__ */
#include <math.h>
#include <glib.h>
+
#include <SDL.h>
+
#include "maru_finger.h"
#include "emul_state.h"
#include "hw/virtio/maru_virtio_touchscreen.h"
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();
#include <stdint.h>
#include <stdbool.h>
+#include "config-host.h"
+
/* definitions relating to multi-touch */
#define MAX_FINGER_CNT 10
#define DEFAULT_FINGER_POINT_SIZE 32
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);
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);
#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"
#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) {
#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");
#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
+}
#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_ */
#include <sys/ipc.h>
#include <sys/shm.h>
-#include "maru_shm.h"
+#include "maru_display.h"
#include "emul_state.h"
#include "hw/pci/maru_brightness.h"
#include "skin/maruskin_server.h"
}
}
-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)
{
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;
-}
#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_ */
--- /dev/null
+/*
+ * Qt UI
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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
+}
--- /dev/null
+/*
+ * Qt UI
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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 <QApplication>
+#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)
+{
+}
--- /dev/null
+/*
+ * Qt UI
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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 <QtWidgets>
+
+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__
#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"
}
} 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");
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)
{
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__ */
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[])
{
return maru_kernel_cmdline;
}
-#ifdef CONFIG_SDL
+#if defined(CONFIG_SDL) || defined(CONFIG_USE_SHM)
void start_skin(void)
{
LOG_INFO("Start skin\n");
}
#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);
/* 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, };
{
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,
{
INFO("interpolation enable : %d\n", on);
- maru_display_interpolation(on);
+ maru_display_set_interpolation(on);
}
void do_ram_dump(void)
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)
+++ /dev/null
-/*
- * Qt UI
- *
- * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * SeokYeon Hwang <syeon.hwang@samsung.com>
- *
- * 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
-}
+++ /dev/null
-/*
- * Qt UI
- *
- * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * SeokYeon Hwang <syeon.hwang@samsung.com>
- *
- * 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 <QApplication>
-#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)
-{
-}
+++ /dev/null
-/*
- * Qt UI
- *
- * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * SeokYeon Hwang <syeon.hwang@samsung.com>
- *
- * 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 <QtWidgets>
-
-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__
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 {
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;
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);
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;