obj-y += emulator.o emul_state.o process.o option.o maru_signal.o
# display
-obj-y += maru_sdl.o sdl_rotate.o sdl_zoom.o
+obj-y += maru_sdl.o sdl_rotate.o sdl_zoom.o maru_finger.o
# sdb
obj-y += sdb.o
-# mloop_event
+# mloop event
obj-y += mloop_event.o
-# debugch
+# debug channel
obj-y += debug_ch.o
-# maru hw
+# maru hardware
obj-i386-y += maru_board.o
obj-i386-y += maru_overlay.o
obj-i386-y += maru_codec.o
MULTI_DEBUG_CHANNEL(qemu, emul_state);
-static emulator_config_info _emul_info;
-static emulator_config_state _emul_state;
+static EmulatorConfigInfo _emul_info;
+static EmulatorConfigState _emul_state;
/* lcd screen size */
void set_emul_lcd_size(int width, int height)
{
return _emul_state.rotation_type;
}
+
+/* emulator multi-touch */
+MultiTouchState *get_emul_multi_touch_state(void)
+{
+ return &(_emul_state.qemu_mts);
+}
#ifndef __EMUL_STATE_H__
#define __EMUL_STATE_H__
+#include "maru_common.h"
+#include "maru_finger.h"
+
enum {
ROTATION_PORTRAIT = 0,
ROTATION_LANDSCAPE = 1,
};
-typedef struct emulator_config_info {
+typedef struct EmulatorConfigInfo {
char emulator_name[256];
int lcd_size_w;
int lcd_size_h;
+ int dpi;
//TODO:
-} emulator_config_info;
+} EmulatorConfigInfo;
-typedef struct emulator_config_state {
+typedef struct EmulatorConfigState {
double scale_factor;
short rotation_type;
+ MultiTouchState qemu_mts;
//TODO:
-} emulator_config_state;
+} EmulatorConfigState;
/* setter */
int get_emul_lcd_height(void);
double get_emul_win_scale(void);
short get_emul_rotation(void);
+MultiTouchState *get_emul_multi_touch_state(void);
#endif /* __EMUL_STATE_H__ */
--- /dev/null
+/*
+ * Multi-touch processing
+ *
+ * Copyright (C) 2011, 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * HyunJun Son <hj79.son@samsung.com>
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@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 <glib.h>
+#include "maru_finger.h"
+#include "emul_state.h"
+#include "debug_ch.h"
+
+MULTI_DEBUG_CHANNEL(qemu, maru_finger);
+
+
+void init_multi_touch_state(void)
+{
+ int i;
+ MultiTouchState* mts = get_emul_multi_touch_state();
+ FingerPoint *finger = NULL;
+ INFO("multi-touch state initailize\n");
+
+ mts->multitouch_enable = 0;
+ mts->finger_cnt_max = MAX_FINGER_CNT; //temp
+ mts->finger_cnt = 0;
+
+ if (mts->finger_slot != NULL) {
+ g_free(mts->finger_slot);
+ mts->finger_slot = NULL;
+ }
+ mts->finger_slot = (FingerPoint *)g_malloc0(sizeof(FingerPoint) * mts->finger_cnt_max);
+ for (i = 0; i < mts->finger_cnt; i++) {
+ finger = get_finger_point_from_slot(i);
+ //finger->id = 0;
+ finger->x = finger->y = -1;
+ }
+
+ mts->finger_point_size = DEFAULT_FINGER_POINT_SIZE; //temp
+ mts->finger_point_color = DEFAULT_FINGER_POINT_COLOR; //temp
+ mts->finger_point_outline_color = DEFAULT_FINGER_POINT_OUTLINE_COLOR; //temp
+}
+
+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 x, int y)
+{
+ MultiTouchState *mts = get_emul_multi_touch_state();
+
+ if (mts->finger_cnt == mts->finger_cnt_max) {
+ return -1;
+ }
+
+ mts->finger_cnt++;
+
+ mts->finger_slot[mts->finger_cnt - 1].id = mts->finger_cnt;
+ mts->finger_slot[mts->finger_cnt - 1].x = x;
+ mts->finger_slot[mts->finger_cnt - 1].y = y;
+ INFO("%d finger touching\n", mts->finger_cnt);
+
+ return mts->finger_cnt;
+}
+
+FingerPoint *get_finger_point_from_slot(int index)
+{
+ MultiTouchState *mts = get_emul_multi_touch_state();
+
+ if (index < 0 || index > mts->finger_cnt_max) {
+ return NULL;
+ }
+
+ return &(mts->finger_slot[index]);
+}
+
+void clear_finger_slot(void)
+{
+ int i;
+ MultiTouchState *mts = get_emul_multi_touch_state();
+ FingerPoint *finger = NULL;
+
+ for (i = 0; i < mts->finger_cnt; i++) {
+ finger = get_finger_point_from_slot(i);
+ finger->id = 0;
+ finger->x = finger->y = -1;
+ }
+}
--- /dev/null
+/*
+ * Multi-touch processing
+ *
+ * Copyright (C) 2011, 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * HyunJun Son <hj79.son@samsung.com>
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@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 __MARU_FINGER_H__
+#define __MARU_FINGER_H__
+
+
+/* multi-touch related definitions */
+//TODO : from arg
+#define MAX_FINGER_CNT 2
+#define DEFAULT_FINGER_POINT_SIZE 32
+#define DEFAULT_FINGER_POINT_COLOR 0x7E0f0f0f
+#define DEFAULT_FINGER_POINT_OUTLINE_COLOR 0xDDDDDDDD
+
+typedef struct FingerPoint {
+ int id;
+ int x;
+ int y;
+} FingerPoint;
+
+typedef struct MultiTouchState {
+ int multitouch_enable;
+ int finger_cnt;
+ int finger_cnt_max;
+ FingerPoint *finger_slot;
+
+ int finger_point_size;
+ int finger_point_color;
+ int finger_point_outline_color;
+ void *finger_point; //SDL_Surface
+} MultiTouchState;
+
+
+void init_multi_touch_state(void);
+void set_multi_touch_enable(int enable);
+int get_multi_touch_enable(void);
+int add_finger_point(int x, int y);
+FingerPoint *get_finger_point_from_slot(int index);
+void clear_finger_slot(void);
+
+#endif /* __MARU_FINGER_H__ */
#include "maru_sdl.h"
#include "emul_state.h"
#include "sdl_rotate.h"
+#include "maru_finger.h"
#include "debug_ch.h"
MULTI_DEBUG_CHANNEL(tizen, maru_sdl);
#endif
sdl_initialized = 1;
+ init_multi_touch_state();
}
-void maruskin_sdl_resize()
+void maruskin_sdl_resize(void)
{
SDL_Event ev;
#include "maruskin_keymap.h"
-/* keep it consistent with java virtual keycode */
-#define JAVA_KEYCODE_BIT (1 << 24)
-#define JAVA_KEYCODE_BIT_CTRL (1 << 18)
-#define JAVA_KEYCODE_BIT_SHIFT (1 << 17)
-#define JAVA_KEYCODE_BIT_ALT (1 << 16)
-
-#define JAVA_KEY_MASK 0xFFFF;
-
-enum JAVA_KEYCODE {
- JAVA_KEY_ARROW_UP = 1,
- JAVA_KEY_ARROW_DOWN,
- JAVA_KEY_ARROW_LEFT,
- JAVA_KEY_ARROW_RIGHT,
- JAVA_KEY_PAGE_UP,
- JAVA_KEY_PAGE_DOWN,
- JAVA_KEY_HOME,
- JAVA_KEY_END,
- JAVA_KEY_INSERT,
- JAVA_KEY_F1 = 10,
- JAVA_KEY_F20 = 29,
- JAVA_KEY_CAPS_LOCK = 82,
- JAVA_KEY_NUM_LOCK,
- JAVA_KEY_SCROLL_LOCK,
- JAVA_KEY_PAUSE,
- JAVA_KEY_BREAK,
- JAVA_KEY_PRINT_SCREEN
-};
-
-
int javakeycode_to_scancode(int java_keycode)
{
int state_mask = java_keycode & JAVA_KEYCODE_BIT;
#ifndef MARUSKIN_KEYMAP_H_
#define MARUSKIN_KEYMAP_H_
+
+/* keep it consistent with java virtual keycode */
+#define JAVA_KEYCODE_BIT (1 << 24)
+#define JAVA_KEYCODE_BIT_CTRL (1 << 18)
+#define JAVA_KEYCODE_BIT_SHIFT (1 << 17)
+#define JAVA_KEYCODE_BIT_ALT (1 << 16)
+
+#define JAVA_KEY_MASK 0xFFFF;
+
+enum JAVA_KEYCODE {
+ JAVA_KEY_ARROW_UP = 1,
+ JAVA_KEY_ARROW_DOWN,
+ JAVA_KEY_ARROW_LEFT,
+ JAVA_KEY_ARROW_RIGHT,
+ JAVA_KEY_PAGE_UP,
+ JAVA_KEY_PAGE_DOWN,
+ JAVA_KEY_HOME,
+ JAVA_KEY_END,
+ JAVA_KEY_INSERT,
+ JAVA_KEY_F1 = 10,
+ JAVA_KEY_F20 = 29,
+ JAVA_KEY_CAPS_LOCK = 82,
+ JAVA_KEY_NUM_LOCK,
+ JAVA_KEY_SCROLL_LOCK,
+ JAVA_KEY_PAUSE,
+ JAVA_KEY_BREAK,
+ JAVA_KEY_PRINT_SCREEN
+};
+
+
/*#include <curses.h>
#define SCANCODE_GREY 0x80
void do_mouse_event( int event_type, int x, int y, int z ) {
TRACE( "mouse_event event_type:%d, x:%d, y:%d, z:%d\n", event_type, x, y, z );
+ if (get_emul_multi_touch_state()->multitouch_enable == 1 && MOUSE_DOWN == event_type) {
+ int finger_cnt = add_finger_point(x, y);
+ //TODO:
+ }
+
if ( MOUSE_DOWN == event_type || MOUSE_DRAG == event_type) {
kbd_mouse_event(x, y, z, 1);
} else if (MOUSE_UP == event_type) {
void do_key_event( int event_type, int keycode ) {
TRACE( "key_event event_type:%d, keycode:%d\n", event_type, keycode );
+ //check for multi-touch
+ if (keycode == JAVA_KEYCODE_BIT_CTRL) {
+ if (KEY_PRESSED == event_type) {
+ get_emul_multi_touch_state()->multitouch_enable = 1;
+ INFO("multi-touch enabled\n");
+ } else if (KEY_RELEASED == event_type) {
+ get_emul_multi_touch_state()->multitouch_enable = 0;
+ clear_finger_slot();
+ INFO("multi-touch disabled\n");
+ }
+ }
+
if (!mloop_evcmd_get_usbkbd_status()) {
return;
}