aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/ecore/src/lib/ecore_psl1ght
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-01-23 23:30:42 +1000
committerDavid Walter Seikel2012-01-23 23:30:42 +1000
commit825a3d837a33f226c879cd02ad15c3fba57e8b2c (patch)
tree75f57bd9c4253508d338dc79ba8e57a7abc42255 /libraries/ecore/src/lib/ecore_psl1ght
parentAdd ability to disable the test harness, or the Lua compile test. (diff)
downloadSledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.zip
SledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.tar.gz
SledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.tar.bz2
SledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.tar.xz
Update the EFL to what I'm actually using, coz I'm using some stuff not yet released.
Diffstat (limited to 'libraries/ecore/src/lib/ecore_psl1ght')
-rw-r--r--libraries/ecore/src/lib/ecore_psl1ght/Ecore_Psl1ght.h13
-rw-r--r--libraries/ecore/src/lib/ecore_psl1ght/Makefile.in14
-rw-r--r--libraries/ecore/src/lib/ecore_psl1ght/ecore_psl1ght.c111
3 files changed, 100 insertions, 38 deletions
diff --git a/libraries/ecore/src/lib/ecore_psl1ght/Ecore_Psl1ght.h b/libraries/ecore/src/lib/ecore_psl1ght/Ecore_Psl1ght.h
index 39331f7..c6300fd 100644
--- a/libraries/ecore/src/lib/ecore_psl1ght/Ecore_Psl1ght.h
+++ b/libraries/ecore/src/lib/ecore_psl1ght/Ecore_Psl1ght.h
@@ -28,6 +28,7 @@ EAPI extern int ECORE_PSL1GHT_EVENT_KEY_MODIFIERS;
28EAPI extern int ECORE_PSL1GHT_EVENT_GOT_FOCUS; 28EAPI extern int ECORE_PSL1GHT_EVENT_GOT_FOCUS;
29EAPI extern int ECORE_PSL1GHT_EVENT_LOST_FOCUS; 29EAPI extern int ECORE_PSL1GHT_EVENT_LOST_FOCUS;
30EAPI extern int ECORE_PSL1GHT_EVENT_EXPOSE; 30EAPI extern int ECORE_PSL1GHT_EVENT_EXPOSE;
31EAPI extern int ECORE_PSL1GHT_EVENT_QUIT;
31 32
32typedef struct _Ecore_Psl1ght_Event_Key_Modifiers Ecore_Psl1ght_Event_Key_Modifiers; 33typedef struct _Ecore_Psl1ght_Event_Key_Modifiers Ecore_Psl1ght_Event_Key_Modifiers;
33struct _Ecore_Psl1ght_Event_Key_Modifiers /** PSL1GHT Key Modifier event */ 34struct _Ecore_Psl1ght_Event_Key_Modifiers /** PSL1GHT Key Modifier event */
@@ -105,14 +106,10 @@ struct _Ecore_Psl1ght_Event_Mouse_Wheel /** PSL1GHT Mouse Wheel event */
105 unsigned int time; 106 unsigned int time;
106}; 107};
107 108
108EAPI int 109EAPI int ecore_psl1ght_init(const char *name);
109 ecore_psl1ght_init(const char *name); 110EAPI int ecore_psl1ght_shutdown(void);
110EAPI int 111EAPI void ecore_psl1ght_resolution_set(int width, int height);
111 ecore_psl1ght_shutdown(void); 112EAPI void ecore_psl1ght_poll_events(void);
112EAPI void
113 ecore_psl1ght_resolution_set(int width, int height);
114EAPI void
115 ecore_psl1ght_poll_events(void);
116 113
117EAPI void ecore_psl1ght_screen_resolution_get(int *w, int *h); 114EAPI void ecore_psl1ght_screen_resolution_get(int *w, int *h);
118EAPI void ecore_psl1ght_optimal_screen_resolution_get(int *w, int *h); 115EAPI void ecore_psl1ght_optimal_screen_resolution_get(int *w, int *h);
diff --git a/libraries/ecore/src/lib/ecore_psl1ght/Makefile.in b/libraries/ecore/src/lib/ecore_psl1ght/Makefile.in
index 9b75b74..487231b 100644
--- a/libraries/ecore/src/lib/ecore_psl1ght/Makefile.in
+++ b/libraries/ecore/src/lib/ecore_psl1ght/Makefile.in
@@ -249,10 +249,10 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
249PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 249PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
250PIXMAN_LIBS = @PIXMAN_LIBS@ 250PIXMAN_LIBS = @PIXMAN_LIBS@
251PKG_CONFIG = @PKG_CONFIG@ 251PKG_CONFIG = @PKG_CONFIG@
252PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
253PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
254POSUB = @POSUB@ 252POSUB = @POSUB@
255RANLIB = @RANLIB@ 253RANLIB = @RANLIB@
254SCIM_CFLAGS = @SCIM_CFLAGS@
255SCIM_LIBS = @SCIM_LIBS@
256SDL_CFLAGS = @SDL_CFLAGS@ 256SDL_CFLAGS = @SDL_CFLAGS@
257SDL_CONFIG = @SDL_CONFIG@ 257SDL_CONFIG = @SDL_CONFIG@
258SDL_LIBS = @SDL_LIBS@ 258SDL_LIBS = @SDL_LIBS@
@@ -271,6 +271,10 @@ TSLIB_LIBS = @TSLIB_LIBS@
271USE_NLS = @USE_NLS@ 271USE_NLS = @USE_NLS@
272VERSION = @VERSION@ 272VERSION = @VERSION@
273VMAJ = @VMAJ@ 273VMAJ = @VMAJ@
274WAYLAND_CFLAGS = @WAYLAND_CFLAGS@
275WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@
276WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@
277WAYLAND_LIBS = @WAYLAND_LIBS@
274WIN32_CFLAGS = @WIN32_CFLAGS@ 278WIN32_CFLAGS = @WIN32_CFLAGS@
275WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ 279WIN32_CPPFLAGS = @WIN32_CPPFLAGS@
276WIN32_LIBS = @WIN32_LIBS@ 280WIN32_LIBS = @WIN32_LIBS@
@@ -384,6 +388,8 @@ ecore_imf_cflags = @ecore_imf_cflags@
384ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ 388ecore_imf_evas_cflags = @ecore_imf_evas_cflags@
385ecore_imf_evas_libs = @ecore_imf_evas_libs@ 389ecore_imf_evas_libs = @ecore_imf_evas_libs@
386ecore_imf_libs = @ecore_imf_libs@ 390ecore_imf_libs = @ecore_imf_libs@
391ecore_imf_scim_cflags = @ecore_imf_scim_cflags@
392ecore_imf_scim_libs = @ecore_imf_scim_libs@
387ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ 393ecore_imf_xim_cflags = @ecore_imf_xim_cflags@
388ecore_imf_xim_libs = @ecore_imf_xim_libs@ 394ecore_imf_xim_libs = @ecore_imf_xim_libs@
389ecore_input_cflags = @ecore_input_cflags@ 395ecore_input_cflags = @ecore_input_cflags@
@@ -396,6 +402,8 @@ ecore_psl1ght_cflags = @ecore_psl1ght_cflags@
396ecore_psl1ght_libs = @ecore_psl1ght_libs@ 402ecore_psl1ght_libs = @ecore_psl1ght_libs@
397ecore_sdl_cflags = @ecore_sdl_cflags@ 403ecore_sdl_cflags = @ecore_sdl_cflags@
398ecore_sdl_libs = @ecore_sdl_libs@ 404ecore_sdl_libs = @ecore_sdl_libs@
405ecore_wayland_cflags = @ecore_wayland_cflags@
406ecore_wayland_libs = @ecore_wayland_libs@
399ecore_win32_cflags = @ecore_win32_cflags@ 407ecore_win32_cflags = @ecore_win32_cflags@
400ecore_win32_libs = @ecore_win32_libs@ 408ecore_win32_libs = @ecore_win32_libs@
401ecore_wince_cflags = @ecore_wince_cflags@ 409ecore_wince_cflags = @ecore_wince_cflags@
@@ -440,12 +448,14 @@ requirements_ecore_fb = @requirements_ecore_fb@
440requirements_ecore_file = @requirements_ecore_file@ 448requirements_ecore_file = @requirements_ecore_file@
441requirements_ecore_imf = @requirements_ecore_imf@ 449requirements_ecore_imf = @requirements_ecore_imf@
442requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ 450requirements_ecore_imf_evas = @requirements_ecore_imf_evas@
451requirements_ecore_imf_scim = @requirements_ecore_imf_scim@
443requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ 452requirements_ecore_imf_xim = @requirements_ecore_imf_xim@
444requirements_ecore_input = @requirements_ecore_input@ 453requirements_ecore_input = @requirements_ecore_input@
445requirements_ecore_input_evas = @requirements_ecore_input_evas@ 454requirements_ecore_input_evas = @requirements_ecore_input_evas@
446requirements_ecore_ipc = @requirements_ecore_ipc@ 455requirements_ecore_ipc = @requirements_ecore_ipc@
447requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ 456requirements_ecore_psl1ght = @requirements_ecore_psl1ght@
448requirements_ecore_sdl = @requirements_ecore_sdl@ 457requirements_ecore_sdl = @requirements_ecore_sdl@
458requirements_ecore_wayland = @requirements_ecore_wayland@
449requirements_ecore_win32 = @requirements_ecore_win32@ 459requirements_ecore_win32 = @requirements_ecore_win32@
450requirements_ecore_wince = @requirements_ecore_wince@ 460requirements_ecore_wince = @requirements_ecore_wince@
451requirements_ecore_x = @requirements_ecore_x@ 461requirements_ecore_x = @requirements_ecore_x@
diff --git a/libraries/ecore/src/lib/ecore_psl1ght/ecore_psl1ght.c b/libraries/ecore/src/lib/ecore_psl1ght/ecore_psl1ght.c
index 64cef9f..16487ad 100644
--- a/libraries/ecore/src/lib/ecore_psl1ght/ecore_psl1ght.c
+++ b/libraries/ecore/src/lib/ecore_psl1ght/ecore_psl1ght.c
@@ -31,6 +31,7 @@ EAPI int ECORE_PSL1GHT_EVENT_KEY_MODIFIERS = 0;
31EAPI int ECORE_PSL1GHT_EVENT_GOT_FOCUS = 0; 31EAPI int ECORE_PSL1GHT_EVENT_GOT_FOCUS = 0;
32EAPI int ECORE_PSL1GHT_EVENT_LOST_FOCUS = 0; 32EAPI int ECORE_PSL1GHT_EVENT_LOST_FOCUS = 0;
33EAPI int ECORE_PSL1GHT_EVENT_EXPOSE = 0; 33EAPI int ECORE_PSL1GHT_EVENT_EXPOSE = 0;
34EAPI int ECORE_PSL1GHT_EVENT_QUIT = 0;
34 35
35static int _ecore_psl1ght_init_count = 0; 36static int _ecore_psl1ght_init_count = 0;
36static int window_width = 0; 37static int window_width = 0;
@@ -47,6 +48,7 @@ static KbMkey keyboard_mods = {{0}};
47static u16 keyboard_old_key = 0; 48static u16 keyboard_old_key = 0;
48/* Pad support */ 49/* Pad support */
49static padData pad_data; 50static padData pad_data;
51static padData old_pad_data = {0};
50static int pad_old_x = 0; 52static int pad_old_x = 0;
51static int pad_old_o = 0; 53static int pad_old_o = 0;
52/* Move support */ 54/* Move support */
@@ -148,6 +150,7 @@ ecore_psl1ght_init(const char *name __UNUSED__)
148 ECORE_PSL1GHT_EVENT_LOST_FOCUS = ecore_event_type_new(); 150 ECORE_PSL1GHT_EVENT_LOST_FOCUS = ecore_event_type_new();
149 ECORE_PSL1GHT_EVENT_EXPOSE = ecore_event_type_new(); 151 ECORE_PSL1GHT_EVENT_EXPOSE = ecore_event_type_new();
150 ECORE_PSL1GHT_EVENT_KEY_MODIFIERS = ecore_event_type_new(); 152 ECORE_PSL1GHT_EVENT_KEY_MODIFIERS = ecore_event_type_new();
153 ECORE_PSL1GHT_EVENT_QUIT = ecore_event_type_new();
151 154
152 mouse_x = 0; 155 mouse_x = 0;
153 mouse_y = 0; 156 mouse_y = 0;
@@ -175,6 +178,7 @@ ecore_psl1ght_shutdown(void)
175 ECORE_PSL1GHT_EVENT_LOST_FOCUS = 0; 178 ECORE_PSL1GHT_EVENT_LOST_FOCUS = 0;
176 ECORE_PSL1GHT_EVENT_EXPOSE = 0; 179 ECORE_PSL1GHT_EVENT_EXPOSE = 0;
177 ECORE_PSL1GHT_EVENT_KEY_MODIFIERS = 0; 180 ECORE_PSL1GHT_EVENT_KEY_MODIFIERS = 0;
181 ECORE_PSL1GHT_EVENT_QUIT = 0;
178 182
179 ioPadEnd(); 183 ioPadEnd();
180 ioMouseEnd(); 184 ioMouseEnd();
@@ -354,7 +358,6 @@ _ecore_psl1ght_event_key(u16 key)
354 ev->event_window = 0; 358 ev->event_window = 0;
355 ev->modifiers = _ecore_psl1ght_get_modifiers(); 359 ev->modifiers = _ecore_psl1ght_get_modifiers();
356 360
357 printf ("Key is %X\n", key);
358 key &= ~KB_KEYPAD; 361 key &= ~KB_KEYPAD;
359 for (i = 0; i < sizeof(keystable) / sizeof(struct _ecore_psl1ght_keys_s); ++i) 362 for (i = 0; i < sizeof(keystable) / sizeof(struct _ecore_psl1ght_keys_s); ++i)
360 if (keystable[i].code == key) 363 if (keystable[i].code == key)
@@ -364,13 +367,11 @@ _ecore_psl1ght_event_key(u16 key)
364 ev->string = keystable[i].compose; 367 ev->string = keystable[i].compose;
365 ev->compose = keystable[i].compose; 368 ev->compose = keystable[i].compose;
366 369
367 printf ("Found key '%s' in the table\n", ev->keyname);
368 return ev; 370 return ev;
369 } 371 }
370 372
371 utf16 = ioKbCnvRawCode (KB_MAPPING_101, keyboard_mods, keyboard_leds, key); 373 utf16 = ioKbCnvRawCode (KB_MAPPING_101, keyboard_mods, keyboard_leds, key);
372 unicodeToUtf8(utf16, utf8); 374 unicodeToUtf8(utf16, utf8);
373 printf ("Converting to utf16 : %X - utf8 : %s\n", utf16, utf8);
374 ev->keyname = ev->key = ev->string = ev->compose = strdup (utf8); 375 ev->keyname = ev->key = ev->string = ev->compose = strdup (utf8);
375 376
376 return ev; 377 return ev;
@@ -460,6 +461,30 @@ _ecore_psl1ght_mouse_wheel(s8 wheel, s8 tilt)
460 ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, NULL, NULL); 461 ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, NULL, NULL);
461} 462}
462 463
464static void
465_ecore_psl1ght_pad_button (const char *name, int pressed)
466{
467 Ecore_Event_Key *ev = NULL;
468
469 ev = malloc(sizeof(Ecore_Event_Key));
470 if (!ev) return;
471
472 ev->timestamp = _ecore_psl1ght_get_time ();
473 ev->window = 0;
474 ev->event_window = 0;
475 ev->modifiers = 0;
476
477 ev->keyname = name;
478 ev->key = name;
479 ev->string = "";
480 ev->compose = "";
481
482 if (pressed)
483 ecore_event_add(ECORE_EVENT_KEY_DOWN, ev, NULL, NULL);
484 else
485 ecore_event_add(ECORE_EVENT_KEY_UP, ev, NULL, NULL);
486}
487
463#define PAD_STICK_DEADZONE 0x20 488#define PAD_STICK_DEADZONE 0x20
464 489
465static void 490static void
@@ -502,15 +527,44 @@ _ecore_psl1ght_poll_joypad(void)
502 if (analog_h != 0 || analog_v != 0) 527 if (analog_h != 0 || analog_v != 0)
503 _ecore_psl1ght_mouse_move (analog_h, analog_v); 528 _ecore_psl1ght_mouse_move (analog_h, analog_v);
504 529
505 if (pad_old_x != pad_data.BTN_CROSS) 530 if (old_pad_data.BTN_CROSS ^ pad_data.BTN_CROSS) {
531 _ecore_psl1ght_pad_button ("Cross", pad_data.BTN_CROSS);
506 _ecore_psl1ght_mouse_button (1, pad_data.BTN_CROSS); 532 _ecore_psl1ght_mouse_button (1, pad_data.BTN_CROSS);
507 if (pad_old_o != pad_data.BTN_CIRCLE) 533 }
534 if (old_pad_data.BTN_CIRCLE ^ pad_data.BTN_CIRCLE) {
535 _ecore_psl1ght_pad_button ("Circle", pad_data.BTN_CIRCLE);
508 _ecore_psl1ght_mouse_button (3, pad_data.BTN_CIRCLE); 536 _ecore_psl1ght_mouse_button (3, pad_data.BTN_CIRCLE);
509 537 }
510 pad_old_x = pad_data.BTN_CROSS; 538 if (old_pad_data.BTN_SQUARE ^ pad_data.BTN_SQUARE)
511 pad_old_o = pad_data.BTN_CIRCLE; 539 _ecore_psl1ght_pad_button ("Square", pad_data.BTN_SQUARE);
512 540 if (old_pad_data.BTN_TRIANGLE ^ pad_data.BTN_TRIANGLE)
513 //pad_buttons = paddata.buttons; 541 _ecore_psl1ght_pad_button ("Triangle", pad_data.BTN_TRIANGLE);
542 if (old_pad_data.BTN_UP ^ pad_data.BTN_UP)
543 _ecore_psl1ght_pad_button ("Up", pad_data.BTN_UP);
544 if (old_pad_data.BTN_DOWN ^ pad_data.BTN_DOWN)
545 _ecore_psl1ght_pad_button ("Down", pad_data.BTN_DOWN);
546 if (old_pad_data.BTN_LEFT ^ pad_data.BTN_LEFT)
547 _ecore_psl1ght_pad_button ("Left", pad_data.BTN_LEFT);
548 if (old_pad_data.BTN_RIGHT ^ pad_data.BTN_RIGHT)
549 _ecore_psl1ght_pad_button ("Right", pad_data.BTN_RIGHT);
550 if (old_pad_data.BTN_L1 ^ pad_data.BTN_L1)
551 _ecore_psl1ght_pad_button ("L1", pad_data.BTN_L1);
552 if (old_pad_data.BTN_L2 ^ pad_data.BTN_L2)
553 _ecore_psl1ght_pad_button ("L2", pad_data.BTN_L2);
554 if (old_pad_data.BTN_L3 ^ pad_data.BTN_L3)
555 _ecore_psl1ght_pad_button ("L3", pad_data.BTN_L3);
556 if (old_pad_data.BTN_R1 ^ pad_data.BTN_R1)
557 _ecore_psl1ght_pad_button ("R1", pad_data.BTN_R1);
558 if (old_pad_data.BTN_R2 ^ pad_data.BTN_R2)
559 _ecore_psl1ght_pad_button ("R2", pad_data.BTN_R2);
560 if (old_pad_data.BTN_R3 ^ pad_data.BTN_R3)
561 _ecore_psl1ght_pad_button ("R3", pad_data.BTN_R3);
562 if (old_pad_data.BTN_START ^ pad_data.BTN_START)
563 _ecore_psl1ght_pad_button ("Start", pad_data.BTN_START);
564 if (old_pad_data.BTN_SELECT ^ pad_data.BTN_SELECT)
565 _ecore_psl1ght_pad_button ("Select", pad_data.BTN_SELECT);
566
567 old_pad_data = pad_data;
514 } 568 }
515 } 569 }
516} 570}
@@ -602,7 +656,7 @@ _ecore_psl1ght_poll_move(void)
602 656
603 case 4: 657 case 4:
604 // Move button 658 // Move button
605 printf ("Calibrating\n"); 659 //printf ("Calibrating\n");
606 gemCalibrate (0); 660 gemCalibrate (0);
607 calibrated = 1; 661 calibrated = 1;
608 break; 662 break;
@@ -717,23 +771,24 @@ _ecore_psl1ght_poll_keyboard(void)
717static void 771static void
718xmb_event_handler(u64 status, u64 param, void *user_data) 772xmb_event_handler(u64 status, u64 param, void *user_data)
719{ 773{
720 printf ("Received event %lX\n", status); 774 //printf ("Received event %lX\n", status);
721 if (status == SYSUTIL_EXIT_GAME) 775 switch (status) {
722 { 776 case SYSUTIL_EXIT_GAME:
723 ecore_main_loop_quit(); 777 ecore_event_add(ECORE_PSL1GHT_EVENT_QUIT, NULL, NULL, NULL);
724 } 778 break;
725 else if (status == SYSUTIL_MENU_OPEN) 779 case SYSUTIL_DRAW_BEGIN:
726 { 780 ecore_event_add(ECORE_PSL1GHT_EVENT_EXPOSE, NULL, NULL, NULL);
727 } 781 case SYSUTIL_MENU_OPEN:
728 else if (status == SYSUTIL_MENU_CLOSE) 782 ecore_event_add(ECORE_PSL1GHT_EVENT_LOST_FOCUS, NULL, NULL, NULL);
729 { 783 break;
730 } 784 case SYSUTIL_DRAW_END:
731 else if (status == SYSUTIL_DRAW_BEGIN) 785 ecore_event_add(ECORE_PSL1GHT_EVENT_EXPOSE, NULL, NULL, NULL);
732 { 786 case SYSUTIL_MENU_CLOSE:
733 } 787 ecore_event_add(ECORE_PSL1GHT_EVENT_GOT_FOCUS, NULL, NULL, NULL);
734 else if (status == SYSUTIL_DRAW_END) 788 break;
735 { 789 default:
736 } 790 break;
791 }
737} 792}
738 793
739EAPI void 794EAPI void