diff options
author | GiWoong Kim <giwoong.kim@samsung.com> | 2014-04-16 20:58:01 +0900 |
---|---|---|
committer | GiWoong Kim <giwoong.kim@samsung.com> | 2014-04-17 10:45:30 +0900 |
commit | 173eff0268bd52bc7cf21210daea749c4a87684a (patch) | |
tree | 32504b9be46cf7e017694208eaddd16da99ef7bc | |
parent | a07192eb5cae5f398f5bcd0992446dd8e6cc58d9 (diff) | |
download | qemu-173eff0268bd52bc7cf21210daea749c4a87684a.tar.gz qemu-173eff0268bd52bc7cf21210daea749c4a87684a.tar.bz2 qemu-173eff0268bd52bc7cf21210daea749c4a87684a.zip |
emulator: modified touchscreen option
added max_point deivce option for virtio touchscreen
remove -max-touch-point option
Change-Id: I32ff1b18d39c6c05364a5723ab68a0b9887fa047
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
-rw-r--r-- | hw/virtio/virtio-pci.c | 13 | ||||
-rw-r--r-- | qemu-options.hx | 10 | ||||
-rw-r--r-- | tizen/src/emulator.c | 19 | ||||
-rw-r--r-- | tizen/src/hw/maru_virtio_touchscreen.c | 2 | ||||
-rw-r--r-- | tizen/src/hw/maru_virtio_touchscreen.h | 8 | ||||
-rw-r--r-- | tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorShmSkin.java | 89 | ||||
-rw-r--r-- | vl.c | 14 |
7 files changed, 82 insertions, 73 deletions
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index eec210426d..e6ae77effb 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1547,6 +1547,12 @@ static TypeInfo virtio_gl_pci_info = { /* virtio-touchscreen-pci */ +static Property virtio_touchscreen_pci_properties[] = { + DEFINE_PROP_UINT32(TOUCHSCREEN_OPTION_NAME, + VirtIOTouchscreenPCI,vdev.max_finger, DEFAULT_MAX_FINGER), + DEFINE_PROP_END_OF_LIST(), +}; + static int virtio_touchscreen_pci_init(VirtIOPCIProxy *vpci_dev) { VirtIOTouchscreenPCI *dev = VIRTIO_TOUCHSCREEN_PCI(vpci_dev); @@ -1561,10 +1567,11 @@ static int virtio_touchscreen_pci_init(VirtIOPCIProxy *vpci_dev) static void virtio_touchscreen_pci_class_init(ObjectClass *klass, void *data) { -// DeviceClass *dc = DEVICE_CLASS(klass); + DeviceClass *dc = DEVICE_CLASS(klass); VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass); PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass); + dc->props = virtio_touchscreen_pci_properties; k->init = virtio_touchscreen_pci_init; pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET; pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_TOUCHSCREEN; @@ -1577,13 +1584,15 @@ static void virtio_touchscreen_pci_instance_init(Object *obj) VirtIOTouchscreenPCI *dev = VIRTIO_TOUCHSCREEN_PCI(obj); object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_TOUCHSCREEN); object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL); + + dev->vdev.max_finger = DEFAULT_MAX_FINGER; } static TypeInfo virtio_touchscreen_pci_info = { .name = TYPE_VIRTIO_TOUCHSCREEN_PCI, .parent = TYPE_VIRTIO_PCI, .instance_size = sizeof(VirtIOTouchscreenPCI), - .instance_init = virtio_touchscreen_pci_instance_init, + .instance_init = virtio_touchscreen_pci_instance_init, .class_init = virtio_touchscreen_pci_class_init, }; diff --git a/qemu-options.hx b/qemu-options.hx index 60b646a572..c0148280ef 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -3110,16 +3110,6 @@ the @var{simple} tracing backend. @end table ETEXI -DEF("max-touch-point", HAS_ARG, QEMU_OPTION_max_touch_point, \ - "-max-touch-point [count]\n" - " define maximum number of touch point\n", - QEMU_ARCH_ALL) -STEXI -@item -max-touch-point @var{max_count} -@findex -max-touch-point -Use @var{max_count} as Integer -ETEXI - DEF("disable-skin", 0, QEMU_OPTION_disable_skin, \ "-disable-skin\n" " do not start with java skin process\n", diff --git a/tizen/src/emulator.c b/tizen/src/emulator.c index 0bd636caa3..f44147a57c 100644 --- a/tizen/src/emulator.c +++ b/tizen/src/emulator.c @@ -42,6 +42,7 @@ #include "guest_debug.h" #include "guest_server.h" #include "hw/maru_camera_common.h" +#include "hw/maru_virtio_touchscreen.h" #include "hw/gloffscreen_test.h" #include "maru_common.h" #include "maru_err_table.h" @@ -135,6 +136,9 @@ static void construct_main_window(int skin_argc, char *skin_argv[], start_skin_server(skin_argc, skin_argv, qemu_argc, qemu_argv); + set_emul_caps_lock_state(0); + set_emul_num_lock_state(0); + /* the next line checks for debugging and etc.. */ if (get_emul_skin_enable() == 1) { if (0 > start_skin_client(skin_argc, skin_argv)) { @@ -142,9 +146,6 @@ static void construct_main_window(int skin_argc, char *skin_argv[], exit(-1); } } - - set_emul_caps_lock_state(0); - set_emul_num_lock_state(0); } static void parse_options(int argc, char *argv[], int *skin_argc, @@ -271,11 +272,21 @@ static void extract_qemu_info(int qemu_argc, char **qemu_argv) if (strstr(qemu_argv[i], IMAGE_PATH_PREFIX) != NULL) { set_image_and_log_path(qemu_argv[i]); } else if (strstr(qemu_argv[i], INPUT_TOUCH_PARAMETER) != NULL) { + /* touchscreen */ set_emul_input_touch_enable(true); + + char *option = strstr(qemu_argv[i] + strlen(INPUT_TOUCH_PARAMETER), TOUCHSCREEN_OPTION_NAME); + if (option != NULL) { + option += strlen(TOUCHSCREEN_OPTION_NAME) + 1; + + set_emul_max_touch_point(atoi(option)); + } } } - if (is_emul_input_touch_enable() != true) + + if (is_emul_input_touch_enable() != true) { set_emul_input_mouse_enable(true); + } } static void extract_skin_info(int skin_argc, char **skin_argv) diff --git a/tizen/src/hw/maru_virtio_touchscreen.c b/tizen/src/hw/maru_virtio_touchscreen.c index b68991ffbb..f157a67ceb 100644 --- a/tizen/src/hw/maru_virtio_touchscreen.c +++ b/tizen/src/hw/maru_virtio_touchscreen.c @@ -311,7 +311,7 @@ static int virtio_touchscreen_device_init(VirtIODevice *vdev) DeviceState *qdev = DEVICE(vdev); ts = VIRTIO_TOUCHSCREEN(vdev); - INFO("initialize the touchscreen device\n"); + INFO("initialize touchscreen device : %d\n", ts->max_finger); virtio_init(vdev, DEVICE_NAME, VIRTIO_ID_TOUCHSCREEN, 4); /*if (ts == NULL) { diff --git a/tizen/src/hw/maru_virtio_touchscreen.h b/tizen/src/hw/maru_virtio_touchscreen.h index 777d3ef7a0..530125d140 100644 --- a/tizen/src/hw/maru_virtio_touchscreen.h +++ b/tizen/src/hw/maru_virtio_touchscreen.h @@ -33,10 +33,13 @@ #include "ui/console.h" #include "hw/virtio/virtio.h" -#define TYPE_VIRTIO_TOUCHSCREEN "virtio-touschreen-device" +#define TYPE_VIRTIO_TOUCHSCREEN "virtio-touchscreen-device" #define VIRTIO_TOUCHSCREEN(obj) \ OBJECT_CHECK(VirtIOTouchscreen, (obj), TYPE_VIRTIO_TOUCHSCREEN) +#define TOUCHSCREEN_OPTION_NAME "max_point" +#define DEFAULT_MAX_FINGER (1) + typedef struct VirtIOTouchscreen { VirtIODevice vdev; /* simply a queue into which buffers are posted @@ -47,6 +50,8 @@ typedef struct VirtIOTouchscreen { QEMUBH *bh; DeviceState *qdev; QEMUPutMouseEntry *eh_entry; + + unsigned int max_finger; } VirtIOTouchscreen; /* This structure must match the kernel definitions */ @@ -58,7 +63,6 @@ typedef struct EmulTouchEvent { VirtIODevice *maru_virtio_touchscreen_init(DeviceState *dev); void maru_virtio_touchscreen_exit(VirtIODevice *vdev); - void virtio_touchscreen_event(void *opaque, int x, int y, int z, int buttons_state); void maru_virtio_touchscreen_notify(void); diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorShmSkin.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorShmSkin.java index 882b6ff173..fa32b1ce3f 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorShmSkin.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorShmSkin.java @@ -560,18 +560,20 @@ public class EmulatorShmSkin extends EmulatorSkin { @Override protected void keyReleasedDelivery(int keyCode, int stateMask, int keyLocation, boolean remove) { - /* check multi-touch */ - if (keyCode == multiTouchKeySub || keyCode == multiTouchKey) { - int tempStateMask = stateMask & ~SWT.BUTTON1; + if (finger.getMaxTouchPoint() > 1) { + /* check multi-touch */ + if (keyCode == multiTouchKeySub || keyCode == multiTouchKey) { + int tempStateMask = stateMask & ~SWT.BUTTON1; - if (tempStateMask == (multiTouchKeySub | multiTouchKey)) { - finger.setMultiTouchEnable(1); + if (tempStateMask == (multiTouchKeySub | multiTouchKey)) { + finger.setMultiTouchEnable(1); - logger.info("enable multi-touch = mode 1"); - } else { - finger.clearFingerSlot(false); + logger.info("enable multi-touch = mode 1"); + } else { + finger.clearFingerSlot(false); - logger.info("disable multi-touch"); + logger.info("disable multi-touch"); + } } } @@ -588,42 +590,43 @@ public class EmulatorShmSkin extends EmulatorSkin { @Override protected void keyPressedDelivery(int keyCode, int stateMask, int keyLocation, boolean add) { - /* TODO: (finger.getMaxTouchPoint() > 1) */ - - int tempStateMask = stateMask & ~SWT.BUTTON1; - - if ((keyCode == multiTouchKeySub && (tempStateMask & multiTouchKey) != 0) || - (keyCode == multiTouchKey && (tempStateMask & multiTouchKeySub) != 0)) - { - finger.setMultiTouchEnable(2); - - /* add a finger before start the multi-touch processing - if already exist the pressed touch in display */ - if (pressingX != -1 && pressingY != -1 && - pressingOriginX != -1 && pressingOriginY != -1) { - finger.addFingerPoint( - pressingOriginX, pressingOriginY, - pressingX, pressingY); - pressingX = pressingY = -1; - pressingOriginX = pressingOriginY = -1; - } + if (finger.getMaxTouchPoint() > 1) { + /* multi-touch checking */ + int tempStateMask = stateMask & ~SWT.BUTTON1; - logger.info("enable multi-touch = mode 2"); - } else if (keyCode == multiTouchKeySub || keyCode == multiTouchKey) { - finger.setMultiTouchEnable(1); - - /* add a finger before start the multi-touch processing - if already exist the pressed touch in display */ - if (pressingX != -1 && pressingY != -1 && - pressingOriginX != -1 && pressingOriginY != -1) { - finger.addFingerPoint( - pressingOriginX, pressingOriginY, - pressingX, pressingY); - pressingX = pressingY = -1; - pressingOriginX = pressingOriginY = -1; - } + if ((keyCode == multiTouchKeySub && (tempStateMask & multiTouchKey) != 0) || + (keyCode == multiTouchKey && (tempStateMask & multiTouchKeySub) != 0)) + { + finger.setMultiTouchEnable(2); + + /* add a finger before start the multi-touch processing + if already exist the pressed touch in display */ + if (pressingX != -1 && pressingY != -1 && + pressingOriginX != -1 && pressingOriginY != -1) { + finger.addFingerPoint( + pressingOriginX, pressingOriginY, + pressingX, pressingY); + pressingX = pressingY = -1; + pressingOriginX = pressingOriginY = -1; + } + + logger.info("enable multi-touch = mode 2"); + } else if (keyCode == multiTouchKeySub || keyCode == multiTouchKey) { + finger.setMultiTouchEnable(1); - logger.info("enable multi-touch = mode 1"); + /* add a finger before start the multi-touch processing + if already exist the pressed touch in display */ + if (pressingX != -1 && pressingY != -1 && + pressingOriginX != -1 && pressingOriginY != -1) { + finger.addFingerPoint( + pressingOriginX, pressingOriginY, + pressingX, pressingY); + pressingX = pressingY = -1; + pressingOriginX = pressingOriginY = -1; + } + + logger.info("enable multi-touch = mode 1"); + } } KeyEventData keyEventData = new KeyEventData( @@ -3905,17 +3905,6 @@ int main(int argc, char **argv, char **envp) "HAX support is disabled, ignoring -enable-hax\n"); #endif break; -#ifdef CONFIG_MARU - case QEMU_OPTION_max_touch_point: - { - int cnt = atoi(optarg); - set_emul_max_touch_point(cnt); - break; - } - case QEMU_OPTION_disable_skin: - skin_disabled = 1; - break; -#endif case QEMU_OPTION_add_fd: #ifndef _WIN32 opts = qemu_opts_parse(qemu_find_opts("add-fd"), optarg, 0); @@ -3929,6 +3918,9 @@ int main(int argc, char **argv, char **envp) #endif break; #ifdef CONFIG_MARU + case QEMU_OPTION_disable_skin: + skin_disabled = 1; + break; case QEMU_OPTION_enable_suspend: ecs_set_suspend_state(SUSPEND_UNLOCK); break; |