[SDL] Add Key and Mouse Event 45/73045/1
authorWonsik, Jung <sidein@samsung.com>
Mon, 6 Jun 2016 00:10:32 +0000 (09:10 +0900)
committerWonsik, Jung <sidein@samsung.com>
Mon, 6 Jun 2016 00:16:37 +0000 (09:16 +0900)
Add Key and Mouse event for tizen port.
These event is based by ecore-input.
This patch is made by Eunyu Eun

Change-Id: I89a5dcf77b4819a9a8dbe52c23f464d4dbcf1c18

configure
configure.in
src/video/tizen/SDL_tizenevents.c
src/video/tizen/SDL_tizenevents_c.h
src/video/tizen/SDL_tizenmouse.c
src/video/tizen/SDL_tizenmouse.h
src/video/tizen/SDL_tizenwindow.c
src/video/tizen/SDL_tizenwindow.h

index 4cd5eea..962c52f 100755 (executable)
--- a/configure
+++ b/configure
@@ -18941,9 +18941,9 @@ $as_echo_n "checking for Tizen support... " >&6; }
         if  test x$PKG_CONFIG != xno && \
             test x$video_opengl_egl = xyes && \
             test x$video_opengles_v2 = xyes; then
-            if $PKG_CONFIG --exists wayland-client wayland-egl ecore ecore-wayland evas eina appcore-efl dlog; then
-                TIZEN_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl ecore ecore-wayland evas eina appcore-efl dlog`
-                TIZEN_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl ecore ecore-wayland evas eina appcore-efl dlog`
+            if $PKG_CONFIG --exists wayland-client wayland-egl ecore ecore-wayland evas eina appcore-efl ecore-input dlog; then
+                TIZEN_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl ecore ecore-wayland evas eina appcore-efl ecore-input dlog`
+                TIZEN_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl ecore ecore-wayland evas eina appcore-efl ecore-input dlog`
                 video_tizen=yes
             fi
         fi
index a031c95..53782ab 100644 (file)
@@ -1269,9 +1269,9 @@ CheckTizen()
         if  test x$PKG_CONFIG != xno && \
             test x$video_opengl_egl = xyes && \
             test x$video_opengles_v2 = xyes; then
-            if $PKG_CONFIG --exists wayland-client wayland-egl ecore ecore-wayland evas eina appcore-efl dlog; then
-                TIZEN_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl ecore ecore-wayland evas eina appcore-efl dlog`
-                TIZEN_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl ecore ecore-wayland evas eina appcore-efl dlog`
+            if $PKG_CONFIG --exists wayland-client wayland-egl ecore ecore-wayland evas eina appcore-efl ecore-input dlog; then
+                TIZEN_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl ecore ecore-wayland evas eina appcore-efl ecore-input dlog`
+                TIZEN_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl ecore ecore-wayland evas eina appcore-efl ecore-input dlog`
                 video_tizen=yes
             fi
         fi
index c77877e..7b200cb 100644 (file)
@@ -41,6 +41,33 @@ Tizen_PumpEvents(_THIS)
     ecore_main_loop_iterate();
 }
 
+Eina_Bool
+__tizen_cb_event_keyup_change(void *data, int type, void *event)
+{
+    printf("SAMPLE EV :key up\n");
+
+    if (!event) return ECORE_CALLBACK_PASS_ON;
+
+    Ecore_Event_Key * e = event;
+    SDL_SendKeyboardKey(SDL_RELEASED, e->keycode);
+
+    return ECORE_CALLBACK_PASS_ON;
+}
+
+Eina_Bool
+__tizen_cb_event_keydown_change(void *data, int type, void *event)
+{
+    printf("SAMPLE EV :key down\n");
+
+    if (!event) return ECORE_CALLBACK_PASS_ON;
+
+    Ecore_Event_Key * e = event;
+    SDL_SendKeyboardKey(SDL_PRESSED, e->keycode);
+
+    return ECORE_CALLBACK_PASS_ON;
+}
+
+
 #endif /* SDL_VIDEO_DRIVER_TIZEN */
 
 /* vi: set ts=4 sw=4 expandtab: */
index c79cbe2..cb1205c 100644 (file)
 
 extern void Tizen_PumpEvents(_THIS);
 
+
+extern Eina_Bool __tizen_cb_event_keyup_change(void *data, int type, void *event);
+
+extern Eina_Bool __tizen_cb_event_keydown_change(void *data, int type, void *event);
+
+
 #endif /* _SDL_tizenevents_h */
 
 /* vi: set ts=4 sw=4 expandtab: */
index c64a48e..733462c 100644 (file)
 */
 
 #include "../../SDL_internal.h"
+#include "SDL_tizenmouse.h"
+
+
+Eina_Bool
+__tizen_cb_event_mousedown_change(void *data, int type, void *event)
+{
+    SDL_VideoDevice *_this = SDL_GetVideoDevice();
+
+    printf("SAMPLE EV :mouse down\n");
+    if (!event) return ECORE_CALLBACK_PASS_ON;
+
+    Ecore_Event_Mouse_Button *e = event;
+    SDL_SendMouseMotion(_this->current_glwin, 0, 0,  e->x, e->y);
+    SDL_SendMouseButton(_this->current_glwin, 0, SDL_PRESSED, SDL_BUTTON_LEFT);
+    return ECORE_CALLBACK_PASS_ON;
+}
+
+Eina_Bool
+__tizen_cb_event_mouseup_change(void *data, int type, void *event)
+{
+    SDL_VideoDevice *_this = SDL_GetVideoDevice();
+    printf("TIZEN EV :mouse up\n");
+    if (!event) return ECORE_CALLBACK_PASS_ON;
+
+    Ecore_Event_Mouse_Button *e = event;
+    SDL_SendMouseMotion(_this->current_glwin, 0, 0,  e->x, e->y);
+    SDL_SendMouseButton(_this->current_glwin, 0, SDL_RELEASED, SDL_BUTTON_LEFT);
+    return ECORE_CALLBACK_PASS_ON;
+}
+
+Eina_Bool
+__tizen_cb_event_mousemove_change(void *data, int type, void *event)
+{
+    SDL_VideoDevice *_this = SDL_GetVideoDevice();
+    printf("TIZEN  : mousemove\n");
+
+    if (!event) return ECORE_CALLBACK_PASS_ON;
+
+    Ecore_Event_Mouse_Move *e = event;
+    SDL_SendMouseMotion(_this->current_glwin, 0, 0,  e->x, e->y);
+
+    return ECORE_CALLBACK_PASS_ON;
+}
+
+
+
 
index ded9243..2c2c0a8 100644 (file)
 #include "../../SDL_internal.h"
 #include "SDL_mouse.h"
 #include "SDL_tizenvideo.h"
+#include "SDL_tizenwindow.h"
+#include "SDL_events.h"
+
+extern Eina_Bool __tizen_cb_event_mouseup_change(void *data, int type, void *event);
+extern Eina_Bool __tizen_cb_event_mousedown_change(void *data, int type, void *event);
+extern Eina_Bool __tizen_cb_event_mousemove_change(void *data, int type, void *event);
+
 
index e87fd4f..6bf6f99 100644 (file)
@@ -31,6 +31,9 @@
 #include "SDL_tizenvideo.h"
 #include "SDL_tizentouch.h"
 
+#include "SDL_tizenmouse.h"
+#include "SDL_tizenevents_c.h"
+
 #include <wayland-egl.h>
 
 SDL_bool
@@ -174,6 +177,17 @@ Tizen_InitWindow(_THIS)
     
     ecore_event_handler_add(ECORE_WL_EVENT_WINDOW_VISIBILITY_CHANGE,
                         __tizen_cb_window_visibility_change, _this);
+    ecore_event_handler_add(ECORE_EVENT_KEY_UP,
+                        __tizen_cb_event_keyup_change,  NULL);
+    ecore_event_handler_add(ECORE_EVENT_KEY_DOWN,
+                        __tizen_cb_event_keydown_change,       NULL);
+
+    ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN,
+                        __tizen_cb_event_mousedown_change,     _this);
+    ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP,
+                        __tizen_cb_event_mouseup_change,       _this);
+    ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE,
+                        __tizen_cb_event_mousemove_change,     _this);
 
     return 0;
 }
index 91519d4..b60ddee 100644 (file)
@@ -19,6 +19,7 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
+#include <Ecore_Input.h>
 
 #include "../../SDL_internal.h"