From 281bbd90fdb3942922e931bcd7f364e9204a1488 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Fri, 22 Aug 2014 00:47:19 +0200 Subject: [PATCH] move to use Ecore and Ecore_Evas. --- configure.ac | 164 +-- src/bin/Makefile.am | 106 +- src/bin/engine_direct3d.h | 20 - src/bin/engine_directfb.c | 277 ---- src/bin/engine_directfb.h | 8 - src/bin/engine_drm.c | 49 - src/bin/engine_drm.h | 8 - src/bin/engine_fb.c | 42 - src/bin/engine_fb.h | 8 - src/bin/engine_gl_cocoa.h | 8 - src/bin/engine_gl_sdl.c | 174 --- src/bin/engine_gl_sdl.h | 8 - src/bin/engine_gl_x11.c | 223 --- src/bin/engine_gl_x11.h | 8 - src/bin/engine_psl1ght.c | 284 ---- src/bin/engine_psl1ght.h | 8 - src/bin/engine_software_16_wince.c | 324 ---- src/bin/engine_software_16_wince.h | 10 - src/bin/engine_software_ddraw.h | 19 - src/bin/engine_software_gdi.c | 293 ---- src/bin/engine_software_gdi.h | 19 - src/bin/engine_software_sdl.c | 242 --- src/bin/engine_software_sdl.h | 8 - src/bin/engine_software_xcb.c | 399 ----- src/bin/engine_software_xcb.h | 8 - src/bin/engine_software_xlib.c | 236 --- src/bin/engine_software_xlib.h | 8 - src/bin/engine_wayland_common.c | 152 -- src/bin/engine_wayland_common.h | 10 - src/bin/engine_wayland_egl.c | 112 -- src/bin/engine_wayland_egl.h | 8 - src/bin/engine_wayland_shm.c | 126 -- src/bin/engine_wayland_shm.h | 8 - src/bin/engine_xrender_x11.c | 221 --- src/bin/engine_xrender_x11.h | 8 - src/bin/engine_xrender_xcb.c | 405 ----- src/bin/engine_xrender_xcb.h | 8 - src/bin/image_data_argb.c | 2 +- src/bin/image_data_argb_alpha.c | 2 +- src/bin/image_data_ycbcr601pl.c | 2 +- .../image_data_ycbcr601pl_map_solid_rotate.c | 2 +- src/bin/image_map_3d_1.c | 2 +- src/bin/image_map_3d_2.c | 2 +- src/bin/image_map_3d_3.c | 2 +- src/bin/image_map_3d_4.c | 2 +- src/bin/image_map_3d_5.c | 2 +- src/bin/image_map_3d_6.c | 2 +- src/bin/image_map_3d_flow.c | 2 +- .../image_map_color_alpha_nearest_rotate.c | 2 +- ...age_map_color_alpha_nearest_solid_rotate.c | 2 +- src/bin/image_map_color_alpha_rotate.c | 2 +- src/bin/image_map_color_alpha_solid_rotate.c | 2 +- src/bin/image_map_color_nearest_rotate.c | 2 +- .../image_map_color_nearest_solid_rotate.c | 2 +- src/bin/image_map_color_rotate.c | 2 +- src/bin/image_map_color_solid_rotate.c | 2 +- src/bin/image_map_nearest_rotate.c | 2 +- src/bin/image_map_nearest_solid_rotate.c | 2 +- src/bin/image_map_rotate.c | 2 +- src/bin/image_map_solid_rotate.c | 2 +- src/bin/main.c | 430 +++--- src/bin/main.h | 62 +- src/bin/ui.c | 1301 +++++++---------- src/bin/ui.h | 21 +- 64 files changed, 786 insertions(+), 5093 deletions(-) delete mode 100644 src/bin/engine_direct3d.h delete mode 100644 src/bin/engine_directfb.c delete mode 100644 src/bin/engine_directfb.h delete mode 100644 src/bin/engine_drm.c delete mode 100644 src/bin/engine_drm.h delete mode 100644 src/bin/engine_fb.c delete mode 100644 src/bin/engine_fb.h delete mode 100644 src/bin/engine_gl_cocoa.h delete mode 100644 src/bin/engine_gl_sdl.c delete mode 100644 src/bin/engine_gl_sdl.h delete mode 100644 src/bin/engine_gl_x11.c delete mode 100644 src/bin/engine_gl_x11.h delete mode 100644 src/bin/engine_psl1ght.c delete mode 100644 src/bin/engine_psl1ght.h delete mode 100644 src/bin/engine_software_16_wince.c delete mode 100644 src/bin/engine_software_16_wince.h delete mode 100644 src/bin/engine_software_ddraw.h delete mode 100644 src/bin/engine_software_gdi.c delete mode 100644 src/bin/engine_software_gdi.h delete mode 100644 src/bin/engine_software_sdl.c delete mode 100644 src/bin/engine_software_sdl.h delete mode 100644 src/bin/engine_software_xcb.c delete mode 100644 src/bin/engine_software_xcb.h delete mode 100644 src/bin/engine_software_xlib.c delete mode 100644 src/bin/engine_software_xlib.h delete mode 100644 src/bin/engine_wayland_common.c delete mode 100644 src/bin/engine_wayland_common.h delete mode 100644 src/bin/engine_wayland_egl.c delete mode 100644 src/bin/engine_wayland_egl.h delete mode 100644 src/bin/engine_wayland_shm.c delete mode 100644 src/bin/engine_wayland_shm.h delete mode 100644 src/bin/engine_xrender_x11.c delete mode 100644 src/bin/engine_xrender_x11.h delete mode 100644 src/bin/engine_xrender_xcb.c delete mode 100644 src/bin/engine_xrender_xcb.h diff --git a/configure.ac b/configure.ac index 43b52a8..bccd4ce 100644 --- a/configure.ac +++ b/configure.ac @@ -16,86 +16,6 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) PKG_PROG_PKG_CONFIG -### Additional options to configure - -## Simple X11 build/link - -## Evas engines - -AC_ARG_ENABLE(simple-x11, - [AC_HELP_STRING([--enable-simple-x11], [enable simple x11 linking])], - [want_evas_simple_x11=$enableval] -) - -# Software X11 -have_software_xlib="no" -have_software_xcb="no" -EXPEDITE_CHECK_ENGINE([software-x11], [Software X11], "yes") - -if test "x${have_software_x11}" = "xyes" ; then - have_software_xlib=`${PKG_CONFIG} --variable=Xlib evas-software-x11` - if test "x${have_software_xlib}" = "xstatic" ; then - have_software_xlib="yes" - fi - if test "x${have_software_xlib}" = "xyes" ; then - AC_DEFINE(HAVE_EVAS_SOFTWARE_XLIB, 1, [Evas Software Xlib Engine Support]) - fi - have_software_xcb=`${PKG_CONFIG} --variable=XCB evas-software-x11` - if test "x${have_software_xcb}" = "xstatic" ; then - have_software_xcb="yes" - fi - if test "x${have_software_xcb}" = "xyes" ; then - AC_DEFINE(HAVE_EVAS_SOFTWARE_XCB, 1, [Evas Software XCB Engine Support]) - fi -fi - -AM_CONDITIONAL([BUILD_SOFTWARE_XLIB], [test "x${have_software_xlib}" = "xyes"]) -AM_CONDITIONAL([BUILD_SOFTWARE_XCB], [test "x${have_software_xcb}" = "xyes"]) - -# XRender X11 -EXPEDITE_CHECK_ENGINE([xrender-x11], [XRender X11], "yes") - -# OpenGL X11 -EXPEDITE_CHECK_ENGINE([opengl-x11], [OpenGL X11], "yes") - -# XRender XCB -EXPEDITE_CHECK_ENGINE([xrender-xcb], [XRender XCB], "yes") - -# GDI -EXPEDITE_CHECK_ENGINE([software-gdi], [Software GDI], "yes", [gdi_libs="-lgdi32"]) -AC_SUBST(gdi_libs) - -# DirectDraw -EXPEDITE_CHECK_ENGINE([software-ddraw], [Software DirectDraw], "yes", [ddraw_libs="-lddraw -ldxguid -lgdi32"]) -AC_SUBST(ddraw_libs) - -# Direct3D -EXPEDITE_CHECK_ENGINE([direct3d], [Direct3D], "yes", [d3d_libs="-ld3d9 -ld3dx9d -lgdi32"]) -AC_SUBST(d3d_libs) - -# PSL1GHT -EXPEDITE_CHECK_ENGINE([psl1ght], [PSL1GHT], "yes") - -# GL SDL -EXPEDITE_CHECK_ENGINE([opengl-sdl], [OpenGL SDL], "yes") - -# FB -EXPEDITE_CHECK_ENGINE([fb], [Framebuffer], "yes") - -# DIRECTFB -EXPEDITE_CHECK_ENGINE([directfb], [DirectFB], "yes") - -# GL Cocoa -EXPEDITE_CHECK_ENGINE([opengl-cocoa], [OpenGL Cocoa], "yes", [gl_cocoa_libs="-framework Cocoa"]) -AC_SUBST(gl_cocoa_libs) - -# 16bit WinCE -EXPEDITE_CHECK_ENGINE([software-16-wince], [Software 16 bits WinCE], "yes", [wince_16_libs="-laygshell"]) -AC_SUBST(wince_16_libs) - -# DRM -EXPEDITE_CHECK_ENGINE([drm], [Drm], "no") - ### Checks for programs AC_ISC_POSIX @@ -128,74 +48,13 @@ case "$host_os" in ;; esac -# Eina +# EFL dependencies -PKG_CHECK_MODULES([EINA], eina >= 1.7.99 eo >= 1.7.99) +PKG_CHECK_MODULES([EFL], eina >= 1.7.99 eo >= 1.7.99 evas >= 1.7.99 eet >= 1.7.99 ecore-evas >= 1.7.99 ecore >= 1.7.99) EFL_ENABLE_EO_API_SUPPORT EFL_ENABLE_BETA_API_SUPPORT -# Evas - -PKG_CHECK_MODULES([EVAS], evas >= 1.7.99 eet >= 1.7.99) - -# Xlib - -if test "x$have_software_xlib" = "xyes" -o "x$have_xrender_x11" = "xyes" -o "x$have_opengl_x11" = "xyes"; then - AC_PATH_XTRA - AC_CHECK_HEADERS([X11/Xlib.h X11/Xutil.h], - [have_xlib="yes"], - [have_xlib="no"]) - if test "x$want_evas_simple_x11" = "xyes"; then - x_libs="${x_libs} -lX11" - else - x_dir=${x_dir:-/usr/X11R6} - x_cflags=${x_cflags:--I${x_includes:-$x_dir/include}} - x_libs="${x_libs:--L${x_libraries:-$x_dir/lib}} -lX11" - fi -fi -AM_CONDITIONAL(BUILD_X11, [test "x$have_xlib" = "xyes"]) - -AC_SUBST(x_cflags) -AC_SUBST(x_libs) - -# XCB - -if test "x$have_software_xcb" = "xyes"; then - PKG_CHECK_MODULES([XCB], [xcb xcb-keysyms], [have_xcb="yes"], [have_xcb="no"]) -fi -AM_CONDITIONAL(BUILD_XCB, test "x$have_xcb" = "xyes") -if test "x$have_xcb" = "xyes"; then - AC_DEFINE(BUILD_XCB, 1, [build xcb support]) -fi - -# SDL - -PKG_CHECK_MODULES([SDL], [sdl], [have_sdl="yes"], [have_sdl="no"]) -AM_CONDITIONAL(BUILD_SDL, test "x$have_sdl" = "xyes") -if test "x$have_sdl" = "xyes"; then - AC_DEFINE(BUILD_SDL, 1, [build sdl support]) -fi - -# PSL1GHT -AM_CONDITIONAL(BUILD_PSL1GHT, test "x$have_psl1ght" = "xyes") - -# DirectFB - -if test "x$have_directfb" = "xyes"; then - PKG_CHECK_MODULES([DIRECTFB], [directfb], [have_directfb="yes"], [have_directfb="no"]) -fi -AM_CONDITIONAL(BUILD_DIRECTFB, test "x$have_directfb" = "xyes") - -# Wayland -EXPEDITE_CHECK_ENGINE([wayland-shm], [Wayland SHM], "no") -EXPEDITE_CHECK_ENGINE([wayland-egl], [Wayland EGL], "no") - -have_wl="no" -if test "x$have_wayland_shm" = "xyes" -o "x$have_wayland_egl" = "xyes"; then - PKG_CHECK_MODULES([WAYLAND_CLIENT], [wayland-client], [have_wl="yes"], [have_wl="no"]) -fi -AM_CONDITIONAL(BUILD_WAYLAND, test "x$have_wl" = "xyes") ### Checks for header files @@ -266,25 +125,6 @@ data/Makefile echo echo " $PACKAGE $VERSION" echo -echo " Engines:" -echo " Software X11.................: ${have_software_x11} (Xlib: ${have_software_xlib}) (XCB: ${have_software_xcb})" -echo " X Render X11.................: ${have_xrender_x11}" -echo " Open GL X11..................: ${have_opengl_x11}" -echo " X Render XCB.................: ${have_xrender_xcb}" -echo " Software GDI.................: ${have_software_gdi}" -echo " Software DirectDraw..........: ${have_software_ddraw}" -echo " Direct3D.....................: ${have_direct3d}" -echo " Software SDL.................: ${have_software_sdl}" -echo " Open GL SDL..................: ${have_opengl_sdl}" -echo " Open GL Cocoa................: ${have_opengl_cocoa}" -echo " FB...........................: ${have_fb}" -echo " DirectFB.....................: ${have_directfb}" -echo " PSL1GHT......................: ${have_psl1ght}" -echo " Software WinCE 16 bits.......: ${have_software_16_wince}" -echo " Wayland EGL..................: ${have_wayland_egl}" -echo " Wayland SHM..................: ${have_wayland_shm}" -echo " DRM..........................: ${have_drm}" -echo echo " Installation:" echo " prefix.......................: ${prefix}" echo diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am index 4d93ab7..68680ab 100644 --- a/src/bin/Makefile.am +++ b/src/bin/Makefile.am @@ -6,12 +6,7 @@ AM_CPPFLAGS = \ -DPACKAGE_BIN_DIR=\"$(bindir)\" \ -DPACKAGE_LIB_DIR=\"$(libdir)\" \ -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ -@EINA_CFLAGS@ \ -@EVAS_CFLAGS@ \ -@x_cflags@ \ -@SDL_CFLAGS@ \ -@DIRECTFB_CFLAGS@ \ -@XCB_CFLAGS@ \ +@EFL_CFLAGS@ \ @EVIL_CFLAGS@ bin_PROGRAMS = expedite @@ -134,106 +129,11 @@ font_effect_blur_color.c # image_mask_14.c \ # image_mask_15.c -expedite_CFLAGS = @WIN32_CFLAGS@ @WAYLAND_CLIENT_CFLAGS@ +expedite_CFLAGS = @WIN32_CFLAGS@ expedite_CXXFLAGS = @EXPEDITE_CXXFLAGS@ -expedite_LDADD = @SDL_LIBS@ @x_libs@ @gdi_libs@ @ddraw_libs@ @d3d_libs@ @wince_16_libs@ @DIRECTFB_LIBS@ @XCB_LIBS@ @EVAS_LIBS@ @EINA_LIBS@ @EVIL_LIBS@ @gl_cocoa_libs@ @WAYLAND_CLIENT_LIBS@ -lm +expedite_LDADD = @EFL_LIBS@ @EVIL_LIBS@ -lm expedite_LDFLAGS = @lt_enable_auto_import@ -if BUILD_SOFTWARE_XLIB -expedite_SOURCES += \ -engine_software_xlib.c engine_software_xlib.h -endif - -if BUILD_XRENDER_X11 -expedite_SOURCES += \ -engine_xrender_x11.c engine_xrender_x11.h -endif - -if BUILD_OPENGL_X11 -expedite_SOURCES += \ -engine_gl_x11.c engine_gl_x11.h -endif - -if BUILD_SOFTWARE_XCB -expedite_SOURCES += \ -engine_software_xcb.c engine_software_xcb.h -endif - -if BUILD_XRENDER_XCB -expedite_SOURCES += \ -engine_xrender_xcb.c engine_xrender_xcb.h -endif - -if BUILD_SOFTWARE_GDI -expedite_SOURCES += \ -engine_software_gdi.c engine_software_gdi.h -endif - -if BUILD_SOFTWARE_DDRAW -expedite_SOURCES += \ -engine_software_ddraw.cpp engine_software_ddraw.h -endif - -if BUILD_DIRECT3D -expedite_SOURCES += \ -engine_direct3d.cpp engine_direct3d.h -endif - -if BUILD_SDL -expedite_SOURCES += \ -engine_software_sdl.c engine_software_sdl.h -endif - -if BUILD_OPENGL_SDL -expedite_SOURCES += \ -engine_gl_sdl.c engine_gl_sdl.h -endif - -if BUILD_PSL1GHT -expedite_SOURCES += \ -engine_psl1ght.c -endif - -if BUILD_FB -expedite_SOURCES += \ -engine_fb.c engine_fb.h -endif - -if BUILD_DIRECTFB -expedite_SOURCES += \ -engine_directfb.c engine_directfb.h -endif - -if BUILD_OPENGL_COCOA -expedite_SOURCES += \ -engine_gl_cocoa.m engine_gl_cocoa.h -endif - -if BUILD_SOFTWARE_16_WINCE -expedite_SOURCES += \ -engine_software_16_wince.c engine_software_16_wince.h engine_software_16_wince.rc -endif - -if BUILD_WAYLAND -expedite_SOURCES += \ -engine_wayland_common.c engine_wayland_common.h -endif - -if BUILD_WAYLAND_EGL -expedite_SOURCES += \ -engine_wayland_egl.c engine_wayland_egl.h -endif - -if BUILD_WAYLAND_SHM -expedite_SOURCES += \ -engine_wayland_shm.c engine_wayland_shm.h -endif - -if BUILD_DRM -expedite_SOURCES += \ -engine_drm.c engine_drm.h -endif - .rc.lo: $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --tag=RC --mode=compile $(RC) $(RCFLAGS) $< -o $@ diff --git a/src/bin/engine_direct3d.h b/src/bin/engine_direct3d.h deleted file mode 100644 index 2fa3bd1..0000000 --- a/src/bin/engine_direct3d.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef __ENGINE_DIRECT3D_H__ -#define __ENGINE_DIRECT3D_H__ - - -#ifdef __cplusplus -extern "C" { -#endif - - -Eina_Bool engine_direct3d_args(const char *engine, int width, int height); -void engine_direct3d_loop(void); -void engine_direct3d_shutdown(void); - - -#ifdef __cplusplus -} -#endif - - -#endif /* __ENGINE_DIRECT3D_H__ */ diff --git a/src/bin/engine_directfb.c b/src/bin/engine_directfb.c deleted file mode 100644 index acbc6f8..0000000 --- a/src/bin/engine_directfb.c +++ /dev/null @@ -1,277 +0,0 @@ -#include "main.h" - -#include - -static IDirectFB *_dfb; -static IDirectFBEventBuffer *_window_event; -static IDirectFBEventBuffer *_input_event; -static IDirectFBDisplayLayer *_layer; -static DFBResult _err; -static IDirectFBWindow *_dfb_window; -static IDirectFBSurface *_dfb_surface; - -#define DBG(...) do {} while (0) -//#define DBG(...) fprintf(stderr, __VA_ARGS__) - -#define DFBCHECK(x...) \ - { \ - _err = x; \ - if (_err != DFB_OK) { \ - fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \ - DirectFBErrorFatal( #x, _err ); \ - } \ - } - -Eina_Bool -engine_directfb_args(const char *engine, int width, int height) -{ - Evas_Engine_Info_DirectFB *einfo; - DFBWindowDescription desc; - int i; - - evas_output_method_set(evas, evas_render_method_lookup("directfb")); - einfo = (Evas_Engine_Info_DirectFB *)evas_engine_info_get(evas); - if (!einfo) - { - printf("Evas does not support the DirectFB Engine\n"); - return EINA_FALSE; - } - - DFBCHECK(DirectFBInit(NULL, NULL)); - DFBCHECK(DirectFBCreate(&_dfb)); - DFBCHECK(_dfb->GetDisplayLayer(_dfb, DLID_PRIMARY, &_layer)); - DFBCHECK(_dfb->CreateEventBuffer(_dfb, &_window_event)); - DFBCHECK(_dfb->CreateInputEventBuffer(_dfb, DICAPS_ALL, DFB_FALSE, &_input_event)); - - memset(&desc, 0, sizeof(DFBWindowDescription)); - desc.flags = (DWDESC_POSX | DWDESC_POSY | DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_PIXELFORMAT); - desc.posx = 0; - desc.posy = 0; - desc.width = width; - desc.height = height; - desc.pixelformat = DSPF_ARGB; - - DFBCHECK(_layer->CreateWindow(_layer, &desc, &_dfb_window)); - DFBCHECK(_dfb_window->AttachEventBuffer(_dfb_window, _window_event)); - DFBCHECK(_dfb_window->SetOptions(_dfb_window, DWOP_NONE)); - DFBCHECK(_dfb_window->SetOpacity(_dfb_window, 0xFF)); - DFBCHECK(_dfb_window->GetSurface(_dfb_window, &_dfb_surface)); - DFBCHECK(_dfb_surface->SetPorterDuff(_dfb_surface, DSPD_SRC_OVER)); - - einfo->info.dfb = _dfb; - einfo->info.surface = _dfb_surface; - if (!evas_engine_info_set(evas, (Evas_Engine_Info *) einfo)) - { - printf("Evas can not setup the informations of the DirectFB Engine\n"); - return EINA_FALSE; - } - - return EINA_TRUE; -} - -static void -engine_directfb_quit(void) -{ - DFBCHECK(_input_event->Release(_input_event)); - DFBCHECK(_window_event->Release(_window_event)); - DFBCHECK(_dfb_surface->Release(_dfb_surface)); - DFBCHECK(_dfb_window->Release(_dfb_window)); - DFBCHECK(_layer->Release(_layer)); - DFBCHECK(_dfb->Release(_dfb)); - - evas_engine_info_set(evas, NULL); - - engine_abort(); -} - -static const char * -key_string(DFBInputDeviceKeySymbol sym) -{ - switch (sym) - { - case DIKS_ESCAPE: - { - static const char k[] = "Escape"; - return k; - } - case DIKS_RETURN: - { - static const char k[] = "Return"; - return k; - } - case DIKS_CURSOR_LEFT: - { - static const char k[] = "Left"; - return k; - } - case DIKS_CURSOR_RIGHT: - { - static const char k[] = "Right"; - return k; - } - default: - { - static char k[2]; - k[0] = (char)sym; - k[1] = 0; - return k; - } - } -} - -static void -engine_directfb_event_window(const DFBWindowEvent *ev) -{ - DBG("===> Window Event (type=%#10x, window=%d) <===\n", - ev->type, ev->window_id); - - if (ev->type & DWET_POSITION) - { - DBG("\tDWET_POSITION %d, %d\n", ev->x, ev->y); - } - - if (ev->type & DWET_SIZE) - { - DBG("\tDWET_SIZE %dx%d\n", ev->w, ev->h); - evas_output_viewport_set(evas, 0, 0, - ev->w, ev->h); - evas_output_size_set(evas, ev->w, ev->h); - win_w = ev->w; - win_h = ev->h; - } - - if (ev->type & DWET_CLOSE) - { - DBG("\tDWET_CLOSE\n"); - engine_directfb_quit(); - } - - if (ev->type & DWET_DESTROYED) - { - DBG("\tDWET_DESTROYED\n"); - engine_directfb_quit(); - } - - if (ev->type & DWET_GOTFOCUS) - { - DBG("\tDWET_GOTFOCUS\n"); - } - - if (ev->type & DWET_LOSTFOCUS) - { - DBG("\tDWET_LOSTFOCUS\n"); - } - - if (ev->type & DWET_KEYDOWN) - { - const char *k; - - k = key_string(ev->key_symbol); - DBG("\tDWET_KEYDOWN key_symbol=%s\n", k); - - if (k) - evas_event_feed_key_down(evas, k, k, NULL, NULL, 0, NULL); - } - - if (ev->type & DWET_KEYUP) - { - const char *k; - - k = key_string(ev->key_symbol); - DBG("\tDWET_KEYUP key_symbol=%s\n", k); - - if (k) - evas_event_feed_key_up(evas, k, k, NULL, NULL, 0, NULL); - } - - if (ev->type & DWET_BUTTONDOWN) - { - DBG("\tDWET_BUTTONDOWN pos=(%d, %d) cur_pos=(%d, %d) " - "button=%#x buttons=%#x\n", - ev->x, ev->y, ev->cx, ev->cy, ev->button, ev->buttons); - evas_event_feed_mouse_move(evas, ev->cx, ev->cy, 0, NULL); - evas_event_feed_mouse_down(evas, ev->button, EVAS_BUTTON_NONE, 0, NULL); - } - - if (ev->type & DWET_BUTTONUP) - { - DBG("\tDWET_BUTTONUP pos=(%d, %d) cur_pos=(%d, %d) " - "button=%#x buttons=%#x\n", - ev->x, ev->y, ev->cx, ev->cy, ev->button, ev->buttons); - evas_event_feed_mouse_move(evas, ev->cx, ev->cy, 0, NULL); - evas_event_feed_mouse_up(evas, ev->button, EVAS_BUTTON_NONE, 0, NULL); - } - - if (ev->type & DWET_MOTION) - { - DBG("\tDWET_MOTION pos=(%d, %d) cur_pos=(%d, %d) buttons=%#x\n", - ev->x, ev->y, ev->cx, ev->cy, ev->buttons); - /* Mouse Motion Compression [tm] */ - _layer->GetCursorPosition( _layer, (int*)&ev->x, (int*)&ev->y ); - - evas_event_feed_mouse_move(evas, ev->x, ev->y, 0, NULL); - } - - if (ev->type & DWET_LEAVE) - { - DBG("\tDWET_LEAVE pos=(%d, %d) cur_pos=(%d, %d)\n", - ev->x, ev->y, ev->cx, ev->cy); - evas_event_feed_mouse_out(evas, 0, NULL); - } - - if (ev->type & DWET_ENTER) - { - DBG("\tDWET_ENTER pos=(%d, %d) cur_pos=(%d, %d)\n", - ev->x, ev->y, ev->cx, ev->cy); - evas_event_feed_mouse_in(evas, 0, NULL); - } - - if (ev->type & DWET_WHEEL) - { - DBG("\tDWET_WHEEL step=%d\n", ev->step); - } - - - DBG("\n"); -} - -void -engine_directfb_loop(void) -{ - DFBEvent ev; - - while ((_input_event->GetEvent(_input_event, &ev) == DFB_OK) || - (_window_event->GetEvent(_window_event, &ev) == DFB_OK)) - { - DBG("got dfb input event %d\n", ev.clazz); - switch (ev.clazz) - { - case DFEC_NONE: - DBG("No event?\n"); - break; - case DFEC_INPUT: - DBG("Input\n"); - break; - case DFEC_WINDOW: - engine_directfb_event_window((const DFBWindowEvent *)&ev); - break; - case DFEC_USER: - DBG("User\n"); - break; - case DFEC_UNIVERSAL: - DBG("Universal\n"); - break; - } - } -} - -void -engine_directfb_shutdown(void) -{ - DFBCHECK(_input_event->Release(_input_event)); - DFBCHECK(_window_event->Release(_window_event)); - DFBCHECK(_dfb_surface->Release(_dfb_surface)); - DFBCHECK(_dfb_window->Release(_dfb_window)); - DFBCHECK(_layer->Release(_layer)); - DFBCHECK(_dfb->Release(_dfb)); -} diff --git a/src/bin/engine_directfb.h b/src/bin/engine_directfb.h deleted file mode 100644 index 7f22382..0000000 --- a/src/bin/engine_directfb.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef ENGINE_DIRECTFB_H -#define ENGINE_DIRECTFB_H - -Eina_Bool engine_directfb_args(const char *engine, int width, int height); -void engine_directfb_loop(void); -void engine_directfb_shutdown(void); - -#endif diff --git a/src/bin/engine_drm.c b/src/bin/engine_drm.c deleted file mode 100644 index 4fa6a7e..0000000 --- a/src/bin/engine_drm.c +++ /dev/null @@ -1,49 +0,0 @@ -#include "main.h" - -#include - -Eina_Bool -engine_drm_args(const char *engine __UNUSED__, int width __UNUSED__, int height __UNUSED__) -{ - Evas_Engine_Info_Drm *einfo; - - evas_output_method_set(evas, evas_render_method_lookup("drm")); - einfo = (Evas_Engine_Info_Drm *)evas_engine_info_get(evas); - if (!einfo) - { - printf("Evas does not support the Drm Engine\n"); - return EINA_FALSE; - } - - /* setup drm props in such a way so that evas itself will handle doing - * the drm card init, etc, etc because we are not using ecore_evas here */ - einfo->info.fd = -1; - einfo->info.tty = -1; - einfo->info.output = -1; - einfo->info.plane = -1; - einfo->info.rotation = 0; - einfo->info.depth = 32; - einfo->info.destination_alpha = EINA_FALSE; - einfo->info.vsync = EINA_FALSE; - einfo->info.use_hw_accel = EINA_TRUE; - - if (!evas_engine_info_set(evas, (Evas_Engine_Info *)einfo)) - { - printf("Evas could not setup the information for the Drm Engine\n"); - return EINA_FALSE; - } - - return EINA_TRUE; -} - -void -engine_drm_loop(void) -{ - -} - -void -engine_drm_shutdown(void) -{ - -} diff --git a/src/bin/engine_drm.h b/src/bin/engine_drm.h deleted file mode 100644 index a031a9b..0000000 --- a/src/bin/engine_drm.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef ENGINE_DRM_H -#define ENGINE_DRM_H - -Eina_Bool engine_drm_args(const char *engine, int width, int height); -void engine_drm_loop(void); -void engine_drm_shutdown(void); - -#endif diff --git a/src/bin/engine_fb.c b/src/bin/engine_fb.c deleted file mode 100644 index 863487a..0000000 --- a/src/bin/engine_fb.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "main.h" - -#include - -Eina_Bool -engine_fb_args(const char *engine __UNUSED__, int width __UNUSED__, int height __UNUSED__) -{ - Evas_Engine_Info_FB *einfo; - - evas_output_method_set(evas, evas_render_method_lookup("fb")); - einfo = (Evas_Engine_Info_FB *)evas_engine_info_get(evas); - if (!einfo) - { - printf("Evas does not support the FB Engine\n"); - return EINA_FALSE; - } - - einfo->info.virtual_terminal = 0; - einfo->info.device_number = 0; - einfo->info.device_number = 0; - einfo->info.refresh = 0; - einfo->info.rotation = 0; - if (!evas_engine_info_set(evas, (Evas_Engine_Info *) einfo)) - { - printf("Evas can not setup the informations of the FB Engine\n"); - return EINA_FALSE; - } - - return EINA_TRUE; -} - -void -engine_fb_loop(void) -{ - return; -} - -void -engine_fb_shutdown(void) -{ - return; -} diff --git a/src/bin/engine_fb.h b/src/bin/engine_fb.h deleted file mode 100644 index 288208f..0000000 --- a/src/bin/engine_fb.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef ENGINE_FB_H -#define ENGINE_FB_H - -Eina_Bool engine_fb_args(const char *engine, int width, int height); -void engine_fb_loop(void); -void engine_fb_shutdown(void); - -#endif diff --git a/src/bin/engine_gl_cocoa.h b/src/bin/engine_gl_cocoa.h deleted file mode 100644 index 77430c9..0000000 --- a/src/bin/engine_gl_cocoa.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef ENGINE_GL_COCOA_H -#define ENGINE_GL_COCOA_H - -int engine_gl_cocoa_args(int argc, char **argv); -void engine_gl_cocoa_loop(void); -void engine_gl_cocoa_shutdown(void); - -#endif diff --git a/src/bin/engine_gl_sdl.c b/src/bin/engine_gl_sdl.c deleted file mode 100644 index c30a008..0000000 --- a/src/bin/engine_gl_sdl.c +++ /dev/null @@ -1,174 +0,0 @@ -#include -#include "main.h" - -#include - -Eina_Bool -engine_gl_sdl_args(const char *engine, int width, int height) -{ - Evas_Engine_Info_GL_SDL *einfo; - int i; - - evas_output_method_set(evas, evas_render_method_lookup("gl_sdl")); - - einfo = (Evas_Engine_Info_GL_SDL *) evas_engine_info_get(evas); - if (!einfo) - { - printf("Evas wasn't build with GL SDL backend.\n"); - return EINA_FALSE; - } - - /* the following is specific to the engine */ - einfo->flags.fullscreen = fullscreen; - einfo->flags.noframe = 0; - - if (!evas_engine_info_set(evas, (Evas_Engine_Info *) einfo)) - { - printf("Evas could not initialize the GL SDL Engine\n"); - return EINA_FALSE; - } - - return EINA_TRUE; -} - -void -engine_gl_sdl_loop(void) -{ - SDL_Event event; - - while(SDL_PollEvent(&event)) - { - switch(event.type) - { - case SDL_MOUSEMOTION: - evas_event_feed_mouse_move(evas, event.motion.x, event.motion.y, 0, NULL); - break; - case SDL_MOUSEBUTTONDOWN: - evas_event_feed_mouse_move(evas, event.button.x, event.button.y, 0, NULL); - evas_event_feed_mouse_down(evas, event.button.button, EVAS_BUTTON_NONE, 0, NULL); - break; - case SDL_MOUSEBUTTONUP: - evas_event_feed_mouse_move(evas, event.button.x, event.button.y, 0, NULL); - evas_event_feed_mouse_up(evas, event.button.button, EVAS_BUTTON_NONE, 0, NULL); - break; - case SDL_VIDEORESIZE: - evas_output_viewport_set(evas, 0, 0, - event.resize.w, event.resize.w); - evas_output_size_set(evas, event.resize.w, event.resize.w); - evas_output_size_get(evas, &win_w, &win_h); - break; - case SDL_VIDEOEXPOSE: - evas_output_size_get(evas, &win_w, &win_h); - evas_damage_rectangle_add(evas, 0, 0, win_w, win_h); - break; - case SDL_KEYDOWN: - switch (event.key.keysym.sym) - { - case SDLK_LSHIFT: - case SDLK_RSHIFT: - evas_key_modifier_on(evas, "Shift"); - break; - case SDLK_RCTRL: - case SDLK_LCTRL: - evas_key_modifier_on(evas, "Control"); - break; - case SDLK_MENU: - case SDLK_RALT: - case SDLK_LALT: - evas_key_modifier_on(evas, "Alt"); - break; - case SDLK_LSUPER: - case SDLK_RSUPER: - evas_key_modifier_on(evas, "Super"); - break; - case SDLK_CAPSLOCK: - if (evas_key_lock_is_set(evas_key_lock_get(evas), "Caps_Lock")) - evas_key_lock_off(evas, "Caps_Lock"); - else - evas_key_lock_on(evas, "Caps_Lock"); - break; - case SDLK_NUMLOCK: - if (evas_key_lock_is_set(evas_key_lock_get(evas), "Num_Lock")) - evas_key_lock_off(evas, "Num_Lock"); - else - evas_key_lock_on(evas, "Num_Lock"); - break; - case SDLK_SCROLLOCK: - if (evas_key_lock_is_set(evas_key_lock_get(evas), "Scroll_Lock")) - evas_key_lock_off(evas, "Scroll_Lock"); - else - evas_key_lock_on(evas, "Scroll_Lock"); - break; - case SDLK_s: - case SDLK_ESCAPE: - evas_event_feed_key_down(evas, "Escape", "Escape", NULL, NULL, 0, NULL); - break; - case SDLK_KP_ENTER: - case SDLK_RETURN: - evas_event_feed_key_down(evas, "Return", "Return", NULL, NULL, 0, NULL); - break; - case SDLK_LEFT: evas_event_feed_key_down(evas, "Left", "Left", NULL, NULL, 0, NULL); break; - case SDLK_RIGHT: evas_event_feed_key_down(evas, "Right", "Right", NULL, NULL, 0, NULL); break; - case SDLK_q: - if (evas_key_lock_is_set(evas_key_lock_get(evas), "Caps_Lock")) - evas_event_feed_key_down(evas, "Q", "Q", NULL, NULL, 0, NULL); - else - evas_event_feed_key_down(evas, "q", "q", NULL, NULL, 0, NULL); - break; - default: - break; - } - break; - case SDL_KEYUP: - switch (event.key.keysym.sym) - { - case SDLK_LSHIFT: - case SDLK_RSHIFT: - evas_key_modifier_off(evas, "Shift"); - break; - case SDLK_RCTRL: - case SDLK_LCTRL: - evas_key_modifier_off(evas, "Control"); - break; - case SDLK_MENU: - case SDLK_RALT: - case SDLK_LALT: - evas_key_modifier_off(evas, "Alt"); - break; - case SDLK_LSUPER: - case SDLK_RSUPER: - evas_key_modifier_off(evas, "Super"); - break; - case SDLK_ESCAPE: evas_event_feed_key_up(evas, "Escape", "Escape", NULL, NULL, 0, NULL); break; - case SDLK_RETURN: evas_event_feed_key_up(evas, "Return", "Return", NULL, NULL, 0, NULL); break; - case SDLK_LEFT: evas_event_feed_key_up(evas, "Left", "Left", NULL, NULL, 0, NULL); break; - case SDLK_RIGHT: evas_event_feed_key_up(evas, "Right", "Right", NULL, NULL, 0, NULL); break; - case SDLK_q: - if (evas_key_lock_is_set(evas_key_lock_get(evas), "Caps_Lock")) - evas_event_feed_key_up(evas, "Q", "Q", NULL, NULL, 0, NULL); - else - evas_event_feed_key_up(evas, "q", "q", NULL, NULL, 0, NULL); - break; - default: - break; - } - break; - case SDL_QUIT: - case SDL_SYSWMEVENT: - case SDL_USEREVENT: - case SDL_ACTIVEEVENT: - case SDL_JOYAXISMOTION: - case SDL_JOYBALLMOTION: - case SDL_JOYHATMOTION: - case SDL_JOYBUTTONDOWN: - case SDL_JOYBUTTONUP: - default: - break; - } - } -} - -void -engine_gl_sdl_shutdown(void) -{ -} diff --git a/src/bin/engine_gl_sdl.h b/src/bin/engine_gl_sdl.h deleted file mode 100644 index 793db3d..0000000 --- a/src/bin/engine_gl_sdl.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef ENGINE_GL_SDL_H -#define ENGINE_GL_SDL_H - -Eina_Bool engine_gl_sdl_args(const char *engine, int width, int height); -void engine_gl_sdl_loop(void); -void engine_gl_sdl_shutdown(void); - -#endif diff --git a/src/bin/engine_gl_x11.c b/src/bin/engine_gl_x11.c deleted file mode 100644 index 4c8fdd1..0000000 --- a/src/bin/engine_gl_x11.c +++ /dev/null @@ -1,223 +0,0 @@ -#include "main.h" - -#include -#include -#include -#include -#include - -static Display *disp = NULL; -static Window win = 0; -static int first_expose = 0; - -Eina_Bool -engine_gl_x11_args(const char *engine __UNUSED__, int width, int height) -{ - XSetWindowAttributes attr; - XClassHint chint; - XSizeHints szhints; - Evas_Engine_Info_GL_X11 *einfo; - - disp = XOpenDisplay(NULL); - if (!disp) return EINA_FALSE; - - evas_output_method_set(evas, evas_render_method_lookup("gl_x11")); - einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(evas); - if (!einfo) - { - printf("Evas does not support the OpenGL X11 Engine\n"); - goto close_display; - } - - einfo->info.display = disp; - einfo->info.screen = DefaultScreen(einfo->info.display); - einfo->info.visual = einfo->func.best_visual_get(einfo); - einfo->info.colormap = einfo->func.best_colormap_get(einfo); - einfo->info.depth = einfo->func.best_depth_get(einfo); - attr.backing_store = NotUseful; - attr.colormap = einfo->info.colormap; - attr.border_pixel = 0; - attr.background_pixmap = None; - attr.event_mask = - ExposureMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask | - StructureNotifyMask | EnterWindowMask | LeaveWindowMask | - KeyPressMask | KeyReleaseMask; - attr.bit_gravity = ForgetGravity; - win = XCreateWindow(disp, DefaultRootWindow(disp), - 0, 0, width, height, 0, - einfo->info.depth, InputOutput, - einfo->info.visual, - CWBackingStore | CWColormap | - CWBackPixmap | CWBorderPixel | - CWBitGravity | CWEventMask, - &attr); - if (!win) - goto close_display; - - einfo->info.drawable = win; - if (!evas_engine_info_set(evas, (Evas_Engine_Info *) einfo)) - { - printf("Evas can not setup the informations of the OpenGL X11 Engine\n"); - goto destroy_window; - } - - if (fullscreen) - { - Atom prop = XInternAtom(disp, "_NET_WM_STATE", False); - Atom state = XInternAtom(disp, "_NET_WM_STATE_FULLSCREEN", False); - unsigned long data = state; - XChangeProperty(disp, win, prop, XA_ATOM, 32, PropModeReplace, - (unsigned char*) &data, 1); - } - - XStoreName(disp, win, "Expedite - Evas Test Suite"); - chint.res_name = "expedite"; - chint.res_class = "Expedite"; - XSetClassHint(disp, win, &chint); - szhints.flags = PMinSize | PMaxSize | PSize | USSize; - szhints.min_width = szhints.max_width = width; - szhints.min_height = szhints.max_height = height; - XSetWMNormalHints(disp, win, &szhints); - XMapWindow(disp, win); - XSync(disp, False); - while (!first_expose) - engine_gl_x11_loop(); - return EINA_TRUE; - - destroy_window: - XDestroyWindow(disp, win); - close_display: - XCloseDisplay(disp); - - return EINA_FALSE; -} - -void -engine_gl_x11_loop(void) -{ - XEvent ev; - KeySym ks; - char *kstr; - - again: - if (!XCheckMaskEvent(disp, - ExposureMask | - StructureNotifyMask | - KeyPressMask | - KeyReleaseMask | - ButtonPressMask | - ButtonReleaseMask | - PointerMotionMask | - EnterWindowMask | - LeaveWindowMask, &ev)) - return; - switch (ev.type) - { - case ButtonPress: - evas_event_feed_mouse_move(evas, ev.xbutton.x, ev.xbutton.y, 0, NULL); - evas_event_feed_mouse_down(evas, ev.xbutton.button, EVAS_BUTTON_NONE, 0, NULL); - break; - case ButtonRelease: - evas_event_feed_mouse_move(evas, ev.xbutton.x, ev.xbutton.y, 0, NULL); - evas_event_feed_mouse_up(evas, ev.xbutton.button, EVAS_BUTTON_NONE, 0, NULL); - break; - case MotionNotify: - evas_event_feed_mouse_move(evas, ev.xmotion.x, ev.xmotion.y, 0, NULL); - break; - case Expose: - first_expose = 1; - evas_damage_rectangle_add(evas, - ev.xexpose.x, - ev.xexpose.y, - ev.xexpose.width, - ev.xexpose.height); - break; - case ConfigureNotify: - evas_output_viewport_set(evas, 0, 0, - ev.xconfigure.width, - ev.xconfigure.height); - evas_output_size_set(evas, - ev.xconfigure.width, - ev.xconfigure.height); - win_w = ev.xconfigure.width; - win_h = ev.xconfigure.height; - break; - case EnterNotify: - evas_event_feed_mouse_in(evas, 0, NULL); - break; - case LeaveNotify: - evas_event_feed_mouse_out(evas, 0, NULL); - break; - case KeyPress: - ks = XkbKeycodeToKeysym(ev.xkey.display, ev.xkey.keycode, 0, 0); - kstr = XKeysymToString(ks); - if (kstr) - { - if ((!strcmp(kstr, "Shift_L")) || - (!strcmp(kstr, "Shift_R"))) - evas_key_modifier_on(evas, "Shift"); - if ((!strcmp(kstr, "Control_L")) || - (!strcmp(kstr, "Control_R"))) - evas_key_modifier_on(evas, "Control"); - if ((!strcmp(kstr, "Alt_L")) || - (!strcmp(kstr, "Alt_R"))) - evas_key_modifier_on(evas, "Alt"); - if ((!strcmp(kstr, "Super_L")) || - (!strcmp(kstr, "Super_R"))) - evas_key_modifier_on(evas, "Super"); - if (!strcmp(kstr, "Caps_Lock")) - { - if (evas_key_lock_is_set(evas_key_lock_get(evas), "Caps_Lock")) - evas_key_lock_off(evas, "Caps_Lock"); - else - evas_key_lock_on(evas, "Caps_Lock"); - } - if (!strcmp(kstr, "Num_Lock")) - { - if (evas_key_lock_is_set(evas_key_lock_get(evas), "Num_Lock")) - evas_key_lock_off(evas, "Num_Lock"); - else - evas_key_lock_on(evas, "Num_Lock"); - } - if (!strcmp(kstr, "Scroll_Lock")) - { - if (evas_key_lock_is_set(evas_key_lock_get(evas), "Scroll_Lock")) - evas_key_lock_off(evas, "Scroll_Lock"); - else - evas_key_lock_on(evas, "Scroll_Lock"); - } - if (kstr) evas_event_feed_key_down(evas, kstr, kstr, NULL, NULL, 0, NULL); - } - break; - case KeyRelease: - ks = XkbKeycodeToKeysym(ev.xkey.display, ev.xkey.keycode, 0, 0); - kstr = XKeysymToString(ks); - if (kstr) - { - if ((!strcmp(kstr, "Shift_L")) || - (!strcmp(kstr, "Shift_R"))) - evas_key_modifier_off(evas, "Shift"); - if ((!strcmp(kstr, "Control_L")) || - (!strcmp(kstr, "Control_R"))) - evas_key_modifier_off(evas, "Control"); - if ((!strcmp(kstr, "Alt_L")) || - (!strcmp(kstr, "Alt_R"))) - evas_key_modifier_off(evas, "Alt"); - if ((!strcmp(kstr, "Super_L")) || - (!strcmp(kstr, "Super_R"))) - evas_key_modifier_off(evas, "Super"); - evas_event_feed_key_up(evas, kstr, kstr, NULL, NULL, 0, NULL); - } - break; - default: - break; - } - goto again; -} - -void -engine_gl_x11_shutdown(void) -{ - XDestroyWindow(disp, win); - XCloseDisplay(disp); -} diff --git a/src/bin/engine_gl_x11.h b/src/bin/engine_gl_x11.h deleted file mode 100644 index 9702d8b..0000000 --- a/src/bin/engine_gl_x11.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef ENGINE_GL_X11_H -#define ENGINE_GL_X11_H - -Eina_Bool engine_gl_x11_args(const char *engine, int width, int height); -void engine_gl_x11_loop(void); -void engine_gl_x11_shutdown(void); - -#endif diff --git a/src/bin/engine_psl1ght.c b/src/bin/engine_psl1ght.c deleted file mode 100644 index 2661a6c..0000000 --- a/src/bin/engine_psl1ght.c +++ /dev/null @@ -1,284 +0,0 @@ -#include "main.h" - -#include -#include -#include - -static int window_width = 0; -static int window_height = 0; - -Eina_Bool -engine_psl1ght_args(const char *engine, int width, int height) -{ - Evas_Engine_Info_PSL1GHT *einfo; - - evas_output_method_set(evas, evas_render_method_lookup("psl1ght")); - einfo = (Evas_Engine_Info_PSL1GHT *)evas_engine_info_get(evas); - if (!einfo) - { - printf("Evas does not support the PSL1GHT Engine\n"); - return EINA_FALSE; - } - - if (!evas_engine_info_set(evas, (Evas_Engine_Info *)einfo)) - { - printf("Evas can not setup the informations of the PSL1GHT Engine\n"); - return EINA_FALSE; - } - - window_width = width; - window_height = height; - ioMouseInit(1); - ioKbInit(1); - return EINA_TRUE; -} - -void -engine_psl1ght_loop(void) -{ - mouseInfo mouseinfo; - static int mouse_connected = FALSE; - static u8 mouse_buttons = 0; - static int mouse_x = 0; - static int mouse_y = 0; - KbInfo kbInfo; - static int keyboard_connected = FALSE; - static KbLed keyboard_leds = {{0}}; - static KbMkey keyboard_mods = {{0}}; - static u16 keyboard_old_key = 0; - int i; - - /* Check mouse events */ - ioMouseGetInfo(&mouseinfo); - - if (mouseinfo.status[0] == 1 && !mouse_connected) // Connected - { - mouse_connected = TRUE; - mouse_buttons = 0; - - // Old events in the queue are discarded - ioMouseClearBuf(0); - } - else if (mouseinfo.status[0] != 1 && mouse_connected) // Disconnected - { - mouse_connected = FALSE; - mouse_buttons = 0; - } - - if (mouse_connected) - { - mouseDataList datalist; - - ioMouseGetDataList(0, &datalist); - - for (i = 0; i < datalist.count; i++) { - u8 old_left = mouse_buttons & 1; - u8 new_left = datalist.list[i].buttons & 1; - u8 old_right = mouse_buttons & 2; - u8 new_right = datalist.list[i].buttons & 2; - u8 old_middle = mouse_buttons & 4; - u8 new_middle = datalist.list[i].buttons & 4; - - mouse_x += datalist.list[i].x_axis; - mouse_y += datalist.list[i].y_axis; - if (mouse_x < 0) mouse_x = 0; - if (mouse_y < 0) mouse_y = 0; - if (mouse_x > window_width) mouse_x = window_width; - if (mouse_y > window_height) mouse_x = window_height; - - evas_event_feed_mouse_move(evas, mouse_x, mouse_y, 0, NULL); - - if (old_left != new_left) - { - if (new_left) - evas_event_feed_mouse_down(evas, 1, EVAS_BUTTON_NONE, 0, NULL); - else - evas_event_feed_mouse_up(evas, 1, EVAS_BUTTON_NONE, 0, NULL); - } - if (old_right != new_right) - { - if (new_right) - evas_event_feed_mouse_down(evas, 3, EVAS_BUTTON_NONE, 0, NULL); - else - evas_event_feed_mouse_up(evas, 3, EVAS_BUTTON_NONE, 0, NULL); - } - if (old_middle != new_middle) - { - if (new_middle) - evas_event_feed_mouse_down(evas, 2, EVAS_BUTTON_NONE, 0, NULL); - else - evas_event_feed_mouse_up(evas, 2, EVAS_BUTTON_NONE, 0, NULL); - } - mouse_buttons = datalist.list[i].buttons; - } - } - - /* Check keyboard events */ - ioKbGetInfo(&kbInfo); - - if (kbInfo.status[0] == 1 && !keyboard_connected) - { - /* Connected */ - keyboard_connected = true; - - // Old events in the queue are discarded - ioKbClearBuf(0); - keyboard_leds._KbLedU.leds = 0; - keyboard_mods._KbMkeyU.mkeys = 0; - keyboard_old_key = 0; - - // Set raw keyboard code types to get scan codes - ioKbSetCodeType(0, KB_CODETYPE_ASCII); - ioKbSetReadMode(0, KB_RMODE_INPUTCHAR); - } - else if (kbInfo.status[0] != 1 && keyboard_connected) - { - /* Disconnected keyboard */ - keyboard_connected = FALSE; - } - - if (keyboard_connected) - { - KbData Keys; - - // Read data from the keyboard buffer - if (ioKbRead(0, &Keys) == 0 && Keys.nb_keycode > 0) - { - if (Keys.mkey._KbMkeyU._KbMkeyS.l_shift != - keyboard_mods._KbMkeyU._KbMkeyS.l_shift || - Keys.mkey._KbMkeyU._KbMkeyS.r_shift != - keyboard_mods._KbMkeyU._KbMkeyS.r_shift) - { - if (Keys.mkey._KbMkeyU._KbMkeyS.r_shift || - Keys.mkey._KbMkeyU._KbMkeyS.l_shift) - evas_key_modifier_on(evas, "Shift"); - else - evas_key_modifier_off(evas, "Shift"); - } - if (Keys.mkey._KbMkeyU._KbMkeyS.l_ctrl != - keyboard_mods._KbMkeyU._KbMkeyS.l_ctrl || - Keys.mkey._KbMkeyU._KbMkeyS.r_ctrl != - keyboard_mods._KbMkeyU._KbMkeyS.r_ctrl) - { - if (Keys.mkey._KbMkeyU._KbMkeyS.r_ctrl || - Keys.mkey._KbMkeyU._KbMkeyS.l_ctrl) - evas_key_modifier_on(evas, "Control"); - else - evas_key_modifier_off(evas, "Control"); - } - if (Keys.mkey._KbMkeyU._KbMkeyS.l_alt != - keyboard_mods._KbMkeyU._KbMkeyS.l_alt || - Keys.mkey._KbMkeyU._KbMkeyS.r_alt != - keyboard_mods._KbMkeyU._KbMkeyS.r_alt) - { - if (Keys.mkey._KbMkeyU._KbMkeyS.r_alt || - Keys.mkey._KbMkeyU._KbMkeyS.l_alt) - evas_key_modifier_on(evas, "Alt"); - else - evas_key_modifier_off(evas, "Alt"); - } - if (Keys.mkey._KbMkeyU._KbMkeyS.l_win != - keyboard_mods._KbMkeyU._KbMkeyS.l_win || - Keys.mkey._KbMkeyU._KbMkeyS.r_win != - keyboard_mods._KbMkeyU._KbMkeyS.r_win) - { - if (Keys.mkey._KbMkeyU._KbMkeyS.r_win || - Keys.mkey._KbMkeyU._KbMkeyS.l_win) - evas_key_modifier_on(evas, "Super"); - else - evas_key_modifier_off(evas, "Super"); - } - keyboard_mods = Keys.mkey; - - if (Keys.led._KbLedU._KbLedS.num_lock != - keyboard_leds._KbLedU._KbLedS.num_lock) - { - if (Keys.led._KbLedU._KbLedS.num_lock) - evas_key_lock_on(evas, "Num_Lock"); - else - evas_key_lock_on(evas, "Num_Lock"); - } - if (Keys.led._KbLedU._KbLedS.caps_lock != - keyboard_leds._KbLedU._KbLedS.caps_lock) - { - if (Keys.led._KbLedU._KbLedS.caps_lock) - evas_key_lock_on(evas, "Caps_Lock"); - else - evas_key_lock_on(evas, "Caps_Lock"); - } - if (Keys.led._KbLedU._KbLedS.scroll_lock != - keyboard_leds._KbLedU._KbLedS.scroll_lock) - { - if (Keys.led._KbLedU._KbLedS.scroll_lock) - evas_key_lock_on(evas, "Scroll_Lock"); - else - evas_key_lock_on(evas, "Scroll_Lock"); - } - keyboard_leds = Keys.led; - - for (i = 0; i < Keys.nb_keycode; i++) { - if (Keys.keycode[i] != keyboard_old_key) - { - u16 key = Keys.keycode[i]; - char *key_str = NULL; - - if (key == 0) - key = keyboard_old_key; - key_str = (char *)&key; - - printf ("Key %d is %X\n", i, key); - key &= ~KB_KEYPAD; - if (key & KB_RAWDAT) - { - key &= 0xFF; - if (key == KB_RAWKEY_ESCAPE) - key_str = "Escape"; - else if (key == KB_RAWKEY_ENTER) - key_str = "Return"; - else if (key == KB_RAWKEY_UP_ARROW) - key_str = "Up"; - else if (key == KB_RAWKEY_DOWN_ARROW) - key_str = "Down"; - else if (key == KB_RAWKEY_LEFT_ARROW) - key_str = "Left"; - else if (key == KB_RAWKEY_RIGHT_ARROW) - key_str = "Right"; - else - key_str = NULL; - } - else { - if (key == 0x0A) - key_str = "Return"; - else { - key_str[0] = key_str[1]; - key_str[1] = 0; - } - } - if (key_str) - { - if (Keys.keycode[i] != 0) - { - printf ("Key %s pressed\n", key_str); - evas_event_feed_key_up(evas, key_str, key_str, NULL, NULL, 0, NULL); - } - else { - evas_event_feed_key_down(evas, key_str, key_str, NULL, NULL, 0, NULL); - printf ("Key %s released\n", key_str); - } - } - keyboard_old_key = Keys.keycode[0]; - } - } - } - } - return; -} - -void -engine_psl1ght_shutdown(void) -{ - ioMouseEnd(); - ioKbEnd(); - return; -} - diff --git a/src/bin/engine_psl1ght.h b/src/bin/engine_psl1ght.h deleted file mode 100644 index 69610c5..0000000 --- a/src/bin/engine_psl1ght.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef ENGINE_SOFTWARE_PSL1GHT_H -#define ENGINE_SOFTWARE_PSL1GHT_H - -Eina_Bool engine_psl1ght_args(const char *engine, int width, int height); -void engine_psl1ght_loop(void); -void engine_psl1ght_shutdown(void); - -#endif diff --git a/src/bin/engine_software_16_wince.c b/src/bin/engine_software_16_wince.c deleted file mode 100644 index 4506f2e..0000000 --- a/src/bin/engine_software_16_wince.c +++ /dev/null @@ -1,324 +0,0 @@ -#include "main.h" - -#include -#include -#include - - -static HINSTANCE instance = NULL; -static HWND window = NULL; -static int backend = 0; - -typedef int (*suspend) (int backend); -typedef int (*resume) (int backend); - -static suspend _suspend = NULL; -static resume _resume = NULL; - - -typedef BOOL (__stdcall *UnregisterFunc1Proc)(UINT, UINT); - -static int -_wince_hardware_keys_register(HWND window) -{ - HINSTANCE core_dll; - UnregisterFunc1Proc unregister_fct; - int i; - - core_dll = LoadLibrary(L"coredll.dll"); - if (!core_dll) - return 0; - - unregister_fct = (UnregisterFunc1Proc)GetProcAddress(core_dll, L"UnregisterFunc1"); - if (!unregister_fct) - { - FreeLibrary(core_dll); - return 0; - } - - for (i = 0xc1; i <= 0xcf; i++) - { - unregister_fct(MOD_WIN, i); - RegisterHotKey(window, i, MOD_WIN, i); - } - - FreeLibrary(core_dll); - - return 1; -} - -static void -_wince_key_down(WPARAM wParam) -{ - int key; - - key = LOWORD(wParam); - - if ((key == VK_SHIFT) || - (key == VK_LSHIFT) || - (key == VK_RSHIFT)) - evas_key_modifier_on(evas, "Shift"); - - if (key == VK_CAPITAL) - { - if (evas_key_lock_is_set(evas_key_lock_get(evas), "Caps_Lock")) - evas_key_lock_off(evas, "Caps_Lock"); - else - evas_key_lock_on(evas, "Caps_Lock"); - } - if ((key == VK_RETURN) || (key == VK_APP1)) - evas_event_feed_key_down(evas, "Return", "Return", NULL, NULL, 0, NULL); - if (key == VK_LEFT) - evas_event_feed_key_down(evas, "Left", "Left", NULL, NULL, 0, NULL); - if (key == VK_RIGHT) - evas_event_feed_key_down(evas, "Right", "Right", NULL, NULL, 0, NULL); - if ((key == 81) || (key == VK_APP2)) - evas_event_feed_key_down(evas, "Q", "Q", NULL, NULL, 0, NULL); - if ((key == 113) || (key == VK_APP3)) - evas_event_feed_key_down(evas, "q", "q", NULL, NULL, 0, NULL); -} - -static void -_wince_key_up(WPARAM wParam) -{ - int key; - - key = LOWORD(wParam); - - if ((key == VK_SHIFT) || - (key == VK_LSHIFT) || - (key == VK_RSHIFT)) - evas_key_modifier_off(evas, "Shift"); - if ((key == VK_RETURN) || (key == VK_APP1)) - evas_event_feed_key_up(evas, "Return", "Return", NULL, NULL, 0, NULL); - if (key == VK_LEFT) - evas_event_feed_key_up(evas, "Left", "Left", NULL, NULL, 0, NULL); - if (key == VK_RIGHT) - evas_event_feed_key_up(evas, "Right", "Right", NULL, NULL, 0, NULL); - if ((key == 81) || (key == VK_APP2)) - evas_event_feed_key_up(evas, "Q", "Q", NULL, NULL, 0, NULL); - if ((key == 113) || (key == VK_APP3)) - evas_event_feed_key_up(evas, "q", "q", NULL, NULL, 0, NULL); -} - -static LRESULT CALLBACK -MainWndProc(HWND hwnd, - UINT uMsg, - WPARAM wParam, - LPARAM lParam) -{ - switch (uMsg) - { - case WM_DESTROY: - PostQuitMessage(0); - return 0; - case WM_CLOSE: - PostQuitMessage(0); - return 0; - case WM_PAINT: - ValidateRect(hwnd, NULL); - return 0; - case WM_HOTKEY: - _wince_key_down(wParam); - return 0; - case WM_KEYDOWN: - _wince_key_down(wParam); - return 0; - case WM_KEYUP: - _wince_key_up(wParam); - return 0; - case WM_KILLFOCUS: - if (_suspend) - _suspend (backend); - return 0; - case WM_SETFOCUS: - if (_resume) - _resume (backend); - return 0; - case WM_SIZE: - { - Evas_Engine_Info_Software_16_WinCE *einfo; - - printf ("WM_SIZE %dx%d\n", LOWORD(lParam), HIWORD(lParam)); - einfo = (Evas_Engine_Info_Software_16_WinCE *)evas_engine_info_get(evas); - if (!einfo) - return 0; - - if (einfo->info.rotation != 0) - { - einfo->info.width = win_h; - einfo->info.height = win_w; - einfo->info.rotation = 90; - } - else - { - einfo->info.width = win_w; - einfo->info.height = win_h; - einfo->info.rotation = 0; - } - - evas_engine_info_set(evas, (Evas_Engine_Info *)einfo); - - return 0; - } - default: - return DefWindowProc(hwnd, uMsg, wParam, lParam); - } -} - -Eina_Bool -engine_software_16_wince_args(const char *engine, int width, int height) -{ - WNDCLASS wc; - RECT rect; - Evas_Engine_Info_Software_16_WinCE *einfo; - HWND task_bar; - HWND sip_window; - HWND sip_icon; - int stride_x; - int stride_y; - int bpp; - int format; - void *buffer; - int ok = 0; - int i; - - if (!strcmp(engine, "wince")) ok = 1; - if (!strcmp(engine, "wince-fb")) { ok = 1; backend = 1; } - if (!strcmp(engine, "wince-gapi")) { ok = 1; backend = 2; } - if (!strcmp(engine, "wince-ddraw")) { ok = 1; backend = 3; } - if (!strcmp(engine, "wince-gdi")) { ok = 1; backend = 4; } - if (!ok) return EINA_FALSE; - - instance = GetModuleHandle(NULL); - if (!instance) return EINA_FALSE; - - memset (&wc, 0, sizeof (wc)); - wc.style = CS_HREDRAW | CS_VREDRAW; - wc.lpfnWndProc = MainWndProc; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - wc.hInstance = instance; - wc.hIcon = NULL; - wc.hCursor = LoadCursor (NULL, IDC_ARROW); - wc.hbrBackground = GetSysColorBrush(COLOR_BTNFACE); - wc.lpszMenuName = NULL; - wc.lpszClassName = L"Evas_Software_16_WinCE_Test"; - - if(!RegisterClass(&wc)) - goto free_library; - - SetRect(&rect, 0, 0, - GetSystemMetrics(SM_CXSCREEN), - GetSystemMetrics(SM_CYSCREEN)); - - window = CreateWindowEx(WS_EX_TOPMOST, - L"Evas_Software_16_WinCE_Test", - L"Evas_Software_16_WinCE_Test", - WS_VISIBLE | WS_POPUP, - rect.left, rect.top, - rect.right - rect.left, - rect.bottom - rect.top, - NULL, NULL, instance, NULL); - if (!window) - goto unregister_class; - - /* hide top level windows (Task bar, SIP and SIP button */ - task_bar = FindWindow(L"HHTaskBar", NULL); - ShowWindow(task_bar, SW_HIDE); - EnableWindow(task_bar, FALSE); - sip_window = FindWindow(L"SipWndClass", NULL); - ShowWindow(sip_window, SW_HIDE); - EnableWindow(sip_window, FALSE); - sip_icon = FindWindow(L"MS_SIPBUTTON", NULL); - ShowWindow(sip_icon, SW_HIDE); - EnableWindow(sip_icon, FALSE); - - if (!_wince_hardware_keys_register(window)) - goto destroy_window; - - evas_output_method_set(evas, evas_render_method_lookup("software_16_wince")); - - einfo = (Evas_Engine_Info_Software_16_WinCE *)evas_engine_info_get(evas); - if (!einfo) - { - printf("Evas does not support the 16bit Software WinCE Engine\n"); - goto destroy_window; - } - - einfo->info.window = window; - einfo->info.width = width; - einfo->info.height = height; - einfo->info.backend = backend; - einfo->info.rotation = 0; - if (!evas_engine_info_set(evas, (Evas_Engine_Info *) einfo)) - { - printf("Evas can not setup the informations of the 16 bits Software WinCE Engine\n"); - goto destroy_window; - } - - _suspend = einfo->func.suspend; - _resume = einfo->func.resume; - - /* the second parameter is ignored, as it's the first call of ShowWindow */ - ShowWindow(window, SW_SHOWDEFAULT); - UpdateWindow(window); - - return EINA_TRUE; - - destroy_window: - DestroyWindow(window); - ShowWindow(task_bar, SW_SHOW); - EnableWindow(task_bar, TRUE); - ShowWindow(sip_window, SW_SHOW); - EnableWindow(sip_window, TRUE); - ShowWindow(sip_icon, SW_SHOW); - EnableWindow(sip_icon, TRUE); - unregister_class: - UnregisterClass(L"Evas_Software_16_WinCE_Test", instance); - free_library: - FreeLibrary(instance); - - return EINA_FALSE; -} - -void -engine_software_16_wince_loop(void) -{ - MSG msg; - int res; - - again: - if (!PeekMessage (&msg, window, 0, 0, PM_NOREMOVE)) - return; - - res = GetMessage (&msg, NULL, 0, 0); - TranslateMessage (&msg); - DispatchMessage (&msg); - - goto again; -} - -void -engine_software_16_wince_shutdown(void) -{ - HWND task_bar; - HWND sip_window; - HWND sip_icon; - - DestroyWindow(window); - - /* show top level windows (Task bar, SIP and SIP button */ - task_bar = FindWindow(L"HHTaskBar", NULL); - ShowWindow(task_bar, SW_SHOW); - EnableWindow(task_bar, TRUE); - sip_window = FindWindow(L"SipWndClass", NULL); - ShowWindow(sip_window, SW_SHOW); - EnableWindow(sip_window, TRUE); - sip_icon = FindWindow(L"MS_SIPBUTTON", NULL); - ShowWindow(sip_icon, SW_SHOW); - EnableWindow(sip_icon, TRUE); - - UnregisterClass(L"Evas_Software_16_WinCE_Test", instance); - FreeLibrary(instance); -} diff --git a/src/bin/engine_software_16_wince.h b/src/bin/engine_software_16_wince.h deleted file mode 100644 index 10be16c..0000000 --- a/src/bin/engine_software_16_wince.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __ENGINE_SOFTWARE_16_WINCE_H__ -#define __ENGINE_SOFTWARE_16_WINCE_H__ - - -Eina_Bool engine_software_16_wince_args(const char *engine, int width, int height); -void engine_software_16_wince_loop(void); -void engine_software_16_wince_shutdown(void); - - -#endif /* __ENGINE_SOFTWARE_16_WINCE_H__ */ diff --git a/src/bin/engine_software_ddraw.h b/src/bin/engine_software_ddraw.h deleted file mode 100644 index ec7e7c9..0000000 --- a/src/bin/engine_software_ddraw.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef __ENGINE_SOFTWARE_DDRAW_H__ -#define __ENGINE_SOFTWARE_DDRAW_H__ - - -#ifdef __cplusplus -extern "C" { -#endif - -Eina_Bool engine_software_ddraw_args(const char *engine, int width, int height); -void engine_software_ddraw_loop(void); -void engine_software_ddraw_shutdown(void); - - -#ifdef __cplusplus -} -#endif - - -#endif /* __ENGINE_SOFTWARE_DDRAW_H__ */ diff --git a/src/bin/engine_software_gdi.c b/src/bin/engine_software_gdi.c deleted file mode 100644 index 92218b1..0000000 --- a/src/bin/engine_software_gdi.c +++ /dev/null @@ -1,293 +0,0 @@ -#include "main.h" - -#include -#include - - -static HWND window; -static HINSTANCE instance; - - -static LRESULT CALLBACK -MainWndProc(HWND hwnd, - UINT uMsg, - WPARAM wParam, - LPARAM lParam) -{ - switch (uMsg) - { - case WM_CREATE: - return 0; - case WM_DESTROY: - PostQuitMessage(0); - return 0; - case WM_CLOSE: - PostQuitMessage(0); - return 0; - case WM_WINDOWPOSCHANGED: { - PAINTSTRUCT ps; - HDC hdc; - - hdc = BeginPaint (window, &ps); - evas_damage_rectangle_add(evas, - ps.rcPaint.left, ps.rcPaint.top, - ps.rcPaint.right - ps.rcPaint.left, - ps.rcPaint.bottom - ps.rcPaint.top); - EndPaint(window, &ps); - return 0; - } - case WM_SIZING: - { - PRECT rect = (PRECT)lParam; - - evas_output_viewport_set(evas, 0, 0, - rect->right - rect->left, - rect->bottom - rect->top); - evas_output_size_set(evas, - rect->right - rect->left, - rect->bottom - rect->top); - win_w = rect->right - rect->left; - win_h = rect->bottom - rect->top; - return 0; - } - case WM_RBUTTONDOWN: - evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL); - evas_event_feed_mouse_down(evas, 3, EVAS_BUTTON_NONE, 0, NULL); - return 0; - case WM_LBUTTONDOWN: - evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL); - evas_event_feed_mouse_down(evas, 1, EVAS_BUTTON_NONE, 0, NULL); - return 0; - case WM_LBUTTONUP: - evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL); - evas_event_feed_mouse_up(evas, 1, EVAS_BUTTON_NONE, 0, NULL); - return 0; - case WM_RBUTTONUP: - evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL); - evas_event_feed_mouse_up(evas, 3, EVAS_BUTTON_NONE, 0, NULL); - return 0; - case WM_MOUSEMOVE: - if (!evas_pointer_inside_get(evas)) evas_event_feed_mouse_in(evas, 0, NULL); - evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL); - return 0; - case WM_MOUSELEAVE: - evas_event_feed_mouse_out(evas, 0, NULL); - return 0; - /* FIXME : can't find an event when the mouse is entering */ - case WM_KEYDOWN: - case WM_SYSKEYDOWN: { - int key; - - key = LOWORD(wParam); - - if ((key == VK_SHIFT) || - (key == VK_LSHIFT) || - (key == VK_RSHIFT)) - evas_key_modifier_on(evas, "Shift"); - if ((key == VK_CONTROL) || - (key == VK_LCONTROL) || - (key == VK_RCONTROL)) - evas_key_modifier_on(evas, "Control"); - if ((key == VK_MENU) || - (key == VK_LMENU) || - (key == VK_RMENU)) - evas_key_modifier_on(evas, "Alt"); - if ((key == VK_LWIN) || - (key == VK_RWIN)) - evas_key_modifier_on(evas, "Super"); - - if (key == VK_CAPITAL) - { - if (evas_key_lock_is_set(evas_key_lock_get(evas), "Caps_Lock")) - evas_key_lock_off(evas, "Caps_Lock"); - else - evas_key_lock_on(evas, "Caps_Lock"); - } - if (key == VK_NUMLOCK) - { - if (evas_key_lock_is_set(evas_key_lock_get(evas), "Num_Lock")) - evas_key_lock_off(evas, "Num_Lock"); - else - evas_key_lock_on(evas, "Num_Lock"); - } - if (key == VK_SCROLL) - { - if (evas_key_lock_is_set(evas_key_lock_get(evas), "Scroll_Lock")) - evas_key_lock_off(evas, "Scroll_Lock"); - else - evas_key_lock_on(evas, "Scroll_Lock"); - } - if (key == VK_ESCAPE) - evas_event_feed_key_down(evas, "Escape", "Escape", NULL, NULL, 0, NULL); - if (key == VK_RETURN) - evas_event_feed_key_down(evas, "Return", "Return", NULL, NULL, 0, NULL); - if (key == VK_LEFT) - evas_event_feed_key_down(evas, "Left", "Left", NULL, NULL, 0, NULL); - if (key == VK_RIGHT) - evas_event_feed_key_down(evas, "Right", "Right", NULL, NULL, 0, NULL); - if (key == 81) - evas_event_feed_key_down(evas, "Q", "Q", NULL, NULL, 0, NULL); - if (key == 113) - evas_event_feed_key_down(evas, "q", "q", NULL, NULL, 0, NULL); - return 0; - } - case WM_KEYUP: - case WM_SYSKEYUP: { - int key; - - key = LOWORD(wParam); - - if ((key == VK_SHIFT) || - (key == VK_LSHIFT) || - (key == VK_RSHIFT)) - evas_key_modifier_off(evas, "Shift"); - if ((key == VK_CONTROL) || - (key == VK_LCONTROL) || - (key == VK_RCONTROL)) - evas_key_modifier_off(evas, "Control"); - if ((key == VK_MENU) || - (key == VK_LMENU) || - (key == VK_RMENU)) - evas_key_modifier_off(evas, "Alt"); - if ((key == VK_LWIN) || - (key == VK_RWIN)) - evas_key_modifier_off(evas, "Super"); - if (key == VK_ESCAPE) - evas_event_feed_key_up(evas, "Escape", "Escape", NULL, NULL, 0, NULL); - if (key == VK_RETURN) - evas_event_feed_key_up(evas, "Return", "Return", NULL, NULL, 0, NULL); - if (key == VK_LEFT) - evas_event_feed_key_up(evas, "Left", "Left", NULL, NULL, 0, NULL); - if (key == VK_RIGHT) - evas_event_feed_key_up(evas, "Right", "Right", NULL, NULL, 0, NULL); - if (key == 81) - evas_event_feed_key_up(evas, "Q", "Q", NULL, NULL, 0, NULL); - if (key == 113) - evas_event_feed_key_up(evas, "q", "q", NULL, NULL, 0, NULL); - return 0; - } - default: - return DefWindowProc(hwnd, uMsg, wParam, lParam); - } -} - -Eina_Bool -engine_software_gdi_args(const char *engine __UNUSED__, int width, int height) -{ - WNDCLASS wc; - RECT rect; - HDC dc; - Evas_Engine_Info_Software_Gdi *einfo; - DWORD style; - DWORD exstyle; - int depth; - - instance = GetModuleHandle(NULL); - if (!instance) return EINA_FALSE; - - wc.style = CS_HREDRAW | CS_VREDRAW; - wc.lpfnWndProc = MainWndProc; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - wc.hInstance = instance; - wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); - wc.hCursor = LoadCursor(NULL, IDC_ARROW); - wc.hbrBackground = GetSysColorBrush(COLOR_BTNFACE); - wc.lpszMenuName = NULL; - wc.lpszClassName = "Evas_Software_Gdi_Test"; - - if(!RegisterClass(&wc)) - goto free_library; - - style = WS_OVERLAPPEDWINDOW | WS_SIZEBOX; - exstyle = 0; - - rect.left = 0; - rect.top = 0; - rect.right = width; - rect.bottom = height; - AdjustWindowRectEx (&rect, style, FALSE, exstyle); - - window = CreateWindowEx(exstyle, - "Evas_Software_Gdi_Test", - "Evas_Software_Gdi_Test", - style, - CW_USEDEFAULT, CW_USEDEFAULT, - rect.right - rect.left, rect.bottom - rect.top, - NULL, NULL, instance, NULL); - if (!window) - goto destroy_window; - - /* make the window non resizable */ - style = GetWindowLong(window, GWL_STYLE); - style &= ~WS_THICKFRAME; - if (!SetWindowLong(window, GWL_STYLE, style)) - goto unregister_class; - - dc = GetDC(NULL); - if (!dc) - goto destroy_window; - - depth = GetDeviceCaps(dc, BITSPIXEL); - ReleaseDC(NULL, dc); - - evas_output_method_set(evas, evas_render_method_lookup("software_gdi")); - einfo = (Evas_Engine_Info_Software_Gdi *)evas_engine_info_get(evas); - if (!einfo) - { - fprintf(stderr, "Evas does not support the Software GDI Engine\n"); - goto destroy_window; - } - - einfo->info.window = window; - einfo->info.depth = depth; - einfo->info.rotation = 0; - einfo->info.borderless = 0; - einfo->info.fullscreen = 0; - einfo->info.region = 0; - if (!evas_engine_info_set(evas, (Evas_Engine_Info *) einfo)) - { - printf("Evas can not setup the informations of the Software GDI Engine\n"); - goto destroy_window; - } - - /* the second parameter is ignored, as it's the first call of ShowWindow */ - ShowWindow(window, SW_SHOWDEFAULT); - UpdateWindow(window); - - return EINA_TRUE; - - destroy_window: - DestroyWindow(window); - unregister_class: - UnregisterClass("Evas_Software_Gdi_Test", instance); - free_library: - FreeLibrary(instance); - - return EINA_FALSE; -} - -void -engine_software_gdi_loop(void) -{ - MSG msg; - int res; - - again: - if (!PeekMessage (&msg, window, 0, 0, PM_NOREMOVE)) - return; - - res = GetMessage (&msg, NULL, 0, 0); - TranslateMessage (&msg); - DispatchMessage (&msg); - - goto again; -} - -void -engine_software_gdi_shutdown(void) -{ - DestroyWindow(window); - UnregisterClass("Evas_Software_Gdi_Test", instance); - FreeLibrary(instance); -} diff --git a/src/bin/engine_software_gdi.h b/src/bin/engine_software_gdi.h deleted file mode 100644 index 47bd58a..0000000 --- a/src/bin/engine_software_gdi.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef __ENGINE_SOFTWARE_GDI_H__ -#define __ENGINE_SOFTWARE_GDI_H__ - - -#ifdef __cplusplus -extern "C" { -#endif - -Eina_Bool engine_software_gdi_args(const char *engine, int width, int height); -void engine_software_gdi_loop(void); -void engine_software_gdi_shutdown(void); - - -#ifdef __cplusplus -} -#endif - - -#endif /* __ENGINE_SOFTWARE_GDI_H__ */ diff --git a/src/bin/engine_software_sdl.c b/src/bin/engine_software_sdl.c deleted file mode 100644 index a786d9f..0000000 --- a/src/bin/engine_software_sdl.c +++ /dev/null @@ -1,242 +0,0 @@ -#include -#include "main.h" - -#include -#include - -static void * -_expedite_sdl_switch_buffer(void *data, void *dest __UNUSED__) -{ - SDL_Flip(data); - return ((SDL_Surface*)data)->pixels; -} - -Eina_Bool -engine_software_sdl_args(const char *engine, int width, int height) -{ - int ok = 0; - - if (!strcmp(engine, "sdl")) ok = 1; - if (!ok) return EINA_FALSE; - - if (ok == 1) - { - Evas_Engine_Info_Buffer *einfo; - - evas_output_method_set(evas, evas_render_method_lookup("buffer")); - - einfo = (Evas_Engine_Info_Buffer *) evas_engine_info_get(evas); - if (einfo) - { - SDL_Init(SDL_INIT_NOPARACHUTE); - - if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0) - { - printf("SDL_Init failed with %s", SDL_GetError()); - SDL_Quit(); - return EINA_FALSE; - } - - einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32; - einfo->info.switch_data = SDL_SetVideoMode(width, height, 32, SDL_HWSURFACE | SDL_DOUBLEBUF); - if (!einfo->info.switch_data) - { - printf("SDL_SetVideoMode failed !"); - return EINA_FALSE; - } - - SDL_SetAlpha(einfo->info.switch_data, SDL_SRCALPHA, 0); - SDL_FillRect(einfo->info.switch_data, NULL, 0); - - einfo->info.dest_buffer = ((SDL_Surface*)einfo->info.switch_data)->pixels; - einfo->info.dest_buffer_row_bytes = width * sizeof (int); - einfo->info.use_color_key = 0; - einfo->info.alpha_threshold = 0; - einfo->info.func.new_update_region = NULL; - einfo->info.func.free_update_region = NULL; - einfo->info.func.switch_buffer = _expedite_sdl_switch_buffer; - if (!evas_engine_info_set(evas, (Evas_Engine_Info *) einfo)) - { - printf("evas_engine_info_set() for engine 'sdl' with 'buffer' backend failed."); - return EINA_FALSE; - } - } - } - - return EINA_TRUE; -} - -void -engine_software_sdl_loop(void) -{ - SDL_Event event; - int rmethod; - - while(SDL_PollEvent(&event)) - { - switch(event.type) - { - case SDL_MOUSEMOTION: - evas_event_feed_mouse_move(evas, event.motion.x, event.motion.y, 0, NULL); - break; - case SDL_MOUSEBUTTONDOWN: - evas_event_feed_mouse_move(evas, event.button.x, event.button.y, 0, NULL); - evas_event_feed_mouse_down(evas, event.button.button, EVAS_BUTTON_NONE, 0, NULL); - break; - case SDL_MOUSEBUTTONUP: - evas_event_feed_mouse_move(evas, event.button.x, event.button.y, 0, NULL); - evas_event_feed_mouse_up(evas, event.button.button, EVAS_BUTTON_NONE, 0, NULL); - break; - case SDL_VIDEORESIZE: - rmethod = evas_output_method_get(evas); - if (rmethod == evas_render_method_lookup("buffer")) - { - Evas_Engine_Info_Buffer *einfo; - - einfo = (Evas_Engine_Info_Buffer *) evas_engine_info_get(evas); - if (einfo) - { - einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32; - einfo->info.switch_data = SDL_SetVideoMode(event.resize.w, event.resize.h, 32, SDL_HWSURFACE | SDL_DOUBLEBUF); - if (!einfo->info.switch_data) - { - return ; - } - - SDL_SetAlpha(einfo->info.switch_data, SDL_SRCALPHA, 0); - SDL_FillRect(einfo->info.switch_data, NULL, 0); - - einfo->info.dest_buffer = ((SDL_Surface*)einfo->info.switch_data)->pixels; - einfo->info.dest_buffer_row_bytes = event.resize.w * sizeof (int); - einfo->info.use_color_key = 0; - einfo->info.alpha_threshold = 0; - einfo->info.func.new_update_region = NULL; - einfo->info.func.free_update_region = NULL; - einfo->info.func.switch_buffer = _expedite_sdl_switch_buffer; - if (!evas_engine_info_set(evas, (Evas_Engine_Info *) einfo)) - { - return ; - } - } - } - - evas_output_viewport_set(evas, 0, 0, - event.resize.h, event.resize.w); - evas_output_size_set(evas, event.resize.h, event.resize.w); - evas_output_size_get(evas, &win_w, &win_h); - break; - case SDL_VIDEOEXPOSE: - evas_output_size_get(evas, &win_w, &win_h); - evas_damage_rectangle_add(evas, 0, 0, win_w, win_h); - break; - case SDL_KEYDOWN: - switch (event.key.keysym.sym) - { - case SDLK_LSHIFT: - case SDLK_RSHIFT: - evas_key_modifier_on(evas, "Shift"); - break; - case SDLK_RCTRL: - case SDLK_LCTRL: - evas_key_modifier_on(evas, "Control"); - break; - case SDLK_MENU: - case SDLK_RALT: - case SDLK_LALT: - evas_key_modifier_on(evas, "Alt"); - break; - case SDLK_LSUPER: - case SDLK_RSUPER: - evas_key_modifier_on(evas, "Super"); - break; - case SDLK_CAPSLOCK: - if (evas_key_lock_is_set(evas_key_lock_get(evas), "Caps_Lock")) - evas_key_lock_off(evas, "Caps_Lock"); - else - evas_key_lock_on(evas, "Caps_Lock"); - break; - case SDLK_NUMLOCK: - if (evas_key_lock_is_set(evas_key_lock_get(evas), "Num_Lock")) - evas_key_lock_off(evas, "Num_Lock"); - else - evas_key_lock_on(evas, "Num_Lock"); - break; - case SDLK_SCROLLOCK: - if (evas_key_lock_is_set(evas_key_lock_get(evas), "Scroll_Lock")) - evas_key_lock_off(evas, "Scroll_Lock"); - else - evas_key_lock_on(evas, "Scroll_Lock"); - break; - case SDLK_s: - case SDLK_ESCAPE: - evas_event_feed_key_down(evas, "Escape", "Escape", NULL, NULL, 0, NULL); - break; - case SDLK_KP_ENTER: - case SDLK_RETURN: - evas_event_feed_key_down(evas, "Return", "Return", NULL, NULL, 0, NULL); - break; - case SDLK_LEFT: evas_event_feed_key_down(evas, "Left", "Left", NULL, NULL, 0, NULL); break; - case SDLK_RIGHT: evas_event_feed_key_down(evas, "Right", "Right", NULL, NULL, 0, NULL); break; - case SDLK_q: - if (evas_key_lock_is_set(evas_key_lock_get(evas), "Caps_Lock")) - evas_event_feed_key_down(evas, "Q", "Q", NULL, NULL, 0, NULL); - else - evas_event_feed_key_down(evas, "q", "q", NULL, NULL, 0, NULL); - break; - default: - break; - } - break; - case SDL_KEYUP: - switch (event.key.keysym.sym) - { - case SDLK_LSHIFT: - case SDLK_RSHIFT: - evas_key_modifier_off(evas, "Shift"); - break; - case SDLK_RCTRL: - case SDLK_LCTRL: - evas_key_modifier_off(evas, "Control"); - break; - case SDLK_MENU: - case SDLK_RALT: - case SDLK_LALT: - evas_key_modifier_off(evas, "Alt"); - break; - case SDLK_LSUPER: - case SDLK_RSUPER: - evas_key_modifier_off(evas, "Super"); - break; - case SDLK_ESCAPE: evas_event_feed_key_up(evas, "Escape", "Escape", NULL, NULL, 0, NULL); break; - case SDLK_RETURN: evas_event_feed_key_up(evas, "Return", "Return", NULL, NULL, 0, NULL); break; - case SDLK_LEFT: evas_event_feed_key_up(evas, "Left", "Left", NULL, NULL, 0, NULL); break; - case SDLK_RIGHT: evas_event_feed_key_up(evas, "Right", "Right", NULL, NULL, 0, NULL); break; - case SDLK_q: - if (evas_key_lock_is_set(evas_key_lock_get(evas), "Caps_Lock")) - evas_event_feed_key_up(evas, "Q", "Q", NULL, NULL, 0, NULL); - else - evas_event_feed_key_up(evas, "q", "q", NULL, NULL, 0, NULL); - break; - default: - break; - } - break; - case SDL_QUIT: - case SDL_SYSWMEVENT: - case SDL_USEREVENT: - case SDL_ACTIVEEVENT: - case SDL_JOYAXISMOTION: - case SDL_JOYBALLMOTION: - case SDL_JOYHATMOTION: - case SDL_JOYBUTTONDOWN: - case SDL_JOYBUTTONUP: - default: - break; - } - } -} - -void -engine_software_sdl_shutdown(void) -{ -} diff --git a/src/bin/engine_software_sdl.h b/src/bin/engine_software_sdl.h deleted file mode 100644 index 0641005..0000000 --- a/src/bin/engine_software_sdl.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef ENGINE_SOFTWARE_SDL_H -#define ENGINE_SOFTWARE_SDL_H - -Eina_Bool engine_software_sdl_args(const char *engine, int width, int height); -void engine_software_sdl_loop(void); -void engine_software_sdl_shutdown(void); - -#endif diff --git a/src/bin/engine_software_xcb.c b/src/bin/engine_software_xcb.c deleted file mode 100644 index f1a8bbd..0000000 --- a/src/bin/engine_software_xcb.c +++ /dev/null @@ -1,399 +0,0 @@ -#include "main.h" - -#include -#include -#include - -#define XK_MISCELLANY -#include - -enum { - XCB_SIZE_US_POSITION_HINT = 1 << 0, - XCB_SIZE_US_SIZE_HINT = 1 << 1, - XCB_SIZE_P_POSITION_HINT = 1 << 2, - XCB_SIZE_P_SIZE_HINT = 1 << 3, - XCB_SIZE_P_MIN_SIZE_HINT = 1 << 4, - XCB_SIZE_P_MAX_SIZE_HINT = 1 << 5, - XCB_SIZE_P_RESIZE_INC_HINT = 1 << 6, - XCB_SIZE_P_ASPECT_HINT = 1 << 7, - XCB_SIZE_BASE_SIZE_HINT = 1 << 8, - XCB_SIZE_P_WIN_GRAVITY_HINT = 1 << 9 -}; - -struct xcb_size_hints_t { - uint32_t flags; - int32_t x, y, width, height; - int32_t min_width, min_height; - int32_t max_width, max_height; - int32_t width_inc, height_inc; - int32_t min_aspect_num, min_aspect_den; - int32_t max_aspect_num, max_aspect_den; - int32_t base_width, base_height; - uint32_t win_gravity; -}; - - -static xcb_connection_t *conn = NULL; -static xcb_screen_t *screen = NULL; -static xcb_window_t win = 0; -static int first_expose = 0; - -Eina_Bool -engine_software_xcb_args(const char *engine, int width, int height) -{ - struct xcb_size_hints_t hints; - uint32_t value_list[6]; - xcb_screen_iterator_t iter; - Evas_Engine_Info_Software_X11 *einfo; - xcb_intern_atom_reply_t *reply; - const char *str; - xcb_intern_atom_cookie_t cookie1; - xcb_intern_atom_cookie_t cookie2; - xcb_intern_atom_cookie_t cookie3; - xcb_intern_atom_cookie_t cookie4; - xcb_intern_atom_cookie_t cookie5; - xcb_atom_t string; - xcb_atom_t wm_name; - xcb_atom_t wm_class; - xcb_atom_t wm_normal_hint; - xcb_atom_t wm_size_hint; - uint32_t value_mask; - int s; - int s_tmp; - int l1; - int l2; - int i; - - conn = xcb_connect(NULL, &s); - if (xcb_connection_has_error(conn)) return EINA_FALSE; - - cookie1 = xcb_intern_atom_unchecked(conn, 0, strlen("STRING"), "STRING"); - cookie2 = xcb_intern_atom_unchecked(conn, 0, strlen("WM_NAME"), "WM_NAME"); - cookie3 = xcb_intern_atom_unchecked(conn, 0, strlen("WM_CLASS"), "WM_CLASS"); - cookie4 = xcb_intern_atom_unchecked(conn, 0, strlen("WM_NORMAL_HINTS)"), "WM_NORMAL_HINTS)"); - cookie5 = xcb_intern_atom_unchecked(conn, 0, strlen("WM_SIZE_HINTS)"), "WM_SIZE_HINTS)"); - - s_tmp = s; - iter = xcb_setup_roots_iterator(xcb_get_setup(conn)); - for (; iter.rem; --s_tmp, xcb_screen_next (&iter)) - if (s_tmp == 0) - { - screen = iter.data; - break; - } - - evas_output_method_set(evas, evas_render_method_lookup("software_x11")); - einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(evas); - if (!einfo) - { - printf("Evas does not support the Software XCB Engine\n"); - goto close_connection; - } - - einfo->info.backend = EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XCB; - einfo->info.connection = conn; - einfo->info.screen = screen; - einfo->info.visual = einfo->func.best_visual_get(1, conn, s); - einfo->info.colormap = einfo->func.best_colormap_get(1, conn, s); - einfo->info.depth = einfo->func.best_depth_get(1, conn, s); - einfo->info.rotation = 0; - einfo->info.debug = 0; - - value_mask = - XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL | XCB_CW_BIT_GRAVITY | - XCB_CW_BACKING_STORE | XCB_CW_EVENT_MASK | XCB_CW_COLORMAP; - - value_list[0] = XCB_NONE; - value_list[1] = 0; - value_list[2] = XCB_GRAVITY_BIT_FORGET; - value_list[3] = XCB_BACKING_STORE_NOT_USEFUL; - value_list[4] = - XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE | - XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | - XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW | - XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_EXPOSURE | - XCB_EVENT_MASK_STRUCTURE_NOTIFY; - value_list[5] = einfo->info.colormap; - - win = xcb_generate_id(conn); - if (!win) - goto close_connection; - xcb_create_window(conn, - einfo->info.depth, - win, screen->root, 0, 0, width, height, 0, - XCB_WINDOW_CLASS_INPUT_OUTPUT, - ((xcb_visualtype_t *)einfo->info.visual)->visual_id, - value_mask, - value_list); - einfo->info.drawable = win; - - if (!evas_engine_info_set(evas, (Evas_Engine_Info *) einfo)) - { - printf("Evas can not setup the informations of the Software XCB Engine\n"); - goto destroy_window; - } - - if (fullscreen) - { - xcb_intern_atom_cookie_t cookie1; - xcb_intern_atom_cookie_t cookie2; - xcb_intern_atom_reply_t *reply; - xcb_atom_t prop; - xcb_atom_t type; - xcb_atom_t state; - - cookie1 = xcb_intern_atom_unchecked(conn, 0, strlen("_NET_WM_STATE"), "_NET_WM_STATE"); - cookie2 = xcb_intern_atom_unchecked(conn, 0, strlen("_NET_WM_STATE_FULLSCREEN"), "_NET_WM_STATE_FULLSCREEN"); - reply = xcb_intern_atom_reply(conn, cookie1, NULL); - prop = reply->atom; - free(reply); - reply = xcb_intern_atom_reply(conn, cookie2, NULL); - state = reply->atom; - free(reply); - xcb_change_property(conn, XCB_PROP_MODE_REPLACE, win, prop, XCB_ATOM_ATOM, 32, 1, (const void *)&state); - } - - str = "expedite\0Expedite"; - - memset(&hints, 0, sizeof(hints)); - hints.flags = XCB_SIZE_US_SIZE_HINT | XCB_SIZE_P_SIZE_HINT | XCB_SIZE_P_MIN_SIZE_HINT | XCB_SIZE_P_MAX_SIZE_HINT; - hints.min_width = width; - hints.max_width = width; - hints.min_height = height; - hints.max_height = height; - - reply = xcb_intern_atom_reply(conn, cookie1, NULL); - string = reply->atom; - free(reply); - - reply = xcb_intern_atom_reply(conn, cookie2, NULL); - wm_name = reply->atom; - free(reply); - - xcb_change_property(conn, XCB_PROP_MODE_REPLACE, win, - wm_name, string, 8, - strlen("Expedite - Evas Test Suite"), "Expedite - Evas Test Suite"); - - reply = xcb_intern_atom_reply(conn, cookie3, NULL); - wm_class = reply->atom; - free(reply); - - xcb_change_property(conn, XCB_PROP_MODE_REPLACE, win, - wm_class, string, 8, - l1 + l2 + 1, str); - - reply = xcb_intern_atom_reply(conn, cookie4, NULL); - wm_normal_hint = reply->atom; - free(reply); - - reply = xcb_intern_atom_reply(conn, cookie5, NULL); - wm_size_hint = reply->atom; - free(reply); - - xcb_change_property(conn, XCB_PROP_MODE_REPLACE, win, - wm_normal_hint, wm_size_hint, 32, - sizeof(hints) / 4, &hints); - - xcb_map_window(conn, win); - - free(xcb_get_input_focus_reply(conn, xcb_get_input_focus_unchecked(conn), NULL)); - - while (!first_expose) - engine_software_xcb_loop(); - return EINA_TRUE; - - destroy_window: - xcb_destroy_window(conn, win); - close_connection: - free(xcb_intern_atom_reply(conn, cookie1, NULL)); - free(xcb_intern_atom_reply(conn, cookie2, NULL)); - free(xcb_intern_atom_reply(conn, cookie3, NULL)); - free(xcb_intern_atom_reply(conn, cookie4, NULL)); - free(xcb_intern_atom_reply(conn, cookie5, NULL)); - xcb_disconnect(conn); - - return EINA_FALSE; -} - -void -engine_software_xcb_loop(void) -{ - xcb_generic_event_t *ev; - - again: - ev = xcb_poll_for_event(conn); - if (!ev) - return; - - switch (ev->response_type) - { - case XCB_BUTTON_PRESS: - { - xcb_button_press_event_t *e; - - e = (xcb_button_press_event_t *)ev; - - evas_event_feed_mouse_move(evas, e->event_x, e->event_y, 0, NULL); - evas_event_feed_mouse_down(evas, e->detail, EVAS_BUTTON_NONE, 0, NULL); - break; - } - case XCB_BUTTON_RELEASE: - { - xcb_button_release_event_t *e; - - e = (xcb_button_release_event_t *)ev; - - evas_event_feed_mouse_move(evas, e->event_x, e->event_y, 0, NULL); - evas_event_feed_mouse_up(evas, e->detail, EVAS_BUTTON_NONE, 0, NULL); - break; - } - case XCB_MOTION_NOTIFY: - { - xcb_motion_notify_event_t *e; - - e = (xcb_motion_notify_event_t *)ev; - - evas_event_feed_mouse_move(evas, e->event_x, e->event_y, 0, NULL); - break; - } - case XCB_EXPOSE: - { - xcb_expose_event_t *e; - - e = (xcb_expose_event_t *)ev; - - first_expose = 1; - evas_damage_rectangle_add(evas, - e->x, - e->y, - e->width, - e->height); - break; - } - case XCB_CONFIGURE_NOTIFY: - { - xcb_configure_notify_event_t *e; - - e = (xcb_configure_notify_event_t *)ev; - - evas_output_viewport_set(evas, 0, 0, - e->width, - e->height); - evas_output_size_set(evas, - e->width, - e->height); - win_w = e->width; - win_h = e->height; - break; - } - case XCB_ENTER_NOTIFY: - evas_event_feed_mouse_in(evas, 0, NULL); - break; - case XCB_LEAVE_NOTIFY: - evas_event_feed_mouse_out(evas, 0, NULL); - break; - case XCB_KEY_PRESS: - { - xcb_key_press_event_t *e; - xcb_key_symbols_t *kss; - xcb_keysym_t ks; - char *str = ""; - - e = (xcb_key_press_event_t *)ev; - - kss = xcb_key_symbols_alloc(conn); - - ks = xcb_key_symbols_get_keysym(kss, e->detail, 0); - - if ((ks == XK_Shift_L) || (ks == XK_Shift_R)) - evas_key_modifier_on(evas, "Shift"); - else if ((ks == XK_Control_L) || (ks == XK_Control_R)) - evas_key_modifier_on(evas, "Control"); - else if ((ks == XK_Alt_L) || (ks == XK_Alt_R)) - evas_key_modifier_on(evas, "Alt"); - else if ((ks == XK_Super_L) || (ks == XK_Super_R)) - evas_key_modifier_on(evas, "Super"); - else if (ks == XK_Caps_Lock) - { - if (evas_key_lock_is_set(evas_key_lock_get(evas), "Caps_Lock")) - evas_key_lock_off(evas, "Caps_Lock"); - else - evas_key_lock_on(evas, "Caps_Lock"); - } - else if (ks == XK_Scroll_Lock) - { - if (evas_key_lock_is_set(evas_key_lock_get(evas), "Scroll_Lock")) - evas_key_lock_off(evas, "Scroll_Lock"); - else - evas_key_lock_on(evas, "Scroll_Lock"); - } - - if (ks == XK_Left) - str = "Left"; - if (ks == XK_Right) - str = "Right"; - if (ks == XK_Escape) - str = "Escape"; - if (ks == XK_Return) - str = "Return"; - if (ks == 113) - str = "q"; - - evas_event_feed_key_down(evas, str, str, NULL, NULL, 0, NULL); - - xcb_key_symbols_free(kss); - break; - } - case XCB_KEY_RELEASE: - { - xcb_key_release_event_t *e; - xcb_key_symbols_t *kss; - xcb_keysym_t ks; - char *str = ""; - - e = (xcb_key_release_event_t *)ev; - - kss = xcb_key_symbols_alloc(conn); - - ks = xcb_key_symbols_get_keysym(kss, e->detail, 0); - - if ((ks == XK_Shift_L) || (ks == XK_Shift_R)) - evas_key_modifier_on(evas, "Shift"); - else if ((ks == XK_Control_L) || (ks == XK_Control_R)) - evas_key_modifier_on(evas, "Control"); - else if ((ks == XK_Alt_L) || (ks == XK_Alt_R)) - evas_key_modifier_on(evas, "Alt"); - else if ((ks == XK_Super_L) || (ks == XK_Super_R)) - evas_key_modifier_on(evas, "Super"); - - if (ks == XK_Left) - str = "Left"; - if (ks == XK_Right) - str = "Right"; - if (ks == XK_Escape) - str = "Escape"; - if (ks == XK_Return) - str = "Return"; - if (ks == 113) - str = "q"; - - evas_event_feed_key_up(evas, str, str, NULL, NULL, 0, NULL); - - xcb_key_symbols_free(kss); - break; - } - default: - free(ev); - return; - } - free(ev); - - goto again; -} - -void -engine_software_xcb_shutdown(void) -{ - xcb_destroy_window(conn, win); - xcb_disconnect(conn); -} diff --git a/src/bin/engine_software_xcb.h b/src/bin/engine_software_xcb.h deleted file mode 100644 index 3cbf3b8..0000000 --- a/src/bin/engine_software_xcb.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef ENGINE_SOFTWARE_XCB_H -#define ENGINE_SOFTWARE_XCB_H - -Eina_Bool engine_software_xcb_args(const char *engine, int width, int height); -void engine_software_xcb_loop(void); -void engine_software_xcb_shutdown(void); - -#endif diff --git a/src/bin/engine_software_xlib.c b/src/bin/engine_software_xlib.c deleted file mode 100644 index 0273796..0000000 --- a/src/bin/engine_software_xlib.c +++ /dev/null @@ -1,236 +0,0 @@ -#include "main.h" - -#include -#include -#include -#include -#include - -static Display *disp = NULL; -static Window win = 0; -static int first_expose = 0; - -Eina_Bool -engine_software_xlib_args(const char *engine __UNUSED__, int width, int height) -{ - XSetWindowAttributes attr; - XClassHint chint; - XSizeHints szhints; - Evas_Engine_Info_Software_X11 *einfo; - - disp = XOpenDisplay(NULL); - if (!disp) return EINA_FALSE; - - evas_output_method_set(evas, evas_render_method_lookup("software_x11")); - einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(evas); - if (!einfo) - { - printf("Evas does not support the Software Xlib Engine\n"); - goto close_display; - } - - einfo->info.backend = EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB; - einfo->info.connection = disp; - einfo->info.screen = NULL; - einfo->info.visual = einfo->func.best_visual_get(0, disp, DefaultScreen(disp)); - einfo->info.colormap = einfo->func.best_colormap_get(0, disp, DefaultScreen(disp)); - einfo->info.depth = einfo->func.best_depth_get(0, disp, DefaultScreen(disp)); - einfo->info.rotation = 0; - einfo->info.debug = 0; -#ifdef EVAS_FRAME_QUEUING - { - char *render_mode; - render_mode = getenv("EVAS_RENDER_MODE"); - if (render_mode && !strcmp(render_mode, "non-blocking")) - { - einfo->render_mode = EVAS_RENDER_MODE_NONBLOCKING; - } - } -#endif - attr.backing_store = NotUseful; - attr.colormap = einfo->info.colormap; - attr.border_pixel = 0; - attr.background_pixmap = None; - attr.event_mask = - ExposureMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask | - StructureNotifyMask | EnterWindowMask | LeaveWindowMask | - KeyPressMask | KeyReleaseMask; - attr.bit_gravity = ForgetGravity; - win = XCreateWindow(disp, DefaultRootWindow(disp), - 0, 0, width, height, 0, - einfo->info.depth, InputOutput, - einfo->info.visual, - CWBackingStore | CWColormap | - CWBackPixmap | CWBorderPixel | - CWBitGravity | CWEventMask, - &attr); - if (!win) - goto close_display; - - einfo->info.drawable = win; - if (!evas_engine_info_set(evas, (Evas_Engine_Info *) einfo)) - { - printf("Evas can not setup the informations of the Software Xlib Engine\n"); - goto destroy_window; - } - - if (fullscreen) - { - Atom prop = XInternAtom(disp, "_NET_WM_STATE", False); - Atom state = XInternAtom(disp, "_NET_WM_STATE_FULLSCREEN", False); - unsigned long data = state; - XChangeProperty(disp, win, prop, XA_ATOM, 32, PropModeReplace, - (unsigned char*) &data, 1); - } - - XStoreName(disp, win, "Expedite - Evas Test Suite"); - chint.res_name = "expedite"; - chint.res_class = "Expedite"; - XSetClassHint(disp, win, &chint); - szhints.flags = PMinSize | PMaxSize | PSize | USSize; - szhints.min_width = szhints.max_width = width; - szhints.min_height = szhints.max_height = height; - XSetWMNormalHints(disp, win, &szhints); - XMapWindow(disp, win); - XSync(disp, False); - while (!first_expose) - engine_software_xlib_loop(); - return EINA_TRUE; - - destroy_window: - XDestroyWindow(disp, win); - close_display: - XCloseDisplay(disp); - - return EINA_FALSE; -} - -void -engine_software_xlib_loop(void) -{ - XEvent ev; - KeySym ks; - char *kstr; - - again: - if (!XCheckMaskEvent(disp, - ExposureMask | - StructureNotifyMask | - KeyPressMask | - KeyReleaseMask | - ButtonPressMask | - ButtonReleaseMask | - PointerMotionMask | - EnterWindowMask | - LeaveWindowMask, &ev)) - return; - switch (ev.type) - { - case ButtonPress: - evas_event_feed_mouse_move(evas, ev.xbutton.x, ev.xbutton.y, 0, NULL); - evas_event_feed_mouse_down(evas, ev.xbutton.button, EVAS_BUTTON_NONE, 0, NULL); - break; - case ButtonRelease: - evas_event_feed_mouse_move(evas, ev.xbutton.x, ev.xbutton.y, 0, NULL); - evas_event_feed_mouse_up(evas, ev.xbutton.button, EVAS_BUTTON_NONE, 0, NULL); - break; - case MotionNotify: - evas_event_feed_mouse_move(evas, ev.xmotion.x, ev.xmotion.y, 0, NULL); - break; - case Expose: - first_expose = 1; - evas_damage_rectangle_add(evas, - ev.xexpose.x, - ev.xexpose.y, - ev.xexpose.width, - ev.xexpose.height); - break; - case ConfigureNotify: - evas_output_viewport_set(evas, 0, 0, - ev.xconfigure.width, - ev.xconfigure.height); - evas_output_size_set(evas, - ev.xconfigure.width, - ev.xconfigure.height); - win_w = ev.xconfigure.width; - win_h = ev.xconfigure.height; - break; - case EnterNotify: - evas_event_feed_mouse_in(evas, 0, NULL); - break; - case LeaveNotify: - evas_event_feed_mouse_out(evas, 0, NULL); - break; - case KeyPress: - ks = XkbKeycodeToKeysym(ev.xkey.display, ev.xkey.keycode, 0, 0); - kstr = XKeysymToString(ks); - if (kstr) - { - if ((!strcmp(kstr, "Shift_L")) || - (!strcmp(kstr, "Shift_R"))) - evas_key_modifier_on(evas, "Shift"); - if ((!strcmp(kstr, "Control_L")) || - (!strcmp(kstr, "Control_R"))) - evas_key_modifier_on(evas, "Control"); - if ((!strcmp(kstr, "Alt_L")) || - (!strcmp(kstr, "Alt_R"))) - evas_key_modifier_on(evas, "Alt"); - if ((!strcmp(kstr, "Super_L")) || - (!strcmp(kstr, "Super_R"))) - evas_key_modifier_on(evas, "Super"); - if (!strcmp(kstr, "Caps_Lock")) - { - if (evas_key_lock_is_set(evas_key_lock_get(evas), "Caps_Lock")) - evas_key_lock_off(evas, "Caps_Lock"); - else - evas_key_lock_on(evas, "Caps_Lock"); - } - if (!strcmp(kstr, "Num_Lock")) - { - if (evas_key_lock_is_set(evas_key_lock_get(evas), "Num_Lock")) - evas_key_lock_off(evas, "Num_Lock"); - else - evas_key_lock_on(evas, "Num_Lock"); - } - if (!strcmp(kstr, "Scroll_Lock")) - { - if (evas_key_lock_is_set(evas_key_lock_get(evas), "Scroll_Lock")) - evas_key_lock_off(evas, "Scroll_Lock"); - else - evas_key_lock_on(evas, "Scroll_Lock"); - } - if (kstr) evas_event_feed_key_down(evas, kstr, kstr, NULL, NULL, 0, NULL); - } - break; - case KeyRelease: - ks = XkbKeycodeToKeysym(ev.xkey.display, ev.xkey.keycode, 0, 0); - kstr = XKeysymToString(ks); - if (kstr) - { - if ((!strcmp(kstr, "Shift_L")) || - (!strcmp(kstr, "Shift_R"))) - evas_key_modifier_off(evas, "Shift"); - if ((!strcmp(kstr, "Control_L")) || - (!strcmp(kstr, "Control_R"))) - evas_key_modifier_off(evas, "Control"); - if ((!strcmp(kstr, "Alt_L")) || - (!strcmp(kstr, "Alt_R"))) - evas_key_modifier_off(evas, "Alt"); - if ((!strcmp(kstr, "Super_L")) || - (!strcmp(kstr, "Super_R"))) - evas_key_modifier_off(evas, "Super"); - evas_event_feed_key_up(evas, kstr, kstr, NULL, NULL, 0, NULL); - } - break; - default: - break; - } - goto again; -} - -void -engine_software_xlib_shutdown(void) -{ - XDestroyWindow(disp, win); - XCloseDisplay(disp); -} diff --git a/src/bin/engine_software_xlib.h b/src/bin/engine_software_xlib.h deleted file mode 100644 index f441d4c..0000000 --- a/src/bin/engine_software_xlib.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef ENGINE_SOFTWARE_XLIB_H -#define ENGINE_SOFTWARE_XLIB_H - -Eina_Bool engine_software_xlib_args(const char *engine, int width, int height); -void engine_software_xlib_loop(void); -void engine_software_xlib_shutdown(void); - -#endif diff --git a/src/bin/engine_wayland_common.c b/src/bin/engine_wayland_common.c deleted file mode 100644 index ca53163..0000000 --- a/src/bin/engine_wayland_common.c +++ /dev/null @@ -1,152 +0,0 @@ -#include - -#include "main.h" -#include "engine_wayland_common.h" - - -/* Seat (input) handler */ -static void _seat_handle_capabilities(void *data, struct wl_seat *seat, enum wl_seat_capability caps); -static const struct wl_seat_listener engine_wayland_seat_listener = -{ - _seat_handle_capabilities, - NULL // _seat_handle_name -}; - -/* Keyboard handler */ -static void _keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, uint32_t format, int fd, uint32_t size); -static void _keyboard_handle_enter(void *data, struct wl_keyboard *keyboard, uint32_t serial, struct wl_surface *surface, struct wl_array *keys); -static void _keyboard_handle_leave(void *data, struct wl_keyboard *keyboard, uint32_t serial, struct wl_surface *surface); -static void _keyboard_handle_key(void *data, struct wl_keyboard *keyboard, uint32_t serial, uint32_t time, uint32_t key, uint32_t state); -static void _keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard, uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group); -static const struct wl_keyboard_listener engine_wayland_keyboard_listener = -{ - _keyboard_handle_keymap, - _keyboard_handle_enter, - _keyboard_handle_leave, - _keyboard_handle_key, - _keyboard_handle_modifiers, -}; - -/* Shell Surface handler */ -static void _shell_surface_handle_ping(void *data, struct wl_shell_surface *shell_surface, uint32_t serial); -static const struct wl_shell_surface_listener _shell_surface_listener = -{ - _shell_surface_handle_ping, - NULL, /* configure */ - NULL, /* popup_done */ -}; - -/* - * Public - */ -void -engine_wayland_register_seat(struct wl_registry *registry, unsigned int id) -{ - struct wl_seat *seat = wl_registry_bind(registry, id, &wl_seat_interface, 1); - wl_seat_add_listener(seat, &engine_wayland_seat_listener, NULL); -} - -struct wl_shell_surface * -engine_wayland_create_shell_surface(struct wl_shell *shell, struct wl_surface *surface, const char *title) -{ - struct wl_shell_surface *shell_surface = wl_shell_get_shell_surface(shell, surface); - wl_shell_surface_set_title(shell_surface, title); - wl_shell_surface_add_listener(shell_surface, &_shell_surface_listener, NULL); - wl_shell_surface_set_toplevel(shell_surface); - - return shell_surface; -} - -/* - * Static - */ -static void -_seat_handle_capabilities(void *data __UNUSED__, struct wl_seat *seat, enum wl_seat_capability caps) -{ - static struct wl_keyboard *kbd = NULL; - - if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !kbd) - { - kbd = wl_seat_get_keyboard(seat); - wl_keyboard_add_listener(kbd, &engine_wayland_keyboard_listener, NULL); - } - else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && kbd) - { - wl_keyboard_destroy(kbd); - kbd = NULL; - } -} - -static void -_keyboard_handle_keymap(void *data __UNUSED__, struct wl_keyboard *keyboard __UNUSED__, uint32_t format __UNUSED__, int fd __UNUSED__, uint32_t size __UNUSED__) -{ -} - -static void -_keyboard_handle_enter(void *data __UNUSED__, struct wl_keyboard *keyboard __UNUSED__, uint32_t serial __UNUSED__, struct wl_surface *surface __UNUSED__, struct wl_array *keys __UNUSED__) -{ -} - -static void -_keyboard_handle_leave(void *data __UNUSED__, struct wl_keyboard *keyboard __UNUSED__, uint32_t serial __UNUSED__, struct wl_surface *surface __UNUSED__) -{ -} - -static void -_keyboard_handle_key(void *data __UNUSED__, struct wl_keyboard *keyboard __UNUSED__, uint32_t serial __UNUSED__, uint32_t time __UNUSED__, uint32_t key, uint32_t state) -{ - const char *key_str; - - switch (key) - { - case KEY_LEFT: - key_str = "Left"; - break; - - case KEY_RIGHT: - key_str = "Right"; - break; - - case KEY_ENTER: - case KEY_KPENTER: - key_str = "Return"; - break; - - case KEY_ESC: - key_str = "Escape"; - break; - - default: - key_str = NULL; - break; - } - - if (key_str) - { - switch (state) - { - case WL_KEYBOARD_KEY_STATE_RELEASED: - evas_event_feed_key_up(evas, key_str, key_str, NULL, NULL, 0, NULL); - break; - - case WL_KEYBOARD_KEY_STATE_PRESSED: - evas_event_feed_key_down(evas, key_str, key_str, NULL, NULL, 0, NULL); - break; - - default: - break; - } - } -} - -static void -_keyboard_handle_modifiers(void *data __UNUSED__, struct wl_keyboard *keyboard __UNUSED__, uint32_t serial __UNUSED__, uint32_t mods_depressed __UNUSED__, uint32_t mods_latched __UNUSED__, uint32_t mods_locked __UNUSED__, uint32_t group __UNUSED__) -{ -} - -static void -_shell_surface_handle_ping(void *data __UNUSED__, struct wl_shell_surface *shell_surface, uint32_t serial) -{ - wl_shell_surface_pong(shell_surface, serial); -} - diff --git a/src/bin/engine_wayland_common.h b/src/bin/engine_wayland_common.h deleted file mode 100644 index 408b65d..0000000 --- a/src/bin/engine_wayland_common.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef ENGINE_WAYLAND_COMMON_H -#define ENGINE_WAYLAND_COMMON_H - -#include - -void engine_wayland_register_seat(struct wl_registry *registry, unsigned int id); -struct wl_shell_surface *engine_wayland_create_shell_surface(struct wl_shell *shell, struct wl_surface *surface, const char *title); - -#endif - diff --git a/src/bin/engine_wayland_egl.c b/src/bin/engine_wayland_egl.c deleted file mode 100644 index 3bb1972..0000000 --- a/src/bin/engine_wayland_egl.c +++ /dev/null @@ -1,112 +0,0 @@ -#include -#include - -#include "main.h" -#include "engine_wayland_common.h" - -#include -#include -#include - -/* - * Global struct - */ -struct _engine_wayland_egl_display -{ - struct wl_display *display; - struct wl_registry *registry; - struct wl_compositor *compositor; - struct wl_surface *surface; - struct wl_shell *shell; - struct wl_shell_surface *shell_surface; -}; - -static struct _engine_wayland_egl_display wl; - -/* - * Function Prototypes - */ -/* Registry handler */ -static void _registry_handle_global(void *data, struct wl_registry *registry, unsigned int id, const char *interface, unsigned int version __UNUSED__); -static const struct wl_registry_listener _registry_listener = -{ - _registry_handle_global, - NULL, /* global_remove */ -}; - -/* - * API - */ -Eina_Bool -engine_wayland_egl_args(const char *engine __UNUSED__, int width __UNUSED__, int height __UNUSED__) -{ - Evas_Engine_Info_Wayland_Egl *einfo; - - evas_output_method_set(evas, evas_render_method_lookup("wayland_egl")); - einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(evas); - if (!einfo) - { - printf("Evas does not support the Wayland EGL Engine\n"); - return EINA_FALSE; - } - - wl.display = wl_display_connect(NULL); - if (!wl.display) - { - printf("Expedite cannot connect to wayland display\n"); - return EINA_FALSE; - } - - wl.registry = wl_display_get_registry(wl.display); - wl_registry_add_listener(wl.registry, &_registry_listener, NULL); - wl_display_roundtrip(wl.display); - - assert(wl.compositor != NULL); - assert(wl.shell != NULL); - - wl.surface = wl_compositor_create_surface(wl.compositor); - wl.shell_surface = engine_wayland_create_shell_surface(wl.shell, wl.surface, "Expedite Wayland EGL"); - - einfo->info.display = wl.display; - einfo->info.surface = wl.surface; - if (!evas_engine_info_set(evas, (Evas_Engine_Info *) einfo)) - { - printf("Evas can not setup the informations of the Wayland EGL Engine\n"); - return EINA_FALSE; - } - - return EINA_TRUE; -} - -void -engine_wayland_egl_loop(void) -{ - assert(wl_display_dispatch_pending(wl.display) != -1); - wl_display_flush(wl.display); -} - -void -engine_wayland_egl_shutdown(void) -{ - wl_shell_surface_destroy(wl.shell_surface); - wl_surface_destroy(wl.surface); - wl_shell_destroy(wl.shell); - wl_compositor_destroy(wl.compositor); - wl_registry_destroy(wl.registry); - wl_display_flush(wl.display); - wl_display_disconnect(wl.display); -} - -/* - * Function implementation - */ -static void -_registry_handle_global(void *data __UNUSED__, struct wl_registry *registry, unsigned int id, const char *interface, unsigned int version __UNUSED__) -{ - if (!strcmp(interface, "wl_compositor")) - wl.compositor = wl_registry_bind(registry, id, &wl_compositor_interface, 1); - else if (!strcmp(interface, "wl_shell")) - wl.shell = wl_registry_bind(registry, id, &wl_shell_interface, 1); - else if (!strcmp(interface, "wl_seat")) - engine_wayland_register_seat(registry, id); -} diff --git a/src/bin/engine_wayland_egl.h b/src/bin/engine_wayland_egl.h deleted file mode 100644 index d8e6781..0000000 --- a/src/bin/engine_wayland_egl.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef ENGINE_WAYLAND_EGL_H -#define ENGINE_WAYLAND_EGL_H - -Eina_Bool engine_wayland_egl_args(const char *engine, int width, int height); -void engine_wayland_egl_loop(void); -void engine_wayland_egl_shutdown(void); - -#endif diff --git a/src/bin/engine_wayland_shm.c b/src/bin/engine_wayland_shm.c deleted file mode 100644 index 395ca9f..0000000 --- a/src/bin/engine_wayland_shm.c +++ /dev/null @@ -1,126 +0,0 @@ -#include -#include -#include -#include - -#include "main.h" -#include "engine_wayland_common.h" - -#include -#include - -/* - * Global struct - */ -struct _engine_wayland_shm_display -{ - struct wl_display *display; - struct wl_registry *registry; - struct wl_compositor *compositor; - struct wl_surface *surface; - struct wl_shell *shell; - struct wl_shell_surface *shell_surface; - struct wl_shm *shm; - int width; - int height; -}; - -static struct _engine_wayland_shm_display wl; - -/* - * Function Prototypes - */ -/* static void _engine_wayland_shm_create_buffer(int width, int height); */ - -/* Registry handler */ -static void _registry_handle_global(void *data, struct wl_registry *registry, unsigned int id, const char *interface, unsigned int version __UNUSED__); -static const struct wl_registry_listener _registry_listener = -{ - _registry_handle_global, - NULL, /* global_remove */ -}; - -/* - * API - */ -Eina_Bool -engine_wayland_shm_args(const char *engine __UNUSED__, int width, int height) -{ - Evas_Engine_Info_Wayland_Shm *einfo; - - evas_output_method_set(evas, evas_render_method_lookup("wayland_shm")); - einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(evas); - if (!einfo) - { - printf("Evas does not support the Wayland SHM Engine\n"); - return EINA_FALSE; - } - - wl.display = wl_display_connect(NULL); - if (!wl.display) - { - printf("Expedite cannot connect to wayland display\n"); - return EINA_FALSE; - } - - wl.registry = wl_display_get_registry(wl.display); - wl_registry_add_listener(wl.registry, &_registry_listener, NULL); - wl_display_roundtrip(wl.display); - - assert(wl.compositor != NULL); - assert(wl.shell != NULL); - assert(wl.shm != NULL); - - wl.surface = wl_compositor_create_surface(wl.compositor); - wl.shell_surface = engine_wayland_create_shell_surface(wl.shell, wl.surface, "Expedite Wayland SHM"); - - einfo->info.wl_shm = wl.shm; - einfo->info.wl_surface = wl.surface; - if (!evas_engine_info_set(evas, (Evas_Engine_Info *) einfo)) - { - printf("Evas can not setup the informations of the Wayland SHM Engine\n"); - return EINA_FALSE; - } - - wl.width = width; - wl.height = height; - - return EINA_TRUE; -} - -void -engine_wayland_shm_loop(void) -{ - assert(wl_display_dispatch_pending(wl.display) != -1); - wl_display_flush(wl.display); -} - - -void -engine_wayland_shm_shutdown(void) -{ - wl_shell_surface_destroy(wl.shell_surface); - wl_surface_destroy(wl.surface); - wl_shm_destroy(wl.shm); - wl_shell_destroy(wl.shell); - wl_compositor_destroy(wl.compositor); - wl_registry_destroy(wl.registry); - wl_display_flush(wl.display); - wl_display_disconnect(wl.display); -} - -/* - * Function implementation - */ -static void -_registry_handle_global(void *data __UNUSED__, struct wl_registry *registry, unsigned int id, const char *interface, unsigned int version __UNUSED__) -{ - if (!strcmp(interface, "wl_compositor")) - wl.compositor = wl_registry_bind(registry, id, &wl_compositor_interface, 1); - else if (!strcmp(interface, "wl_shell")) - wl.shell = wl_registry_bind(registry, id, &wl_shell_interface, 1); - else if (!strcmp(interface, "wl_seat")) - engine_wayland_register_seat(registry, id); - else if (!strcmp(interface, "wl_shm")) - wl.shm = wl_registry_bind(registry, id, &wl_shm_interface, 1); -} diff --git a/src/bin/engine_wayland_shm.h b/src/bin/engine_wayland_shm.h deleted file mode 100644 index 5e16451..0000000 --- a/src/bin/engine_wayland_shm.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef ENGINE_WAYLAND_SHM_H -#define ENGINE_WAYLAND_SHM_H - -Eina_Bool engine_wayland_shm_args(const char *engine, int width, int height); -void engine_wayland_shm_loop(void); -void engine_wayland_shm_shutdown(void); - -#endif diff --git a/src/bin/engine_xrender_x11.c b/src/bin/engine_xrender_x11.c deleted file mode 100644 index 7e3023a..0000000 --- a/src/bin/engine_xrender_x11.c +++ /dev/null @@ -1,221 +0,0 @@ -#include "main.h" - -#include -#include -#include -#include - -static Display *disp = NULL; -static Window win = 0; -static int first_expose = 0; - -Eina_Bool -engine_xrender_x11_args(const char *engine, int width, int height) -{ - XSetWindowAttributes attr; - XClassHint chint; - XSizeHints szhints; - Evas_Engine_Info_XRender_X11 *einfo; - int i; - - disp = XOpenDisplay(NULL); - if (!disp) return EINA_FALSE; - - evas_output_method_set(evas, evas_render_method_lookup("xrender_x11")); - einfo = (Evas_Engine_Info_XRender_X11 *)evas_engine_info_get(evas); - if (!einfo) - { - printf("Evas does not support the XRender X11 Engine\n"); - goto close_display; - } - - einfo->info.backend = EVAS_ENGINE_INFO_XRENDER_BACKEND_XLIB; - einfo->info.connection = disp; - einfo->info.screen = NULL; - einfo->info.visual = DefaultVisual(disp, DefaultScreen(disp)); - attr.backing_store = NotUseful; - attr.border_pixel = 0; - attr.background_pixmap = None; - attr.event_mask = - ExposureMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask | - StructureNotifyMask | EnterWindowMask | LeaveWindowMask | - KeyPressMask | KeyReleaseMask; - attr.bit_gravity = ForgetGravity; - win = XCreateWindow(disp, DefaultRootWindow(disp), - 0, 0, width, height, 0, - 0, InputOutput, - einfo->info.visual, - CWBackingStore | - CWBackPixmap | CWBorderPixel | - CWBitGravity | CWEventMask, - &attr); - if (!win) - goto close_display; - einfo->info.drawable = win; - - if (!evas_engine_info_set(evas, (Evas_Engine_Info *) einfo)) - { - printf("Evas can not setup the informations of the XRender X11 Engine\n"); - goto destroy_window; - } - - if (fullscreen) - { - Atom prop = XInternAtom(disp, "_NET_WM_STATE", False); - Atom state = XInternAtom(disp, "_NET_WM_STATE_FULLSCREEN", False); - unsigned long data = state; - XChangeProperty(disp, win, prop, XA_ATOM, 32, PropModeReplace, - (unsigned char*) &data, 1); - } - - XStoreName(disp, win, "Expedite - Evas Test Suite"); - chint.res_name = "expedite"; - chint.res_class = "Expedite"; - XSetClassHint(disp, win, &chint); - szhints.flags = PMinSize | PMaxSize | PSize | USSize; - szhints.min_width = szhints.max_width = width; - szhints.min_height = szhints.max_height = height; - XSetWMNormalHints(disp, win, &szhints); - XMapWindow(disp, win); - XSync(disp, False); - while (!first_expose) - engine_xrender_x11_loop(); - return EINA_TRUE; - - destroy_window: - XDestroyWindow(disp, win); - close_display: - XCloseDisplay(disp); - - return EINA_FALSE; -} - -void -engine_xrender_x11_loop(void) -{ - XEvent ev; - KeySym ks; - char *kstr; - - again: - if (!XCheckMaskEvent(disp, - ExposureMask | - StructureNotifyMask | - KeyPressMask | - KeyReleaseMask | - ButtonPressMask | - ButtonReleaseMask | - PointerMotionMask | - EnterWindowMask | - LeaveWindowMask, &ev)) - return; - switch (ev.type) - { - case ButtonPress: - evas_event_feed_mouse_move(evas, ev.xbutton.x, ev.xbutton.y, 0, NULL); - evas_event_feed_mouse_down(evas, ev.xbutton.button, EVAS_BUTTON_NONE, 0, NULL); - break; - case ButtonRelease: - evas_event_feed_mouse_move(evas, ev.xbutton.x, ev.xbutton.y, 0, NULL); - evas_event_feed_mouse_up(evas, ev.xbutton.button, EVAS_BUTTON_NONE, 0, NULL); - break; - case MotionNotify: - evas_event_feed_mouse_move(evas, ev.xmotion.x, ev.xmotion.y, 0, NULL); - break; - case Expose: - first_expose = 1; - evas_damage_rectangle_add(evas, - ev.xexpose.x, - ev.xexpose.y, - ev.xexpose.width, - ev.xexpose.height); - break; - case ConfigureNotify: - evas_output_viewport_set(evas, 0, 0, - ev.xconfigure.width, - ev.xconfigure.height); - evas_output_size_set(evas, - ev.xconfigure.width, - ev.xconfigure.height); - win_w = ev.xconfigure.width; - win_h = ev.xconfigure.height; - break; - case EnterNotify: - evas_event_feed_mouse_in(evas, 0, NULL); - break; - case LeaveNotify: - evas_event_feed_mouse_out(evas, 0, NULL); - break; - case KeyPress: - ks = XKeycodeToKeysym(ev.xkey.display, ev.xkey.keycode, 0); - kstr = XKeysymToString(ks); - if (kstr) - { - if ((!strcmp(kstr, "Shift_L")) || - (!strcmp(kstr, "Shift_R"))) - evas_key_modifier_on(evas, "Shift"); - if ((!strcmp(kstr, "Control_L")) || - (!strcmp(kstr, "Control_R"))) - evas_key_modifier_on(evas, "Control"); - if ((!strcmp(kstr, "Alt_L")) || - (!strcmp(kstr, "Alt_R"))) - evas_key_modifier_on(evas, "Alt"); - if ((!strcmp(kstr, "Super_L")) || - (!strcmp(kstr, "Super_R"))) - evas_key_modifier_on(evas, "Super"); - if (!strcmp(kstr, "Caps_Lock")) - { - if (evas_key_lock_is_set(evas_key_lock_get(evas), "Caps_Lock")) - evas_key_lock_off(evas, "Caps_Lock"); - else - evas_key_lock_on(evas, "Caps_Lock"); - } - if (!strcmp(kstr, "Num_Lock")) - { - if (evas_key_lock_is_set(evas_key_lock_get(evas), "Num_Lock")) - evas_key_lock_off(evas, "Num_Lock"); - else - evas_key_lock_on(evas, "Num_Lock"); - } - if (!strcmp(kstr, "Scroll_Lock")) - { - if (evas_key_lock_is_set(evas_key_lock_get(evas), "Scroll_Lock")) - evas_key_lock_off(evas, "Scroll_Lock"); - else - evas_key_lock_on(evas, "Scroll_Lock"); - } - if (kstr) evas_event_feed_key_down(evas, kstr, kstr, NULL, NULL, 0, NULL); - } - break; - case KeyRelease: - ks = XKeycodeToKeysym(ev.xkey.display, ev.xkey.keycode, 0); - kstr = XKeysymToString(ks); - if (kstr) - { - if ((!strcmp(kstr, "Shift_L")) || - (!strcmp(kstr, "Shift_R"))) - evas_key_modifier_off(evas, "Shift"); - if ((!strcmp(kstr, "Control_L")) || - (!strcmp(kstr, "Control_R"))) - evas_key_modifier_off(evas, "Control"); - if ((!strcmp(kstr, "Alt_L")) || - (!strcmp(kstr, "Alt_R"))) - evas_key_modifier_off(evas, "Alt"); - if ((!strcmp(kstr, "Super_L")) || - (!strcmp(kstr, "Super_R"))) - evas_key_modifier_off(evas, "Super"); - evas_event_feed_key_up(evas, kstr, kstr, NULL, NULL, 0, NULL); - } - break; - default: - break; - } - goto again; -} - -void -engine_xrender_x11_shutdown(void) -{ - XDestroyWindow(disp, win); - XCloseDisplay(disp); -} diff --git a/src/bin/engine_xrender_x11.h b/src/bin/engine_xrender_x11.h deleted file mode 100644 index 3643531..0000000 --- a/src/bin/engine_xrender_x11.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef ENGINE_XRENDER_X11_H -#define ENGINE_XRENDER_X11_H - -Eina_Bool engine_xrender_x11_args(const char *engine, int width, int height); -void engine_xrender_x11_loop(void); -void engine_xrender_x11_shutdown(void); - -#endif diff --git a/src/bin/engine_xrender_xcb.c b/src/bin/engine_xrender_xcb.c deleted file mode 100644 index 4ea668f..0000000 --- a/src/bin/engine_xrender_xcb.c +++ /dev/null @@ -1,405 +0,0 @@ -#include "main.h" - -#include -#include -#include - -#define XK_MISCELLANY -#include - -enum { - XCB_SIZE_US_POSITION_HINT = 1 << 0, - XCB_SIZE_US_SIZE_HINT = 1 << 1, - XCB_SIZE_P_POSITION_HINT = 1 << 2, - XCB_SIZE_P_SIZE_HINT = 1 << 3, - XCB_SIZE_P_MIN_SIZE_HINT = 1 << 4, - XCB_SIZE_P_MAX_SIZE_HINT = 1 << 5, - XCB_SIZE_P_RESIZE_INC_HINT = 1 << 6, - XCB_SIZE_P_ASPECT_HINT = 1 << 7, - XCB_SIZE_BASE_SIZE_HINT = 1 << 8, - XCB_SIZE_P_WIN_GRAVITY_HINT = 1 << 9 -}; - -struct xcb_size_hints_t { - uint32_t flags; - int32_t x, y, width, height; - int32_t min_width, min_height; - int32_t max_width, max_height; - int32_t width_inc, height_inc; - int32_t min_aspect_num, min_aspect_den; - int32_t max_aspect_num, max_aspect_den; - int32_t base_width, base_height; - uint32_t win_gravity; -}; - - -static xcb_connection_t *conn = NULL; -static xcb_screen_t *screen = NULL; -static xcb_window_t win = 0; -static int first_expose = 0; - -static xcb_visualtype_t * -_engine_xrender_visual_get(xcb_connection_t *conn, xcb_screen_t *screen) -{ - xcb_depth_iterator_t iter_depth; - - iter_depth = xcb_screen_allowed_depths_iterator(screen); - for (; iter_depth.rem; xcb_depth_next (&iter_depth)) - { - xcb_visualtype_iterator_t iter_vis; - - iter_vis = xcb_depth_visuals_iterator(iter_depth.data); - for (; iter_vis.rem; xcb_visualtype_next (&iter_vis)) - { - if (screen->root_visual == iter_vis.data->visual_id) - return iter_vis.data; - } - } -} - -Eina_Bool -engine_xrender_xcb_args(const char *engine, int width, int height) -{ - struct xcb_size_hints_t hints; - uint32_t value_list[6]; - xcb_screen_iterator_t iter; - Evas_Engine_Info_XRender_X11 *einfo; - xcb_intern_atom_reply_t *reply; - char *str; - xcb_intern_atom_cookie_t cookie1; - xcb_intern_atom_cookie_t cookie2; - xcb_intern_atom_cookie_t cookie3; - xcb_intern_atom_cookie_t cookie4; - xcb_intern_atom_cookie_t cookie5; - xcb_atom_t string; - xcb_atom_t wm_name; - xcb_atom_t wm_class; - xcb_atom_t wm_normal_hint; - xcb_atom_t wm_size_hint; - uint32_t value_mask; - int s; - int s_tmp; - int l1; - int l2; - int i; - - conn = xcb_connect(NULL, &s); - if (xcb_connection_has_error(conn)) return EINA_FALSE; - - s_tmp = s; - iter = xcb_setup_roots_iterator(xcb_get_setup(conn)); - for (; iter.rem; --s_tmp, xcb_screen_next (&iter)) - if (s_tmp == 0) - { - screen = iter.data; - break; - } - - evas_output_method_set(evas, evas_render_method_lookup("xrender_x11")); - einfo = (Evas_Engine_Info_XRender_X11 *)evas_engine_info_get(evas); - if (!einfo) - { - printf("Evas does not support the XRender XCB Engine\n"); - goto close_connection; - } - - einfo->info.backend = EVAS_ENGINE_INFO_XRENDER_BACKEND_XCB; - einfo->info.connection = conn; - einfo->info.screen = screen; - einfo->info.visual = _engine_xrender_visual_get(conn, screen); - - value_mask = - XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL | XCB_CW_BIT_GRAVITY | - XCB_CW_BACKING_STORE | XCB_CW_EVENT_MASK | XCB_CW_COLORMAP; - - value_list[0] = XCB_NONE; - value_list[1] = 0; - value_list[2] = XCB_GRAVITY_BIT_FORGET; - value_list[3] = XCB_BACKING_STORE_NOT_USEFUL; - value_list[4] = - XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE | - XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | - XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW | - XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_EXPOSURE | - XCB_EVENT_MASK_STRUCTURE_NOTIFY; - value_list[5] =screen->default_colormap; - - win = xcb_generate_id(conn); - if (!win) - goto close_connection; - xcb_create_window(conn, - screen->root_depth, - win, screen->root, 0, 0, width, height, 0, - XCB_WINDOW_CLASS_INPUT_OUTPUT, - ((xcb_visualtype_t *)einfo->info.visual)->visual_id, - value_mask, - value_list); - einfo->info.drawable = win; - - if (!evas_engine_info_set(evas, (Evas_Engine_Info *) einfo)) - { - printf("Evas can not setup the informations of the XRender XCB Engine\n"); - goto destroy_window; - } - -/* XStoreName(disp, win, "Expedite - Evas Test Suite"); */ - - cookie1 = xcb_intern_atom_unchecked(conn, 0, strlen("STRING"), "STRING"); - cookie2 = xcb_intern_atom_unchecked(conn, 0, strlen("WM_NAME"), "WM_NAME"); - cookie3 = xcb_intern_atom_unchecked(conn, 0, strlen("WM_CLASS"), "WM_CLASS"); - cookie4 = xcb_intern_atom_unchecked(conn, 0, strlen("WM_NORMAL_HINTS)"), "WM_NORMAL_HINTS)"); - cookie5 = xcb_intern_atom_unchecked(conn, 0, strlen("WM_SIZE_HINTS)"), "WM_SIZE_HINTS)"); - - reply = xcb_intern_atom_reply(conn, cookie1, NULL); - string = reply->atom; - free(reply); - reply = xcb_intern_atom_reply(conn, cookie2, NULL); - wm_name = reply->atom; - free(reply); - - xcb_change_property(conn, XCB_PROP_MODE_REPLACE, win, - wm_name, string, 8, - strlen("Expedite - Evas Test Suite"), "Expedite - Evas Test Suite"); - -/* chint.res_name = "expedite"; */ -/* chint.res_class = "Expedite"; */ -/* XSetClassHint(disp, win, &chint); */ - - l1 = strlen("expedite"); - l2 = strlen("Expedite"); - str = (char *)malloc(l1 + l2 + 1); - memcpy(str, "expedite", l1); - str[l1] = '\0'; - memcpy(str + l1 + 1, "Expedite", l2); - - reply = xcb_intern_atom_reply(conn, cookie3, NULL); - wm_class = reply->atom; - free(reply); - - xcb_change_property(conn, XCB_PROP_MODE_REPLACE, win, - wm_class, string, 8, - l1 + l2 + 1, str); - free(str); - -/* szhints.flags = PMinSize | PMaxSize | PSize | USSize; */ -/* szhints.min_width = szhints.max_width = width; */ -/* szhints.min_height = szhints.max_height = height; */ -/* XSetWMNormalHints(disp, win, &szhints); */ - - memset(&hints, 0, sizeof(hints)); - hints.flags = XCB_SIZE_US_SIZE_HINT | XCB_SIZE_P_SIZE_HINT | XCB_SIZE_P_MIN_SIZE_HINT | XCB_SIZE_P_MAX_SIZE_HINT; - hints.min_width = width; - hints.max_width = width; - hints.min_height = height; - hints.max_height = height; - - reply = xcb_intern_atom_reply(conn, cookie4, NULL); - wm_normal_hint = reply->atom; - free(reply); - - reply = xcb_intern_atom_reply(conn, cookie5, NULL); - wm_size_hint = reply->atom; - free(reply); - - xcb_change_property(conn, XCB_PROP_MODE_REPLACE, win, - wm_normal_hint, wm_size_hint, 32, - sizeof(hints) / 4, &hints); - - free(xcb_get_input_focus_reply(conn, xcb_get_input_focus_unchecked(conn), NULL)); - - xcb_map_window(conn, win); - - while (!first_expose) - engine_xrender_xcb_loop(); - return EINA_TRUE; - - destroy_window: - xcb_destroy_window(conn, win); - close_connection: - xcb_disconnect(conn); - - return EINA_FALSE; -} - -void -engine_xrender_xcb_loop(void) -{ - xcb_generic_event_t *ev; - - again: - ev = xcb_poll_for_event(conn); - if (!ev) - return; - - switch (ev->response_type) - { - case XCB_BUTTON_PRESS: - { - xcb_button_press_event_t *e; - - e = (xcb_button_press_event_t *)ev; - - evas_event_feed_mouse_move(evas, e->event_x, e->event_y, 0, NULL); - evas_event_feed_mouse_down(evas, e->detail, EVAS_BUTTON_NONE, 0, NULL); - break; - } - case XCB_BUTTON_RELEASE: - { - xcb_button_release_event_t *e; - - e = (xcb_button_release_event_t *)ev; - - evas_event_feed_mouse_move(evas, e->event_x, e->event_y, 0, NULL); - evas_event_feed_mouse_up(evas, e->detail, EVAS_BUTTON_NONE, 0, NULL); - break; - } - case XCB_MOTION_NOTIFY: - { - xcb_motion_notify_event_t *e; - - e = (xcb_motion_notify_event_t *)ev; - - evas_event_feed_mouse_move(evas, e->event_x, e->event_y, 0, NULL); - break; - } - case XCB_EXPOSE: - { - xcb_expose_event_t *e; - - e = (xcb_expose_event_t *)ev; - - first_expose = 1; - evas_damage_rectangle_add(evas, - e->x, - e->y, - e->width, - e->height); - break; - } - case XCB_CONFIGURE_NOTIFY: - { - xcb_configure_notify_event_t *e; - - e = (xcb_configure_notify_event_t *)ev; - - evas_output_viewport_set(evas, 0, 0, - e->width, - e->height); - evas_output_size_set(evas, - e->width, - e->height); - win_w = e->width; - win_h = e->height; - break; - } - case XCB_ENTER_NOTIFY: - evas_event_feed_mouse_in(evas, 0, NULL); - break; - case XCB_LEAVE_NOTIFY: - evas_event_feed_mouse_out(evas, 0, NULL); - break; - case XCB_KEY_PRESS: - { - xcb_key_press_event_t *e; - xcb_key_symbols_t *kss; - xcb_keysym_t ks; - char *str = ""; - - e = (xcb_key_press_event_t *)ev; - - kss = xcb_key_symbols_alloc(conn); - - ks = xcb_key_symbols_get_keysym(kss, e->detail, 0); - - if ((ks == XK_Shift_L) || (ks == XK_Shift_R)) - evas_key_modifier_on(evas, "Shift"); - else if ((ks == XK_Control_L) || (ks == XK_Control_R)) - evas_key_modifier_on(evas, "Control"); - else if ((ks == XK_Alt_L) || (ks == XK_Alt_R)) - evas_key_modifier_on(evas, "Alt"); - else if ((ks == XK_Super_L) || (ks == XK_Super_R)) - evas_key_modifier_on(evas, "Super"); - else if (ks == XK_Caps_Lock) - { - if (evas_key_lock_is_set(evas_key_lock_get(evas), "Caps_Lock")) - evas_key_lock_off(evas, "Caps_Lock"); - else - evas_key_lock_on(evas, "Caps_Lock"); - } - else if (ks == XK_Scroll_Lock) - { - if (evas_key_lock_is_set(evas_key_lock_get(evas), "Scroll_Lock")) - evas_key_lock_off(evas, "Scroll_Lock"); - else - evas_key_lock_on(evas, "Scroll_Lock"); - } - - if (ks == XK_Left) - str = "Left"; - if (ks == XK_Right) - str = "Right"; - if (ks == XK_Escape) - str = "Escape"; - if (ks == XK_Return) - str = "Return"; - if (ks == 113) - str = "q"; - - evas_event_feed_key_down(evas, str, str, NULL, NULL, 0, NULL); - - xcb_key_symbols_free(kss); - break; - } - case XCB_KEY_RELEASE: - { - xcb_key_release_event_t *e; - xcb_key_symbols_t *kss; - xcb_keysym_t ks; - char *str = ""; - - e = (xcb_key_release_event_t *)ev; - - kss = xcb_key_symbols_alloc(conn); - - ks = xcb_key_symbols_get_keysym(kss, e->detail, 0); - - if ((ks == XK_Shift_L) || (ks == XK_Shift_R)) - evas_key_modifier_on(evas, "Shift"); - else if ((ks == XK_Control_L) || (ks == XK_Control_R)) - evas_key_modifier_on(evas, "Control"); - else if ((ks == XK_Alt_L) || (ks == XK_Alt_R)) - evas_key_modifier_on(evas, "Alt"); - else if ((ks == XK_Super_L) || (ks == XK_Super_R)) - evas_key_modifier_on(evas, "Super"); - - if (ks == XK_Left) - str = "Left"; - if (ks == XK_Right) - str = "Right"; - if (ks == XK_Escape) - str = "Escape"; - if (ks == XK_Return) - str = "Return"; - if (ks == 113) - str = "q"; - - evas_event_feed_key_up(evas, str, str, NULL, NULL, 0, NULL); - - xcb_key_symbols_free(kss); - break; - } - default: - free(ev); - return; - } - free(ev); - - goto again; -} - -void -engine_xrender_xcb_shutdown(void) -{ - xcb_destroy_window(conn, win); - xcb_disconnect(conn); -} diff --git a/src/bin/engine_xrender_xcb.h b/src/bin/engine_xrender_xcb.h deleted file mode 100644 index 9d688a0..0000000 --- a/src/bin/engine_xrender_xcb.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef ENGINE_XRENDER_XCB_H -#define ENGINE_XRENDER_XCB_H - -Eina_Bool engine_xrender_xcb_args(const char *engine, int width, int height); -void engine_xrender_xcb_loop(void); -void engine_xrender_xcb_shutdown(void); - -#endif diff --git a/src/bin/image_data_argb.c b/src/bin/image_data_argb.c index 33b88c3..4383c9d 100644 --- a/src/bin/image_data_argb.c +++ b/src/bin/image_data_argb.c @@ -115,8 +115,8 @@ void FNAME(void); # ifndef UI void FNAME(void) { - ui_func_set(_key, _loop); _setup(); + ui_func_set(_key, _loop); } # endif #endif diff --git a/src/bin/image_data_argb_alpha.c b/src/bin/image_data_argb_alpha.c index 48757d4..d0604ca 100644 --- a/src/bin/image_data_argb_alpha.c +++ b/src/bin/image_data_argb_alpha.c @@ -126,8 +126,8 @@ void FNAME(void); # ifndef UI void FNAME(void) { - ui_func_set(_key, _loop); _setup(); + ui_func_set(_key, _loop); } # endif #endif diff --git a/src/bin/image_data_ycbcr601pl.c b/src/bin/image_data_ycbcr601pl.c index c36ce9d..de5232b 100644 --- a/src/bin/image_data_ycbcr601pl.c +++ b/src/bin/image_data_ycbcr601pl.c @@ -135,8 +135,8 @@ void FNAME(void); # ifndef UI void FNAME(void) { - ui_func_set(_key, _loop); _setup(); + ui_func_set(_key, _loop); } # endif #endif diff --git a/src/bin/image_data_ycbcr601pl_map_solid_rotate.c b/src/bin/image_data_ycbcr601pl_map_solid_rotate.c index 0ee2d25..7ecb470 100644 --- a/src/bin/image_data_ycbcr601pl_map_solid_rotate.c +++ b/src/bin/image_data_ycbcr601pl_map_solid_rotate.c @@ -140,8 +140,8 @@ void FNAME(void); # ifndef UI void FNAME(void) { - ui_func_set(_key, _loop); _setup(); + ui_func_set(_key, _loop); } # endif #endif diff --git a/src/bin/image_map_3d_1.c b/src/bin/image_map_3d_1.c index a2fedca..58207f0 100644 --- a/src/bin/image_map_3d_1.c +++ b/src/bin/image_map_3d_1.c @@ -254,8 +254,8 @@ void FNAME(void); # ifndef UI void FNAME(void) { - ui_func_set(_key, _loop); _setup(); + ui_func_set(_key, _loop); } # endif #endif diff --git a/src/bin/image_map_3d_2.c b/src/bin/image_map_3d_2.c index 4b8f201..75ccdb9 100644 --- a/src/bin/image_map_3d_2.c +++ b/src/bin/image_map_3d_2.c @@ -252,8 +252,8 @@ void FNAME(void); # ifndef UI void FNAME(void) { - ui_func_set(_key, _loop); _setup(); + ui_func_set(_key, _loop); } # endif #endif diff --git a/src/bin/image_map_3d_3.c b/src/bin/image_map_3d_3.c index 8bf3d1f..bc20ad8 100644 --- a/src/bin/image_map_3d_3.c +++ b/src/bin/image_map_3d_3.c @@ -247,8 +247,8 @@ void FNAME(void); # ifndef UI void FNAME(void) { - ui_func_set(_key, _loop); _setup(); + ui_func_set(_key, _loop); } # endif #endif diff --git a/src/bin/image_map_3d_4.c b/src/bin/image_map_3d_4.c index 4923fe7..ecce9c2 100644 --- a/src/bin/image_map_3d_4.c +++ b/src/bin/image_map_3d_4.c @@ -245,8 +245,8 @@ void FNAME(void); # ifndef UI void FNAME(void) { - ui_func_set(_key, _loop); _setup(); + ui_func_set(_key, _loop); } # endif #endif diff --git a/src/bin/image_map_3d_5.c b/src/bin/image_map_3d_5.c index 0adfa95..0107588 100644 --- a/src/bin/image_map_3d_5.c +++ b/src/bin/image_map_3d_5.c @@ -234,8 +234,8 @@ void FNAME(void); # ifndef UI void FNAME(void) { - ui_func_set(_key, _loop); _setup(); + ui_func_set(_key, _loop); } # endif #endif diff --git a/src/bin/image_map_3d_6.c b/src/bin/image_map_3d_6.c index 4888eba..e8b6968 100644 --- a/src/bin/image_map_3d_6.c +++ b/src/bin/image_map_3d_6.c @@ -231,8 +231,8 @@ void FNAME(void); # ifndef UI void FNAME(void) { - ui_func_set(_key, _loop); _setup(); + ui_func_set(_key, _loop); } # endif #endif diff --git a/src/bin/image_map_3d_flow.c b/src/bin/image_map_3d_flow.c index 468f971..ff7ac4b 100644 --- a/src/bin/image_map_3d_flow.c +++ b/src/bin/image_map_3d_flow.c @@ -225,8 +225,8 @@ void FNAME(void); # ifndef UI void FNAME(void) { - ui_func_set(_key, _loop); _setup(); + ui_func_set(_key, _loop); } # endif #endif diff --git a/src/bin/image_map_color_alpha_nearest_rotate.c b/src/bin/image_map_color_alpha_nearest_rotate.c index 1180793..94641fc 100644 --- a/src/bin/image_map_color_alpha_nearest_rotate.c +++ b/src/bin/image_map_color_alpha_nearest_rotate.c @@ -109,8 +109,8 @@ void FNAME(void); # ifndef UI void FNAME(void) { - ui_func_set(_key, _loop); _setup(); + ui_func_set(_key, _loop); } # endif #endif diff --git a/src/bin/image_map_color_alpha_nearest_solid_rotate.c b/src/bin/image_map_color_alpha_nearest_solid_rotate.c index 3a8f39c..7f2a0b0 100644 --- a/src/bin/image_map_color_alpha_nearest_solid_rotate.c +++ b/src/bin/image_map_color_alpha_nearest_solid_rotate.c @@ -109,8 +109,8 @@ void FNAME(void); # ifndef UI void FNAME(void) { - ui_func_set(_key, _loop); _setup(); + ui_func_set(_key, _loop); } # endif #endif diff --git a/src/bin/image_map_color_alpha_rotate.c b/src/bin/image_map_color_alpha_rotate.c index 87a81eb..585063d 100644 --- a/src/bin/image_map_color_alpha_rotate.c +++ b/src/bin/image_map_color_alpha_rotate.c @@ -107,8 +107,8 @@ void FNAME(void); # ifndef UI void FNAME(void) { - ui_func_set(_key, _loop); _setup(); + ui_func_set(_key, _loop); } # endif #endif diff --git a/src/bin/image_map_color_alpha_solid_rotate.c b/src/bin/image_map_color_alpha_solid_rotate.c index 38418db..b273b5e 100644 --- a/src/bin/image_map_color_alpha_solid_rotate.c +++ b/src/bin/image_map_color_alpha_solid_rotate.c @@ -106,8 +106,8 @@ void FNAME(void); # ifndef UI void FNAME(void) { - ui_func_set(_key, _loop); _setup(); + ui_func_set(_key, _loop); } # endif #endif diff --git a/src/bin/image_map_color_nearest_rotate.c b/src/bin/image_map_color_nearest_rotate.c index a15ff63..fe62719 100644 --- a/src/bin/image_map_color_nearest_rotate.c +++ b/src/bin/image_map_color_nearest_rotate.c @@ -109,8 +109,8 @@ void FNAME(void); # ifndef UI void FNAME(void) { - ui_func_set(_key, _loop); _setup(); + ui_func_set(_key, _loop); } # endif #endif diff --git a/src/bin/image_map_color_nearest_solid_rotate.c b/src/bin/image_map_color_nearest_solid_rotate.c index 5912f44..4811672 100644 --- a/src/bin/image_map_color_nearest_solid_rotate.c +++ b/src/bin/image_map_color_nearest_solid_rotate.c @@ -109,8 +109,8 @@ void FNAME(void); # ifndef UI void FNAME(void) { - ui_func_set(_key, _loop); _setup(); + ui_func_set(_key, _loop); } # endif #endif diff --git a/src/bin/image_map_color_rotate.c b/src/bin/image_map_color_rotate.c index 1a4d002..e5a872f 100644 --- a/src/bin/image_map_color_rotate.c +++ b/src/bin/image_map_color_rotate.c @@ -107,8 +107,8 @@ void FNAME(void); # ifndef UI void FNAME(void) { - ui_func_set(_key, _loop); _setup(); + ui_func_set(_key, _loop); } # endif #endif diff --git a/src/bin/image_map_color_solid_rotate.c b/src/bin/image_map_color_solid_rotate.c index 9d2f0a3..17ddd33 100644 --- a/src/bin/image_map_color_solid_rotate.c +++ b/src/bin/image_map_color_solid_rotate.c @@ -107,8 +107,8 @@ void FNAME(void); # ifndef UI void FNAME(void) { - ui_func_set(_key, _loop); _setup(); + ui_func_set(_key, _loop); } # endif #endif diff --git a/src/bin/image_map_nearest_rotate.c b/src/bin/image_map_nearest_rotate.c index 54a5ae7..bc0ec5a 100644 --- a/src/bin/image_map_nearest_rotate.c +++ b/src/bin/image_map_nearest_rotate.c @@ -104,8 +104,8 @@ void FNAME(void); # ifndef UI void FNAME(void) { - ui_func_set(_key, _loop); _setup(); + ui_func_set(_key, _loop); } # endif #endif diff --git a/src/bin/image_map_nearest_solid_rotate.c b/src/bin/image_map_nearest_solid_rotate.c index 11e5bd6..3cb1eb0 100644 --- a/src/bin/image_map_nearest_solid_rotate.c +++ b/src/bin/image_map_nearest_solid_rotate.c @@ -104,8 +104,8 @@ void FNAME(void); # ifndef UI void FNAME(void) { - ui_func_set(_key, _loop); _setup(); + ui_func_set(_key, _loop); } # endif #endif diff --git a/src/bin/image_map_rotate.c b/src/bin/image_map_rotate.c index c557c14..7deead8 100644 --- a/src/bin/image_map_rotate.c +++ b/src/bin/image_map_rotate.c @@ -102,8 +102,8 @@ void FNAME(void); # ifndef UI void FNAME(void) { - ui_func_set(_key, _loop); _setup(); + ui_func_set(_key, _loop); } # endif #endif diff --git a/src/bin/image_map_solid_rotate.c b/src/bin/image_map_solid_rotate.c index c23f3c7..4ac2552 100644 --- a/src/bin/image_map_solid_rotate.c +++ b/src/bin/image_map_solid_rotate.c @@ -102,8 +102,8 @@ void FNAME(void); # ifndef UI void FNAME(void) { - ui_func_set(_key, _loop); _setup(); + ui_func_set(_key, _loop); } # endif #endif diff --git a/src/bin/main.c b/src/bin/main.c index cbfc203..0f90ee7 100644 --- a/src/bin/main.c +++ b/src/bin/main.c @@ -1,16 +1,18 @@ #include "main.h" +#include +#include +#include + Evas *evas = NULL; const char *profile = "n800"; +const char *choosen_engine = NULL; int win_w = 720, win_h = 420; -const char *engine = NULL; int loops = LOOPS; -int fullscreen = 0; +Eina_Bool fullscreen = EINA_FALSE; +Eina_Bool cmp_report = EINA_FALSE; static char *datadir = NULL; -static int go = 1; -static void (*loop_func) (void) = NULL; -static void (*shutdown_func) (void) = NULL; /* this guarantees that "random" numbers will always be the same set regardless * of what os/system/etc we are on - as often i need just some "random" set of @@ -1081,7 +1083,6 @@ get_time(void) } #endif - const char * build_path(const char *filename) { @@ -1109,95 +1110,38 @@ build_path(const char *filename) return buffer; } -int -engine_abort(void) -{ - go = 0; - return go; -} - -void -engine_loop(void) -{ - loop_func(); -} - -void -engine_shutdown(void) -{ - shutdown_func(); -} - -static int -_engine_go(void) -{ - return go; -} -static const Expedite_Engine engines[] = { -#if HAVE_EVAS_SOFTWARE_XLIB - { "xlib", engine_software_xlib_args, engine_software_xlib_loop, engine_software_xlib_shutdown }, -#endif -#if HAVE_EVAS_XRENDER_X11 - { "xr", engine_xrender_x11_args, engine_xrender_x11_loop, engine_xrender_x11_shutdown }, -#endif -#if HAVE_EVAS_OPENGL_X11 - { "gl", engine_gl_x11_args, engine_gl_x11_loop, engine_gl_x11_shutdown }, -#endif -#if HAVE_EVAS_SOFTWARE_XCB - { "xcb", engine_software_xcb_args, engine_software_xcb_loop, engine_software_xcb_shutdown }, -#endif -#if HAVE_EVAS_XRENDER_XCB - { "xrxcb", engine_xrender_xcb_args, engine_xrender_xcb_loop, engine_xrender_xcb_shutdown }, -#endif -#if HAVE_EVAS_SOFTWARE_GDI - { "gdi", engine_software_gdi_args, engine_software_gdi_loop, engine_software_gdi_shutdown }, -#endif -#if HAVE_EVAS_SOFTWARE_DDRAW - { "ddraw", engine_software_ddraw_args, engine_software_ddraw_loop, engine_software_ddraw_shutdown }, -#endif -#if HAVE_EVAS_DIRECT3D - { "direct3d",engine_direct3d_args, engine_direct3d_loop, engine_direct3d_shutdown }, -#endif -#if BUILD_SDL - { "sdl", engine_software_sdl_args, engine_software_sdl_loop, engine_software_sdl_shutdown }, -#endif -#if HAVE_EVAS_OPENGL_SDL - { "gl-sdl",engine_gl_sdl_args, engine_gl_sdl_loop, engine_gl_sdl_shutdown }, -#endif -#if HAVE_EVAS_FB - { "fb", engine_fb_args, engine_fb_loop, engine_fb_shutdown }, -#endif -#if HAVE_EVAS_DIRECTFB - { "directfb",engine_directfb_args, engine_directfb_loop, engine_directfb_shutdown }, -#endif -#if HAVE_EVAS_OPENGL_COCOA - { "gl-cocoa", engine_gl_cocoa_args, engine_gl_cocoa_loop, engine_gl_cocoa_shutdown }, -#endif -#if HAVE_EVAS_PSL1GHT - { "psl1ght", engine_psl1ght_args, engine_psl1ght_loop, engine_psl1ght_shutdown }, -#endif -#if HAVE_EVAS_SOFTWARE_16_DDRAW - { "ddraw-16",engine_software_16_ddraw_args, engine_software_16_ddraw_loop, engine_software_16_ddraw_shutdown }, -#endif -#if HAVE_EVAS_SOFTWARE_16_WINCE - { "wince", engine_software_16_wince_args, engine_software_16_wince_loop, engine_software_16_wince_shutdown }, - { "wince-fb", engine_software_16_wince_args, engine_software_16_wince_loop, engine_software_16_wince_shutdown }, - { "wince-gapi", engine_software_16_wince_args, engine_software_16_wince_loop, engine_software_16_wince_shutdown }, - { "wince-ddraw", engine_software_16_wince_args, engine_software_16_wince_loop, engine_software_16_wince_shutdown }, - { "wince-gdi", engine_software_16_wince_args, engine_software_16_wince_loop, engine_software_16_wince_shutdown }, -#endif -#if HAVE_EVAS_WAYLAND_EGL - { "wayland-egl", engine_wayland_egl_args, engine_wayland_egl_loop, engine_wayland_egl_shutdown }, -#endif -#if HAVE_EVAS_WAYLAND_SHM - { "wayland-shm", engine_wayland_shm_args, engine_wayland_shm_loop, engine_wayland_shm_shutdown }, -#endif -#if HAVE_EVAS_DRM - { "drm", engine_drm_args, engine_drm_loop, engine_drm_shutdown }, -#endif - { NULL, NULL, NULL, NULL } +static const Ecore_Getopt optdesc = { + "expedite", + "%prog [options] ", + PACKAGE_VERSION, + "(C) 2014 Enlightenment", + "BSD with advertisement clause", + "Benchmark EFL rendering logic", + 0, + { + ECORE_GETOPT_STORE_STR('e', "engine", "The Ecore-Evas engine to benchmark (see --list-engines)"), + ECORE_GETOPT_CALLBACK_NOARGS('E', "list-engines", "List available Ecore-Evas engine", + ecore_getopt_callback_ecore_evas_list_engines, NULL), + ECORE_GETOPT_STORE_STR('p', "resolution", "The resolution to use for running the benchmark"), + ECORE_GETOPT_STORE_TRUE('P', "list-resolution", "List know resolution"), + ECORE_GETOPT_STORE_INT('c', "count", "Number of main loop run per tests"), + ECORE_GETOPT_STORE_TRUE('f', "fullscreen", "Make window fullscreen"), + ECORE_GETOPT_STORE_STR('d', "datadir", "Define expedite data directory"), + ECORE_GETOPT_STORE_INT('t', "test", "Run a single test"), + ECORE_GETOPT_STORE_TRUE('l', "list-tests", "List all tests"), + ECORE_GETOPT_STORE_TRUE('m', "compat", "Output compatible with expedite-cmp"), + ECORE_GETOPT_STORE_TRUE('y', "async", "Enable async output"), + ECORE_GETOPT_STORE_TRUE('a', "all", "Run all tests"), + ECORE_GETOPT_LICENSE('L', "license"), + ECORE_GETOPT_COPYRIGHT('C', "copyright"), + ECORE_GETOPT_VERSION('V', "version"), + ECORE_GETOPT_HELP('h', "help"), + ECORE_GETOPT_SENTINEL + } }; +// FIXME: missing - run all [-a], run specific test [-t], list test [-l], output compatible with expedite-cmp [-m] + static const Expedite_Resolution resolutions[] = { { "qvga", 320 , 240 }, { "qvga-p", 240 , 320 }, @@ -1226,184 +1170,172 @@ static const Expedite_Resolution resolutions[] = { }; static void -_help(void) +_cb_delete(Ecore_Evas *ee EINA_UNUSED) { - int i; - - fprintf(stderr, - "No engine selected.\n" - "\n" - "Options:\n" - " -datadir path/to/data\n" - " -a (autorun all tests)\n" - " -c NUM (loop count for test)\n" - " -l (list tests)\n" - " -t TEST-NUM\n" - " -e ENGINE\n" - " -p PROFILE\n" - " -y render in async mode (default is sync)\n" - " -m (expedite-cmp compliant output)\n" - " -f use netwm fullscreen request (requires x11 + wm)\n" - "\n" - "Where ENGINE can be one of:\n"); - for (i = 0; engines[i].name; ++i) - fprintf(stderr, " %s", engines[i].name); - - fprintf(stderr, - "\n" - "Where PROFILE can be one of:\n"); - - for (i = 0; resolutions[i].name; ++i) - if (strlen(resolutions[i].name) >= 7) - fprintf(stderr, " %s [ %i x %i ]\n", resolutions[i].name, resolutions[i].width, resolutions[i].height); - else - fprintf(stderr, " %s\t [ %i x %i ]\n", resolutions[i].name, resolutions[i].width, resolutions[i].height); - - exit(-1); + ecore_main_loop_quit(); } -static int -_profile_parse(int argc, char **argv) +static Eina_Bool +_cb_anim(void *data EINA_UNUSED) { - int i, j; - - for (i = 1; i < argc; i++) - { - if ((!strcmp(argv[i], "-p")) && (i < (argc - 1))) - { - i++; - for (j = 0; resolutions[j].name; ++j) - if (!strcmp(argv[i], resolutions[j].name)) - { - profile = resolutions[j].name; - win_w = resolutions[j].width; - win_h = resolutions[j].height; - break; - } - - if (!resolutions[j].name) - _help(); - } - else if ((!strcmp(argv[i], "-c")) && (i < (argc - 1))) - { - i++; - loops = atoi(argv[i]); - } - else if (!strcmp(argv[i], "-f")) - { - fullscreen = 1; - } - } - return 1; + ui_loop(NULL); + return EINA_TRUE; } -static char * -_datadir_parse(int argc, char **argv) +static Ecore_Job *_job = NULL; + +static void +_cb_job(void *data EINA_UNUSED) { - int i; - - for (i = 1; i < argc; i++) - { - if ((!strcmp(argv[i], "-datadir")) && (i < (argc - 1))) - return argv[i + 1]; - } - - return NULL; + ecore_animator_custom_tick(); + _job = NULL; } static void -_engine_args(int argc, char **argv) +_cb_post_render(Ecore_Evas *ee EINA_UNUSED) { - char buf[4096]; - char *prefix; - int profile_ok; - int i, j; - - /* FIXME: parse args for geometry, engine etc. */ - profile_ok = _profile_parse(argc, argv); - - evas_output_size_set(evas, win_w, win_h); - evas_output_viewport_set(evas, 0, 0, win_w, win_h); - - for (i = 1; i < argc; ++i) - if ((!strcmp(argv[i], "-e")) && (i < (argc - 1))) - { - ++i; - - for (j = 0; engines[j].name; ++j) - if (!strcmp(argv[i], engines[j].name)) - { - engine = engines[j].name; - if (engines[j].init(engines[j].name, win_w, win_h)) - { - loop_func = engines[j].loop; - shutdown_func = engines[j].shutdown; - } - break; - } - } - - if ((!loop_func) || (!profile_ok)) - _help(); - - datadir = _datadir_parse(argc, argv); - - prefix = datadir; - if (!prefix) - prefix = getenv("EXPEDITE_FONTS_DIR"); - if (!prefix) - prefix = PACKAGE_DATA_DIR"/data"; - - snprintf(buf, 4096, "%s", prefix); - - evas_key_modifier_add(evas, "Shift"); - evas_key_modifier_add(evas, "Control"); - evas_key_modifier_add(evas, "Alt"); - evas_key_modifier_add(evas, "Super"); - evas_key_lock_add(evas, "Caps_Lock"); - evas_key_lock_add(evas, "Num_Lock"); - evas_key_lock_add(evas, "Scroll_Lock"); - evas_font_path_append(evas, buf); -// BLAH -// evas_image_cache_set(evas, 4 * 1024 * 1024); -// evas_font_cache_set(evas, 1 * 1024 * 1024); + if (!_job) + { + _job = ecore_job_add(_cb_job, NULL); + } } int main(int argc, char **argv) { -#if defined (HAVE_EVAS_SOFTWARE_XLIB) || defined (HAVE_EVAS_XRENDER_X11) ||defined (HAVE_EVAS_OPENGL_X11) - XInitThreads(); -#endif + Ecore_Animator *anim; + Ecore_Evas *ee; + char *resolution = NULL; + char *engine = NULL; + int resolution_index = 14; /* == svga */ + int test = -1; + Eina_Bool resolution_list = EINA_FALSE; + Eina_Bool tests_list = EINA_FALSE; + Eina_Bool async = EINA_FALSE; + Eina_Bool all_tests = EINA_FALSE; + Eina_Bool quit_option = EINA_FALSE; + Ecore_Getopt_Value values[] = { + ECORE_GETOPT_VALUE_STR(engine), + ECORE_GETOPT_VALUE_BOOL(quit_option), + ECORE_GETOPT_VALUE_STR(resolution), + ECORE_GETOPT_VALUE_BOOL(resolution_list), + ECORE_GETOPT_VALUE_INT(loops), + ECORE_GETOPT_VALUE_BOOL(fullscreen), + ECORE_GETOPT_VALUE_STR(datadir), + ECORE_GETOPT_VALUE_INT(test), + ECORE_GETOPT_VALUE_BOOL(tests_list), + ECORE_GETOPT_VALUE_BOOL(cmp_report), + ECORE_GETOPT_VALUE_BOOL(async), + ECORE_GETOPT_VALUE_BOOL(all_tests), + ECORE_GETOPT_VALUE_BOOL(quit_option), + ECORE_GETOPT_VALUE_BOOL(quit_option), + ECORE_GETOPT_VALUE_BOOL(quit_option), + ECORE_GETOPT_VALUE_BOOL(quit_option), + ECORE_GETOPT_VALUE_NONE + }; - evas_init(); - evas = evas_new(); + setenv("ECORE_NO_VSYNC", "1", 0); - _engine_args(argc, argv); - ui_args(argc, argv); + if (!ecore_evas_init()) return -1; - evas_font_hinting_set(evas, EVAS_FONT_HINTING_AUTO); - - while (_engine_go()) + if (ecore_getopt_parse(&optdesc, values, argc, argv) < 0) { - engine_loop(); - ui_loop(); - if (async_render) - { - if (evas) - eo_do(evas, - evas_canvas_sync(), - evas_canvas_render_async()); - } - else - { - evas_render(evas); - } + fprintf(stderr, "Could not parse arguments.\n"); + return -1; + } + else if (quit_option) + { + return 0; + } + else if (resolution_list) + { + unsigned int i; + + fprintf(stderr, "Known resolution :\n"); + for (i = 0; i < sizeof(resolutions)/sizeof(resolutions[0]); i++) + fprintf(stderr, " * %s\t%ix%i\n", resolutions[i].name, + resolutions[i].width, resolutions[i].height); + return 0; } - evas_free(evas); + if (resolution) + { + unsigned int i; - engine_shutdown(); - evas_shutdown(); + for (i = 0; i < sizeof(resolutions)/sizeof(resolutions[0]); i++) + if (!strcmp(resolutions[i].name, resolution)) + break; + if (i == sizeof(resolutions)/sizeof(resolutions[0])) + { + fprintf(stderr, "Unknow resolution '%s'.\n", resolution); + return 0; + } + resolution_index = i; + profile = resolution; + } + + if (!async) + setenv("ECORE_EVAS_FORCE_SYNC_RENDER", "1", 0); + + if (!datadir) + datadir = getenv("EXPEDITE_FONTS_DIR"); + if (!datadir) + datadir = PACKAGE_DATA_DIR"/data"; + + ecore_app_args_set(argc, (const char **) argv); + + ee = ecore_evas_new(engine, 0, 0, + resolutions[resolution_index].width, + resolutions[resolution_index].height, + NULL); // FIXME: Specify additional parameter for the engine on the command line + if (!ee) return -1; + + choosen_engine = ecore_evas_engine_name_get(ee); + ecore_evas_callback_delete_request_set(ee, _cb_delete); + ecore_evas_callback_post_render_set(ee, _cb_post_render); + + evas = ecore_evas_get(ee); + + evas_font_path_append(evas, datadir); + evas_font_hinting_set(evas, EVAS_FONT_HINTING_AUTO); + + ui_setup(resolutions[resolution_index].width, + resolutions[resolution_index].height); + + if (tests_list) + { + Menu_Item *item; + Eina_List *l; + unsigned int i = 0; + + fprintf(stderr, "List of tests :\n"); + EINA_LIST_FOREACH(menu, l, item) + { + if (item->test) + { + fprintf(stderr, "%3i - %s (Weight %0.2lf)\n", + i, item->text, weights[i]); + } + i++; + } + return 0; + } + else if (test > 0) + { + ui_num(test); + } + + ecore_evas_show(ee); + + if (all_tests) ui_all(); + + anim = ecore_animator_add(_cb_anim, ee); + ecore_animator_custom_tick(); + ecore_main_loop_begin(); + ecore_animator_del(anim); + + ecore_evas_free(ee); + + ecore_evas_shutdown(); return 0; } diff --git a/src/bin/main.h b/src/bin/main.h index c8107a8..5a99c44 100644 --- a/src/bin/main.h +++ b/src/bin/main.h @@ -29,63 +29,7 @@ #endif #include -#if HAVE_EVAS_SOFTWARE_XLIB -#include "engine_software_xlib.h" -#endif -#if HAVE_EVAS_XRENDER_X11 -#include "engine_xrender_x11.h" -#endif -#if HAVE_EVAS_OPENGL_X11 -#include "engine_gl_x11.h" -#endif -#if HAVE_EVAS_SOFTWARE_XCB -#include "engine_software_xcb.h" -#endif -#if HAVE_EVAS_XRENDER_XCB -#include "engine_xrender_xcb.h" -#endif -#if HAVE_EVAS_SOFTWARE_GDI -#include "engine_software_gdi.h" -#endif -#if HAVE_EVAS_SOFTWARE_DDRAW -#include "engine_software_ddraw.h" -#endif -#if HAVE_EVAS_DIRECT3D -#include "engine_direct3d.h" -#endif -#if BUILD_SDL -#include "engine_software_sdl.h" -#endif -#if HAVE_EVAS_OPENGL_SDL -#include "engine_gl_sdl.h" -#endif -#if HAVE_EVAS_FB -#include "engine_fb.h" -#endif -#if HAVE_EVAS_DIRECTFB -#include "engine_directfb.h" -#endif -#if HAVE_EVAS_OPENGL_COCOA -#include "engine_gl_cocoa.h" -#endif -#if HAVE_EVAS_PSL1GHT -#include "engine_psl1ght.h" -#endif -#if HAVE_EVAS_SOFTWARE_16_DDRAW -#include "engine_software_16_ddraw.h" -#endif -#if HAVE_EVAS_SOFTWARE_16_WINCE -#include "engine_software_16_wince.h" -#endif -#if HAVE_EVAS_WAYLAND_EGL -#include "engine_wayland_egl.h" -#endif -#if HAVE_EVAS_WAYLAND_SHM -#include "engine_wayland_shm.h" -#endif -#if HAVE_EVAS_DRM -#include "engine_drm.h" -#endif +#include #ifdef __cplusplus extern "C" @@ -103,7 +47,9 @@ extern "C" extern Evas *evas; extern int win_w, win_h; extern int loops; -extern int fullscreen; +extern const char *choosen_engine; +extern Eina_Bool fullscreen; +extern Eina_Bool cmp_report; typedef struct _Expedite_Resolution Expedite_Resolution; typedef struct _Expedite_Engine Expedite_Engine; diff --git a/src/bin/ui.c b/src/bin/ui.c index 1400afd..5e228d2 100644 --- a/src/bin/ui.c +++ b/src/bin/ui.c @@ -1,10 +1,12 @@ #include "main.h" +#include + #define PROTO #include "tests.h" #undef PROTO -static double start = 0.0; +static double wfps = 0.0; static double t_start = 0.0; static double t_loop = 0.0; @@ -12,17 +14,8 @@ static int f_start = 0; static int f_loop = 0; static char data_dir[4096]; -typedef struct _Menu_Item Menu_Item; - -struct _Menu_Item -{ - Evas_Object *o_icon; - char *icon; - char *text; - void (*func) (void); -}; - int async_render = 0; +Eina_List *menu = NULL; static Evas_Object *o_bg = NULL; static Evas_Object *o_wallpaper = NULL; @@ -34,7 +27,6 @@ static Evas_Object *o_menu_icon_sel = NULL; static Evas_Object *o_menu_icon_sel2 = NULL; static Evas_Object *o_menu_text_sel = NULL; static Evas_Object *o_menu_title = NULL; -static Eina_List *menu = NULL; static int menu_sel = 0; static int menu_active = 0; static double menu_anim = 0.0; @@ -45,14 +37,10 @@ static double p_fps = 0.0; static void (*key_func) (char *key) = NULL; static void (*loop_func) (double t, int f) = NULL; -static int run_all = 0; -static int run_test = 0; -static int list_test = 0; -static int exit_after_test = 0; - -static double weights[] = +double weights[] = { 0.0, // no test 0 + 0.0, // all tests 0 50.4851, // test 1 97.3703, // test 2 @@ -220,126 +208,564 @@ _ui_exit(void) free(mi->text); free(mi); } - engine_abort(); + ecore_main_loop_quit(); } extern const char *profile; extern int win_w, win_h; -extern const char *engine; extern int loops; -extern int fullscreen; -static int cmp_report = 0; + +static int test_item = -1; static void -_ui_all(void) +_ui_menu_show(Eina_Bool visibility) +{ + eo_do(o_menu_logo, evas_obj_visibility_set(visibility)); + eo_do(o_menu_title, evas_obj_visibility_set(visibility)); + eo_do(o_menu_icon, evas_obj_visibility_set(visibility)); + eo_do(o_menu_icon_sel, evas_obj_visibility_set(visibility)); + /* FIXME: ask if it's ok o_menu_icon_sel2 == NULL */ + eo_do(o_menu_icon_sel2, evas_obj_visibility_set(visibility)); + eo_do(o_menu_text_sel, evas_obj_visibility_set(visibility)); + eo_do(o_title, evas_obj_visibility_set(visibility)); + eo_do(o_byline, evas_obj_visibility_set(visibility)); +} + +static void +_ui_select(void) { Eina_List *l; - double fps = 0.0; - double wfps = 0.0; - unsigned int t_count = 0; - unsigned int i; - double avgw = 0.0; + int i; + void (*func) (void) = NULL; + + _ui_menu_show(EINA_FALSE); + for (i = 0, l = menu; l; l = l->next, i++) + { + Menu_Item *mi; + + mi = l->data; + eo_do(mi->o_icon, evas_obj_visibility_set(EINA_FALSE)); + if (i == menu_sel) + func = mi->func; + } + eo_do(o_title, evas_obj_visibility_set(EINA_FALSE)); + eo_do(o_byline, evas_obj_visibility_set(EINA_FALSE)); + + menu_active = 0; + if (func) func(); +} + +static Eina_Bool +_ui_key(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, + const Eo_Event_Description *desc EINA_UNUSED, void *event_info) +{ + Evas_Event_Key_Down *ev = event_info; + + if (key_func) + { + key_func(ev->keyname); + return EINA_TRUE; + } + + if ((!strcmp(ev->keyname, "Escape")) || + (!strcmp(ev->keyname, "q")) || + (!strcmp(ev->keyname, "Q"))) + { + _ui_exit(); + } + if (menu_active) + { + if (!strcmp(ev->keyname, "Left")) menu_sel++; + if (!strcmp(ev->keyname, "Right")) menu_sel--; + if (menu_sel < 0) menu_sel = 0; + else if ((unsigned int)menu_sel >= eina_list_count(menu)) menu_sel = eina_list_count(menu) - 1; + menu_anim_sel = menu_sel; + if (!strcmp(ev->keyname, "Return")) _ui_select(); + } + + return EINA_TRUE; +} + +static Evas_Coord down_x, down_y; +static int down_menu_sel = 0; + +static Eina_Bool +_ui_mouse_down(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, + const Eo_Event_Description *desc EINA_UNUSED, void *event_info) +{ + Evas_Event_Mouse_Down *ev = event_info; + + if (ev->button != 1) return EINA_TRUE; + if (menu_active) + { + down_x = ev->canvas.x; + down_y = ev->canvas.y; + down_menu_sel = menu_sel; + } + + return EINA_TRUE; +} + +static Eina_Bool +_ui_mouse_up(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, + const Eo_Event_Description *desc EINA_UNUSED, void *event_info) +{ + Evas_Event_Mouse_Up *ev = event_info; + + if (ev->button != 1) return EINA_TRUE; + if (menu_active) + { + Evas_Coord dx, dy; + + dx = ev->canvas.x - down_x; + dy = ev->canvas.y - down_y; + if ((((dx * dx) + (dy * dy)) < (20 * 20)) && + (menu_sel == down_menu_sel)) + _ui_select(); + } + else + { + evas_event_feed_key_down(evas, "Escape", "Escape", NULL, NULL, 0, NULL); + evas_event_feed_key_up(evas, "Escape", "Escape", NULL, NULL, 0, NULL); + } + + return EINA_TRUE; +} + +static Eina_Bool +_ui_mouse_move(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, + const Eo_Event_Description *desc EINA_UNUSED, void *event_info) +{ + Evas_Event_Mouse_Move *ev = event_info; + + if (ev->buttons != 1) return EINA_TRUE; + if (menu_active) + { + menu_sel = down_menu_sel + ((ev->cur.canvas.x - down_x) / 25); + /* scroll */ + if (menu_sel < 0) menu_sel = 0; + else if ((unsigned int)menu_sel >= eina_list_count(menu)) + menu_sel = eina_list_count(menu) - 1; + menu_anim_sel = menu_sel; + } + + return EINA_TRUE; +} + +static void +_ui_menu_item_full_add(Eina_Bool test, + char *icon, char *text, + void (*func) (void)) +{ Menu_Item *mi; - if (o_menu_logo) - eo_do(o_menu_logo, evas_obj_visibility_set(EINA_FALSE)); - if (o_menu_title) - eo_do(o_menu_title, evas_obj_visibility_set(EINA_FALSE)); - if (o_menu_icon) - eo_do(o_menu_icon, evas_obj_visibility_set(EINA_FALSE)); - if (o_menu_icon_sel) - eo_do(o_menu_icon_sel, evas_obj_visibility_set(EINA_FALSE)); - /* FIXME: ask if it's ok o_menu_icon_sel2 == NULL */ - if (o_menu_icon_sel2) - eo_do(o_menu_icon_sel2, evas_obj_visibility_set(EINA_FALSE)); - if (o_menu_text_sel) - eo_do(o_menu_text_sel, evas_obj_visibility_set(EINA_FALSE)); - if (o_title) - eo_do(o_title, evas_obj_visibility_set(EINA_FALSE)); - if (o_byline) - eo_do(o_byline, evas_obj_visibility_set(EINA_FALSE)); + mi = malloc(sizeof(Menu_Item)); + mi->o_icon = eo_add(EVAS_IMAGE_CLASS, evas); + eo_unref(mi->o_icon); + eo_do(mi->o_icon, evas_obj_image_file_set(build_path(icon), NULL), + evas_obj_size_set(32, 32), + evas_obj_image_fill_set(0, 0, 32, 32)); + mi->test = test; + mi->icon = strdup(icon); + mi->text = strdup(text); + mi->func = func; + menu = eina_list_append(menu, mi); + eo_do(o_menu_icon_sel2, evas_obj_raise()); +} + +#define _ui_menu_item_add(Icon, Text, Func) _ui_menu_item_full_add(EINA_TRUE, Icon, Text, Func) + +EO_CALLBACKS_ARRAY_DEFINE(ui_callbacks, + { EVAS_OBJECT_EVENT_KEY_DOWN, _ui_key }, + { EVAS_OBJECT_EVENT_MOUSE_DOWN, _ui_mouse_down }, + { EVAS_OBJECT_EVENT_MOUSE_UP, _ui_mouse_up }, + { EVAS_OBJECT_EVENT_MOUSE_MOVE, _ui_mouse_move }); + +void +ui_setup(unsigned int ui_w, unsigned int ui_h) +{ + Evas_Object *o; + Evas_Coord x, y, w, h; + + win_w = ui_w; + win_h = ui_h; + + o = eo_add(EVAS_RECTANGLE_CLASS, evas); + eo_unref(o); + eo_do(o, evas_obj_position_set(0, 0), + evas_obj_size_set(win_w, win_h), + evas_obj_color_set(0, 0, 0, 0), + evas_obj_layer_set(1000), + evas_obj_focus_set(1), + evas_obj_visibility_set(EINA_TRUE), + eo_event_callback_array_add(ui_callbacks(), NULL)); + o_bg = o; + + o = eo_add(EVAS_RECTANGLE_CLASS, evas); + eo_unref(o); + eo_do(o, evas_obj_position_set(0, 0), + evas_obj_size_set(win_w, win_h), + evas_obj_color_set(255, 255, 255, 255), + evas_obj_layer_set(-99), + evas_obj_visibility_set(EINA_TRUE)); + o_wallpaper = o; + + o = eo_add(EVAS_TEXT_CLASS, evas); + eo_unref(o); + eo_do(o, evas_obj_text_font_set("Vera-Bold", 10), + evas_obj_text_set("EXPEDITE"), + evas_obj_layer_set(100), + evas_obj_color_set(0, 0, 0, 100), + evas_obj_pass_events_set(1), + evas_obj_size_get(&w, &h)); + x = (win_w - w) / 2; + y = 0; + eo_do(o, evas_obj_position_set(x, y), + evas_obj_visibility_set(EINA_TRUE)); + o_title = o; + + o = eo_add(EVAS_TEXT_CLASS, evas); + eo_unref(o); + eo_do(o, evas_obj_text_font_set("Vera", 9), + evas_obj_text_set("LEFT/RIGHT - select, ENTER - select, ESCAPE - exit."), + evas_obj_layer_set(100), + evas_obj_color_set(0, 0, 0, 60), + evas_obj_pass_events_set(1), + evas_obj_size_get(&w, NULL)); + x = (win_w - w) / 2; + y = h + 2; + eo_do(o, evas_obj_position_set(x, y), + evas_obj_visibility_set(EINA_TRUE)); + o_byline = o; + + o = eo_add(EVAS_IMAGE_CLASS, evas); + eo_unref(o); + eo_do(o, evas_obj_position_set((win_w - 120) / 2, ((win_h - 160) / 2)), + evas_obj_image_file_set(build_path("e-logo.png"), NULL), + evas_obj_image_fill_set(0, 0, 120, 160), + evas_obj_size_set(120, 160), + evas_obj_layer_set(-98), + evas_obj_color_set(255, 255, 255, 255), + evas_obj_visibility_set(EINA_TRUE)); + o_menu_logo = o; + + o = eo_add(EVAS_IMAGE_CLASS, evas); + eo_unref(o); + eo_do(o, evas_obj_position_set(win_w - 128, - 128), + evas_obj_image_fill_set(0, 0, 256, 256), + evas_obj_size_set(256, 256), + evas_obj_visibility_set(EINA_TRUE)); + o_menu_icon = o; + + o = eo_add(EVAS_IMAGE_CLASS, evas); + eo_unref(o); + eo_do(o, evas_obj_position_set(0, 0), + evas_obj_image_file_set(build_path("icon_sel.png"), NULL), + evas_obj_size_set(48, 48), + evas_obj_image_fill_set(0, 0, 48, 48)); + o_menu_icon_sel = o; + + o = eo_add(EVAS_IMAGE_CLASS, evas); + eo_unref(o); + eo_do(o, evas_obj_position_set(0, 0), + evas_obj_image_file_set(build_path("text_sel.png"), NULL), + evas_obj_size_set(96, 32), + evas_obj_image_fill_set(0, 0, 96, 32), + evas_obj_image_border_set(7, 7, 7, 7)); + o_menu_text_sel = o; + + o = eo_add(EVAS_TEXT_CLASS, evas); + eo_unref(o); + eo_do(o, evas_obj_text_font_set("Vera", 10), + evas_obj_text_set(""), + evas_obj_color_set(0, 0, 0, 100), + evas_obj_pass_events_set(1), + evas_obj_size_get(&w, &h)); + x = (win_w - w) / 2; + y = (win_h - h) / 2; + eo_do(o, evas_obj_position_set(x, y)); + o_menu_title = o; + + _ui_menu_item_full_add(EINA_FALSE, "e.png", "About", about_start); + _ui_menu_item_full_add(EINA_FALSE, "e.png", "All Tests", ui_all); +#define UI +#include "tests.h" +#undef UI + _ui_menu_item_full_add(EINA_FALSE, "exit.png", "Exit", _ui_exit); + +#ifdef HAVE_SYNC + /* make sure disk io isn't going to turn up unexpectedly */ + sync(); + sync(); + sync(); +#endif + + menu_active = 1; +} + +void +ui_num(int n) +{ + Menu_Item *mi; + + mi = eina_list_nth(menu, n); + if (mi) + { + if (!mi->test) + return; + menu_sel = n; + _ui_select(); + } +} + +Eina_Bool +ui_loop(void *data EINA_UNUSED) +{ + static int first = 1; + static double pt = 0.0; + double t, t2; + + eo_do(o_bg, evas_obj_size_set(win_w, win_h)); + eo_do(o_wallpaper, evas_obj_size_set(win_w, win_h)); + + if (loop_func) + { + t = get_time(); + f_loop++; + f_start++; + if ((t - t_loop) >= 1.0) + { + // ui_fps((double)f_loop / (t - t_loop)); + t_loop = t; + f_loop = 0; + } + loop_func(t - t_start, f_start); + return EINA_TRUE; + } + + t2 = get_time(); + if (first) + { + t = 0.1; + pt = t2; + } + else + { + t = t2 - pt; + pt = t2; + } + first = 0; + + /* menu layout */ + if (menu_active) + { + Eina_List *l; + Menu_Item *mi; + int i = 0; + static double tr = 0.0; + double tt; + + tt = t; + tt += tr; + while (tt > 0.001) + { + menu_anim = (menu_anim * 0.995) + (menu_anim_sel * 0.005); + tt -= 0.001; + } + tr = tt; + EINA_LIST_FOREACH(menu, l, mi) + { + char buf[4096]; + Evas_Coord x, y, w, h, tw, th; + Evas_Coord len; + double a; + Evas_Object *o; + + o = mi->o_icon; + eo_do(o_menu_logo, evas_obj_size_get(&w, &h)); + len = ((w * 3) + 10) / 4; + eo_do(o, evas_obj_size_get(&w, &h)); + x = (win_w / 2) + + (sin((menu_anim - (double)i) * 0.33) * len) + - (w / 2); + y = (win_h / 2) + + (cos((menu_anim - (double)i) * 0.33) * len) + - (h / 2); + eo_do(o, evas_obj_position_set(x, y)); + a = menu_anim - (double)i; + if (a < 0) a = -a; + a = 255 - (30 * a); + eo_do(o, evas_obj_color_set(a, a, a, a), + evas_obj_visibility_set(EINA_TRUE)); + + if (i == menu_sel) + { + a = menu_anim - (double)i; + if (a < 0) a = -a; + a = 255 - (255 * a); + + o = o_menu_icon_sel; + eo_do(o, evas_obj_position_set(x - ((48 - w) / 2), y - ((48 - h) / 2)), + evas_obj_color_set(a, a, a, a)); + + o = o_menu_title; + eo_do(o, evas_obj_color_set(a, a, a, a), + evas_obj_text_set(mi->text), + evas_obj_size_get(&tw, &th)); + x = (win_w - tw) / 2; + y = (win_h / 2) + len + 48; + eo_do(o, evas_obj_position_set(x, y)); + + o = o_menu_text_sel; + w = tw + 24; + h = 28; + x = x - 12; + y = y + ((th - h) / 2); + eo_do(o, evas_obj_position_set(x, y), + evas_obj_size_set(w, h), + evas_obj_image_fill_set(0, 0, w, h), + evas_obj_color_set(a, a, a, a)); + + o = o_menu_icon; + snprintf(buf, 4096, "%s%s", data_dir, mi->icon); + eo_do(o, evas_obj_image_file_set(buf, NULL), + evas_obj_color_set(a / 2, a / 2, a / 2, a / 2)); + } + i++; + } + eo_do(o_menu_logo, evas_obj_position_set((win_w - 120) / 2, ((win_h - 160) / 2)), + evas_obj_visibility_set(EINA_TRUE)); + _ui_menu_show(EINA_TRUE); + } + else + { + } + + return EINA_TRUE; +} + +void +ui_menu(void) +{ + eo_do(o_title, evas_obj_visibility_set(EINA_TRUE)); + eo_do(o_byline, evas_obj_visibility_set(EINA_TRUE), + evas_obj_text_set + ("LEFT/RIGHT - select, ENTER - select, ESCAPE - exit.")); + menu_active = 1; + key_func = NULL; + loop_func = NULL; + + ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_TIMER); +} + +void +ui_func_set(void (*kfunc) (char *key), void (*lfunc) (double t, int f)) +{ + key_func = kfunc; + loop_func = lfunc; + t_loop = t_start = get_time(); + f_loop = f_start = 0; + ui_fps(0.0); + + ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_CUSTOM); + ecore_animator_custom_tick(); +} + +void +ui_all(void) +{ + Eina_List *l; + Menu_Item *mi; + int i = 0; + double t, t0; + + _ui_menu_show(EINA_FALSE); + + /* warm up the cpu with some spinning */ + t0 = time(NULL); + for (;;) + { + t = time(NULL); + if (t - t0 > 2) break; + } + + wfps = 0; EINA_LIST_FOREACH(menu, l, mi) { - if ((mi->func == about_start) || - (mi->func == _ui_exit) || - (mi->func == _ui_all)) - continue; - if (mi->func) mi->func(); - if (o_title) - eo_do(o_title, evas_obj_visibility_set(EINA_FALSE)); - if (o_byline) - eo_do(o_byline, evas_obj_visibility_set(EINA_FALSE)); - while (p_fps == 0.0) - { - engine_loop(); - ui_loop(); - if (async_render) - { - if (evas) - eo_do(evas, - evas_canvas_sync(), - evas_canvas_render_async()); - } - else - { - evas_render(evas); - } - } - /* This give time to delete the objects of the previous test and make - the result of next test more accurate. Draw back, some time is not - counted at all. */ - if (async_render) - { - if (evas) - eo_do(evas, - evas_canvas_sync(), - evas_canvas_render_async()); - } - else - { - evas_render(evas); - } - t_count++; - fps += p_fps; - wfps += (p_fps * weights[t_count]); - key_func("Escape"); - } - for (i = 1; i < t_count + 1; i++) - avgw += weights[i]; - avgw /= t_count; - if (t_count > 0) - { - char datestr[1024]; - struct tm *tim; - time_t now; + i++; - now = time(NULL); - tim = localtime(&now); - if (tim) strftime(datestr, sizeof(datestr), "%Y-%m-%d %H:%M:%S", tim); - else snprintf(datestr, sizeof(datestr), "unknown"); - // printf("%5.2f , EVAS SPEED\n", fps / t_count); - if (cmp_report) - printf("%5.2f , EVAS SPEED (WEIGHTED), " - "tn, %i , " - "t, %s , " - "ev , %i.%i.%i.%i , " - "p , %s , " - "sz , %i , %i , " - "c , %i , " - "e , %s , " - "fs , %i\n" - , - wfps / (t_count * avgw), - // fps / t_count, - t_count, - datestr, - evas_version->major, evas_version->minor, evas_version->micro, evas_version->revision, - profile, - win_w, win_h, - loops, - engine, - fullscreen); + if (!mi->test) + continue; + + menu_sel = i - 1; + test_item = menu_sel; + _ui_select(); + break; + } +} + +void +ui_fps(double fps) +{ + p_fps = fps; + if (fps > 0.0 && test_item > 0) + { + Menu_Item *mi; + + key_func("Escape"); + + /* This does not give time to delete the objects of the previous test + and make the result of next test less accurate. Benefit we do not + loose track of any of the cost anymore (Would be better to force + an empty render and account that to the previous test). */ + + wfps += (fps * weights[test_item]); + + test_item++; + mi = eina_list_nth(menu, test_item); + if (!mi->test) + { + char datestr[1024]; + struct tm *tim; + time_t now; + double avgw = 0.0; + unsigned int i; + unsigned int t_count; + + t_count = EINA_C_ARRAY_LENGTH(weights) - 3; + for (i = 2; i < EINA_C_ARRAY_LENGTH(weights) - 1; i++) + avgw += weights[i]; + avgw /= t_count; + + now = time(NULL); + tim = localtime(&now); + if (tim) strftime(datestr, sizeof(datestr), "%Y-%m-%d %H:%M:%S", tim); + else snprintf(datestr, sizeof(datestr), "unknown"); + + if (cmp_report) + printf("%5.2f , EVAS SPEED (WEIGHTED), " + "tn, %i , " + "t, %s , " + "ev , %i.%i.%i.%i , " + "p , %s , " + "sz , %i , %i , " + "c , %i , " + "e , %s , " + "fs , %i\n", + wfps / (t_count * avgw), + // fps / t_count, + t_count, + datestr, + evas_version->major, + evas_version->minor, + evas_version->micro, + evas_version->revision, + profile, + win_w, win_h, + loops, + choosen_engine, + fullscreen); else printf("\n#####Test Result#####\n" "evas fps speed: %5.2f\n" @@ -361,632 +787,15 @@ _ui_all(void) profile, win_w, win_h, loops, - engine, + choosen_engine, fullscreen); - } -} - -static void -_ui_num(int n) -{ - double fps = 0.0; - double wfps = 0.0; - int t_count = 0; - Menu_Item *mi; - unsigned int i; - double avgw = 0.0; - - if (o_menu_logo) - eo_do(o_menu_logo, evas_obj_visibility_set(EINA_FALSE)); - if (o_menu_title) - eo_do(o_menu_title, evas_obj_visibility_set(EINA_FALSE)); - if (o_menu_icon) - eo_do(o_menu_icon, evas_obj_visibility_set(EINA_FALSE)); - if (o_menu_icon_sel) - eo_do(o_menu_icon_sel, evas_obj_visibility_set(EINA_FALSE)); - if (o_menu_icon_sel2) - eo_do(o_menu_icon_sel2, evas_obj_visibility_set(EINA_FALSE)); - if (o_menu_text_sel) - eo_do(o_menu_text_sel, evas_obj_visibility_set(EINA_FALSE)); - if (o_title) - eo_do(o_title, evas_obj_visibility_set(EINA_FALSE)); - if (o_byline) - eo_do(o_byline, evas_obj_visibility_set(EINA_FALSE)); - mi = eina_list_nth(menu, n); - if (mi) - { - if ((mi->func == about_start) || - (mi->func == _ui_exit) || - (mi->func == _ui_all)) - goto done; - if (mi->func) mi->func(); - if (o_title) - eo_do(o_title, evas_obj_visibility_set(EINA_FALSE)); - if (o_byline) - eo_do(o_byline, evas_obj_visibility_set(EINA_FALSE)); - while (p_fps == 0.0) + ecore_main_loop_quit(); + } + else { - ui_loop(); - engine_loop(); - if (async_render) - { - if (evas) - eo_do(evas, - evas_canvas_sync(), - evas_canvas_render_async()); - } - else - { - evas_render(evas); - } - } - /* This give time to delete the objects of the previous test and make - the result of next test more accurate. Draw back, some time is not - counted at all. */ - if (async_render) - { - if (evas) - eo_do(evas, - evas_canvas_sync(), - evas_canvas_render_async()); - } - else - { - evas_render(evas); - } - t_count++; - fps += p_fps; - wfps += (p_fps * weights[n]); - key_func("Escape"); - } -done: - for (i = 1; i < ((sizeof(weights) / sizeof(double)) - 1); i++) - avgw += weights[i]; - avgw /= (i - 1); - if (t_count > 0) - { - // printf("%5.2f , EVAS SPEED\n", fps / t_count); - printf("%5.2f , EVAS SPEED (WEIGHTED)\n", wfps / (t_count * avgw)); - } -} - -static void -_ui_select(void) -{ - Eina_List *l; - int i; - void (*func) (void) = NULL; - - if (o_menu_logo) - eo_do(o_menu_logo, evas_obj_visibility_set(EINA_FALSE)); - if (o_menu_title) - eo_do(o_menu_title, evas_obj_visibility_set(EINA_FALSE)); - if (o_menu_icon) - eo_do(o_menu_icon, evas_obj_visibility_set(EINA_FALSE)); - if (o_menu_icon_sel) - eo_do(o_menu_icon_sel, evas_obj_visibility_set(EINA_FALSE)); - if (o_menu_icon_sel2) - eo_do(o_menu_icon_sel2, evas_obj_visibility_set(EINA_FALSE)); - if (o_menu_text_sel) - eo_do(o_menu_text_sel, evas_obj_visibility_set(EINA_FALSE)); - if (o_title) - eo_do(o_title, evas_obj_visibility_set(EINA_FALSE)); - if (o_byline) - eo_do(o_byline, evas_obj_visibility_set(EINA_FALSE)); - for (i = 0, l = menu; l; l = l->next, i++) - { - Menu_Item *mi; - - mi = l->data; - if (mi->o_icon) - eo_do(mi->o_icon, evas_obj_visibility_set(EINA_FALSE)); - if (i == menu_sel) - func = mi->func; - } - menu_active = 0; - if (func) func(); - if (o_title) - eo_do(o_title, evas_obj_visibility_set(EINA_FALSE)); - if (o_byline) - eo_do(o_byline, evas_obj_visibility_set(EINA_FALSE)); -} - -static void -_ui_key(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) -{ - Evas_Event_Key_Down *ev; - - ev = event_info; - if (key_func) - { - key_func(ev->keyname); - return; - } - if ((!strcmp(ev->keyname, "Escape")) || - (!strcmp(ev->keyname, "q")) || - (!strcmp(ev->keyname, "Q"))) - { - _ui_exit(); - } - if (menu_active) - { - if (!strcmp(ev->keyname, "Left")) menu_sel++; - if (!strcmp(ev->keyname, "Right")) menu_sel--; - if (menu_sel < 0) menu_sel = 0; - else if ((unsigned int)menu_sel >= eina_list_count(menu)) menu_sel = eina_list_count(menu) - 1; - menu_anim_sel = menu_sel; - if (!strcmp(ev->keyname, "Return")) _ui_select(); - } -} - -static Evas_Coord down_x, down_y; -static int down_menu_sel = 0; - -static void -_ui_mouse_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) -{ - Evas_Event_Mouse_Down *ev; - - ev = event_info; - if (ev->button != 1) return; - if (menu_active) - { - down_x = ev->canvas.x; - down_y = ev->canvas.y; - down_menu_sel = menu_sel; - } -} - -static void -_ui_mouse_up(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) -{ - Evas_Event_Mouse_Up *ev; - - ev = event_info; - if (ev->button != 1) return; - if (menu_active) - { - Evas_Coord dx, dy; - - dx = ev->canvas.x - down_x; - dy = ev->canvas.y - down_y; - if ((((dx * dx) + (dy * dy)) < (20 * 20)) && - (menu_sel == down_menu_sel)) - _ui_select(); - } - else - { - evas_event_feed_key_down(evas, "Escape", "Escape", NULL, NULL, 0, NULL); - evas_event_feed_key_up(evas, "Escape", "Escape", NULL, NULL, 0, NULL); - } -} - -static void -_ui_mouse_move(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) -{ - Evas_Event_Mouse_Move *ev; - - ev = event_info; - if (ev->buttons != 1) return; - if (menu_active) - { - menu_sel = down_menu_sel + ((ev->cur.canvas.x - down_x) / 25); - /* scroll */ - if (menu_sel < 0) menu_sel = 0; - else if ((unsigned int)menu_sel >= eina_list_count(menu)) - menu_sel = eina_list_count(menu) - 1; - menu_anim_sel = menu_sel; - } -} - -static void -_ui_menu_item_add(char *icon, char *text, void (*func) (void)) -{ - Menu_Item *mi; - - mi = malloc(sizeof(Menu_Item)); - mi->o_icon = eo_add(EVAS_IMAGE_CLASS, evas); - eo_unref(mi->o_icon); - if (mi->o_icon) - eo_do(mi->o_icon, evas_obj_image_file_set(build_path(icon), NULL), - evas_obj_size_set(32, 32), - evas_obj_image_fill_set(0, 0, 32, 32)); - mi->icon = strdup(icon); - mi->text = strdup(text); - mi->func = func; - menu = eina_list_append(menu, mi); - if (o_menu_icon_sel2) - eo_do(o_menu_icon_sel2, evas_obj_raise()); -} - -static void -_ui_setup(void) -{ - Evas_Object *o; - Evas_Coord x, y, w, h; - time_t t0, t; - - o = eo_add(EVAS_RECTANGLE_CLASS, evas); - eo_unref(o); - if (o) - eo_do(o, evas_obj_position_set(0, 0), - evas_obj_size_set(win_w, win_h), - evas_obj_color_set(0, 0, 0, 0), - evas_obj_layer_set(1000), - evas_obj_focus_set(1), - evas_obj_visibility_set(EINA_TRUE)); - evas_object_event_callback_add(o, EVAS_CALLBACK_KEY_DOWN, _ui_key, NULL); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _ui_mouse_down, NULL); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, _ui_mouse_up, NULL); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, _ui_mouse_move, NULL); - o_bg = o; - - o = eo_add(EVAS_RECTANGLE_CLASS, evas); - eo_unref(o); - if (o) - eo_do(o, evas_obj_position_set(0, 0), - evas_obj_size_set(win_w, win_h), - evas_obj_color_set(255, 255, 255, 255), - evas_obj_layer_set(-99), - evas_obj_visibility_set(EINA_TRUE)); - o_wallpaper = o; - - o = eo_add(EVAS_TEXT_CLASS, evas); - eo_unref(o); - if (o) - eo_do(o, evas_obj_text_font_set("Vera-Bold", 10), - evas_obj_text_set("EXPEDITE"), - evas_obj_layer_set(100), - evas_obj_color_set(0, 0, 0, 100), - evas_obj_pass_events_set(1), - evas_obj_size_get(&w, &h)); - x = (win_w - w) / 2; - y = 0; - if (o) - eo_do(o, evas_obj_position_set(x, y), - evas_obj_visibility_set(EINA_TRUE)); - o_title = o; - - o = eo_add(EVAS_TEXT_CLASS, evas); - eo_unref(o); - if (o) - eo_do(o, evas_obj_text_font_set("Vera", 9), - evas_obj_text_set("LEFT/RIGHT - select, ENTER - select, ESCAPE - exit."), - evas_obj_layer_set(100), - evas_obj_color_set(0, 0, 0, 60), - evas_obj_pass_events_set(1), - evas_obj_size_get(&w, NULL)); - x = (win_w - w) / 2; - y = h + 2; - if (o) - eo_do(o, evas_obj_position_set(x, y), - evas_obj_visibility_set(EINA_TRUE)); - o_byline = o; - - o = eo_add(EVAS_IMAGE_CLASS, evas); - eo_unref(o); - if (o) - eo_do(o, evas_obj_position_set((win_w - 120) / 2, ((win_h - 160) / 2)), - evas_obj_image_file_set(build_path("e-logo.png"), NULL), - evas_obj_image_fill_set(0, 0, 120, 160), - evas_obj_size_set(120, 160), - evas_obj_layer_set(-98), - evas_obj_color_set(255, 255, 255, 255), - evas_obj_visibility_set(EINA_TRUE)); - o_menu_logo = o; - - o = eo_add(EVAS_IMAGE_CLASS, evas); - eo_unref(o); - if (o) - eo_do(o, evas_obj_position_set(win_w - 128, - 128), - evas_obj_image_fill_set(0, 0, 256, 256), - evas_obj_size_set(256, 256), - evas_obj_visibility_set(EINA_TRUE)); - o_menu_icon = o; - - o = eo_add(EVAS_IMAGE_CLASS, evas); - eo_unref(o); - if (o) - eo_do(o, evas_obj_position_set(0, 0), - evas_obj_image_file_set(build_path("icon_sel.png"), NULL), - evas_obj_size_set(48, 48), - evas_obj_image_fill_set(0, 0, 48, 48)); - o_menu_icon_sel = o; - - o = eo_add(EVAS_IMAGE_CLASS, evas); - eo_unref(o); - if (o) - eo_do(o, evas_obj_position_set(0, 0), - evas_obj_image_file_set(build_path("text_sel.png"), NULL), - evas_obj_size_set(96, 32), - evas_obj_image_fill_set(0, 0, 96, 32), - evas_obj_image_border_set(7, 7, 7, 7)); - o_menu_text_sel = o; - - o = eo_add(EVAS_TEXT_CLASS, evas); - eo_unref(o); - if (o) - eo_do(o, evas_obj_text_font_set("Vera", 10), - evas_obj_text_set(""), - evas_obj_color_set(0, 0, 0, 100), - evas_obj_pass_events_set(1), - evas_obj_size_get(&w, &h)); - x = (win_w - w) / 2; - y = (win_h - h) / 2; - if (o) - eo_do(o, evas_obj_position_set(x, y)); - o_menu_title = o; - - _ui_menu_item_add("e.png", "About", about_start); - _ui_menu_item_add("e.png", "All Tests", _ui_all); -#define UI -#include "tests.h" -#undef UI - _ui_menu_item_add("exit.png", "Exit", _ui_exit); - -#ifdef HAVE_SYNC - /* make sure disk io isn't going to turn up unexpectedly */ - sync(); - sync(); - sync(); -#endif - /* warm up the cpu with some spinning */ - if (run_all) - { - t0 = time(NULL); - for (;;) - { - t = time(NULL); - if (t - t0 > 2) break; + menu_sel = test_item; + _ui_select(); } } - - if (run_all) - { - _ui_all(); - } - else if (run_test > 0) - { - _ui_num(run_test); - } - else if (list_test > 0) - { - Eina_List *l; - int i; - - for (l = menu, i = -1; l; l = l->next, i++) - { - Menu_Item *mi; - - mi = l->data; - if (i > 0) - printf("%3i - %s (Weight %0.2lf)\n", i, mi->text, weights[i]); - } - } - else - { - menu_active = 1; - } - - if (exit_after_test) - _ui_exit(); - -} - -void -ui_args(int argc, char **argv) -{ - int i; - - for (i = 1; i < argc; i++) - { - if (!strcmp(argv[i], "-a")) - { - run_all = 1; - exit_after_test = 1; - } - else if ((!strcmp(argv[i], "-t")) && (i < (argc - 1))) - { - run_test = atoi(argv[i + 1]) + 1; - exit_after_test = 1; - if (run_test < 2) run_test = 2; - } - else if (!strcmp(argv[i], "-l")) - { - list_test = 1; - } - else if (!strcmp(argv[i], "-m")) - { - cmp_report = 1; - } - else if (!strcmp(argv[i], "-y")) - { - async_render = 1; - } - } - _ui_setup(); - start = get_time(); -} - -void -ui_loop(void) -{ - static int first = 1; - static double pt = 0.0; - double t, t2; - - if (o_bg) - eo_do(o_bg, evas_obj_size_set(win_w, win_h)); - if (o_wallpaper) - eo_do(o_wallpaper, evas_obj_size_set(win_w, win_h)); - if (loop_func) - { - t = get_time(); - f_loop++; - f_start++; - if ((t - t_loop) >= 1.0) - { - // ui_fps((double)f_loop / (t - t_loop)); - t_loop = t; - f_loop = 0; - } - loop_func(t - t_start, f_start); - return; - } - t2 = get_time(); - if (first) - { - t = 0.1; - pt = t2; - } - else - { - t = t2 - pt; - pt = t2; - } - first = 0; - - /* menu layout */ - if (menu_active) - { - Eina_List *l; - int i; - static double tr = 0.0; - double tt; - - tt = t; - tt += tr; - while (tt > 0.001) - { - menu_anim = (menu_anim * 0.995) + (menu_anim_sel * 0.005); - tt -= 0.001; - } - tr = tt; - for (i = 0, l = menu; l; l = l->next, i++) - { - char buf[4096]; - Menu_Item *mi; - Evas_Coord x, y, w, h, tw, th; - Evas_Coord len; - double a; - Evas_Object *o; - - mi = l->data; - o = mi->o_icon; - if (o_menu_logo) - eo_do(o_menu_logo, evas_obj_size_get(&w, &h)); - len = ((w * 3) + 10) / 4; - if (o) - eo_do(o, evas_obj_size_get(&w, &h)); - x = (win_w / 2) - + (sin((menu_anim - (double)i) * 0.33) * len) - - (w / 2); - y = (win_h / 2) - + (cos((menu_anim - (double)i) * 0.33) * len) - - (h / 2); - if (o) - eo_do(o, evas_obj_position_set(x, y)); - a = menu_anim - (double)i; - if (a < 0) a = -a; - a = 255 - (30 * a); - if (o) - eo_do(o, evas_obj_color_set(a, a, a, a), - evas_obj_visibility_set(EINA_TRUE)); - - if (i == menu_sel) - { - a = menu_anim - (double)i; - if (a < 0) a = -a; - a = 255 - (255 * a); - - o = o_menu_icon_sel; - if (o) - eo_do(o, evas_obj_position_set(x - ((48 - w) / 2), y - ((48 - h) / 2)), - evas_obj_color_set(a, a, a, a)); - - o = o_menu_title; - if (o) - eo_do(o, evas_obj_color_set(a, a, a, a), - evas_obj_text_set(mi->text), - evas_obj_size_get(&tw, &th)); - x = (win_w - tw) / 2; - y = (win_h / 2) + len + 48; - if (o) - eo_do(o, evas_obj_position_set(x, y)); - - - o = o_menu_text_sel; - w = tw + 24; - h = 28; - x = x - 12; - y = y + ((th - h) / 2); - if (o) - eo_do(o, evas_obj_position_set(x, y), - evas_obj_size_set(w, h), - evas_obj_image_fill_set(0, 0, w, h), - evas_obj_color_set(a, a, a, a)); - - o = o_menu_icon; - snprintf(buf, 4096, "%s%s", data_dir, mi->icon); - if (o) - eo_do(o, evas_obj_image_file_set(buf, NULL), - evas_obj_color_set(a / 2, a / 2, a / 2, a / 2)); - } - } - if (o_menu_logo) - eo_do(o_menu_logo, evas_obj_position_set((win_w - 120) / 2, ((win_h - 160) / 2)), - evas_obj_visibility_set(EINA_TRUE)); - if (o_menu_title) - eo_do(o_menu_title, evas_obj_visibility_set(EINA_TRUE)); - if (o_menu_icon) - eo_do(o_menu_icon, evas_obj_visibility_set(EINA_TRUE)); - if (o_menu_icon_sel) - eo_do(o_menu_icon_sel, evas_obj_visibility_set(EINA_TRUE)); - if (o_menu_icon_sel2) - eo_do(o_menu_icon_sel2, evas_obj_visibility_set(EINA_TRUE)); - if (o_menu_text_sel) - eo_do(o_menu_text_sel, evas_obj_visibility_set(EINA_TRUE)); - } - else - { - } -} - -void -ui_menu(void) -{ - if (o_title) - eo_do(o_title, evas_obj_visibility_set(EINA_TRUE)); - if (o_byline) - eo_do(o_byline, evas_obj_visibility_set(EINA_TRUE), - evas_obj_text_set - ("LEFT/RIGHT - select, ENTER - select, ESCAPE - exit.")); - menu_active = 1; - key_func = NULL; - loop_func = NULL; -} - -void -ui_func_set(void (*kfunc) (char *key), void (*lfunc) (double t, int f)) -{ - key_func = kfunc; - loop_func = lfunc; - t_loop = t_start = get_time(); - f_loop = f_start = 0; - ui_fps(0.0); -} - - -void -ui_fps(double fps) -{ - /* - char buf[256]; - - snprintf(buf, sizeof(buf), "ESCAPE - exit, FPS: %4.3f", fps); - if (o_byline) - eo_do(o_byline, evas_obj_text_text_set(buf)); - */ - p_fps = fps; } diff --git a/src/bin/ui.h b/src/bin/ui.h index b4236da..3f5a2b2 100644 --- a/src/bin/ui.h +++ b/src/bin/ui.h @@ -1,12 +1,27 @@ #ifndef UI_H #define UI_H -extern int async_render; +typedef struct _Menu_Item Menu_Item; +struct _Menu_Item +{ + Evas_Object *o_icon; + char *icon; + char *text; + void (*func) (void); -void ui_args(int argc, char **argv); -void ui_loop(void); + Eina_Bool test; +}; + +extern int async_render; +extern Eina_List *menu; +extern double weights[]; + +void ui_setup(unsigned int ui_w, unsigned int ui_h); +Eina_Bool ui_loop(void *data); void ui_menu(void); void ui_func_set(void (*kfunc) (char *key), void (*lfunc) (double t, int f)); void ui_fps(double fps); +void ui_num(int n); +void ui_all(void); #endif