forked from enlightenment/efl
parent
d559cdd4f5
commit
347c26ce53
|
@ -454,6 +454,44 @@ fi
|
|||
AC_SUBST(ecore_job_cflags)
|
||||
AC_SUBST(ecore_job_libs)
|
||||
|
||||
want_ecore_dfb="yes";
|
||||
have_ecore_dfb="no";
|
||||
ecore_dfb_cflags="";
|
||||
ecore_dfb_libs="";
|
||||
|
||||
AC_MSG_CHECKING(whether ecore_dfb module is to be built)
|
||||
|
||||
AC_ARG_ENABLE(ecore-dfb,
|
||||
[ --disable-ecore-dfb disable the ecore_dfb module],
|
||||
[
|
||||
if [ test "$enableval" = "yes" ]; then
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
want_ecore_dfb="no"
|
||||
fi
|
||||
], [
|
||||
AC_MSG_RESULT(yes)
|
||||
]
|
||||
)
|
||||
|
||||
if test "x$want_ecore_dfb" = "xyes"; then
|
||||
PKG_CHECK_MODULES(DIRECTFB, directfb >= 0.9.16,
|
||||
[
|
||||
AM_CONDITIONAL(BUILD_ECORE_DIRECTFB, true)
|
||||
AC_DEFINE(BUILD_ECORE_DIRECTFB, 1, [Build Ecore_DirectFB Module])
|
||||
have_ecore_dfb="yes"
|
||||
dnl ecore_dfb_libs="-lecore_fb";
|
||||
], [
|
||||
AM_CONDITIONAL(BUILD_ECORE_DIRECTFB, false)
|
||||
]
|
||||
)
|
||||
else
|
||||
AM_CONDITIONAL(BUILD_ECORE_DIRECTFB, false)
|
||||
fi
|
||||
AC_SUBST(ecore_dfb_cflags)
|
||||
AC_SUBST(ecore_dfb_libs)
|
||||
|
||||
want_ecore_fb="yes";
|
||||
have_ecore_fb="no";
|
||||
ecore_fb_cflags="";
|
||||
|
@ -618,6 +656,42 @@ else
|
|||
fi
|
||||
fi
|
||||
|
||||
want_ecore_evas_dfb="yes";
|
||||
have_ecore_evas_dfb="no";
|
||||
|
||||
AC_MSG_CHECKING(whether ecore_evas DirectFB support is to be built)
|
||||
AC_ARG_ENABLE(ecore-evas-dfb,
|
||||
[ --disable-ecore-evas-dfb disable DirectFB in the ecore_evas module],
|
||||
[
|
||||
if [ test "$enableval" = "yes" ]; then
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
want_ecore_evas_dfb="no"
|
||||
fi
|
||||
], [
|
||||
AC_MSG_RESULT(yes)
|
||||
]
|
||||
)
|
||||
|
||||
if test "x$want_ecore_evas_dfb" = "xyes"; then
|
||||
dnl AC_CHECK_HEADER(Evas_Engine_DirectFB.h,
|
||||
AC_CHECK_HEADER(Evas_Engine_Buffer.h,
|
||||
[
|
||||
AM_CONDITIONAL(BUILD_ECORE_EVAS_DIRECTFB, true)
|
||||
AC_DEFINE(BUILD_ECORE_EVAS_DIRECTFB, 1, [Support for DirectFB in Ecore_Evas])
|
||||
have_ecore_evas_dfb="yes"
|
||||
], [
|
||||
AM_CONDITIONAL(BUILD_ECORE_EVAS_DIRECTFB, false)
|
||||
], [
|
||||
#include <Evas.h>
|
||||
]
|
||||
)
|
||||
else
|
||||
AM_CONDITIONAL(BUILD_ECORE_EVAS_DIRECTFB, false)
|
||||
fi
|
||||
|
||||
|
||||
want_ecore_evas_fb="yes";
|
||||
have_ecore_evas_fb="no";
|
||||
|
||||
|
@ -1076,6 +1150,7 @@ src/lib/ecore_txt/Makefile
|
|||
src/lib/ecore_config/Makefile
|
||||
src/lib/ecore_file/Makefile
|
||||
src/lib/ecore_dbus/Makefile
|
||||
src/lib/ecore_directfb/Makefile
|
||||
examples/Makefile
|
||||
ecore-config
|
||||
README
|
||||
|
@ -1099,10 +1174,12 @@ echo " Ecore_Con....................: $have_ecore_con (OpenSSL: $use_openssl)"
|
|||
echo " Ecore_Txt....................: $have_ecore_txt"
|
||||
echo " Ecore_X......................: $have_ecore_x (Xcursor: $use_Xcursor) (Xprint: $use_Xprint) (Xinerama: $use_Xinerama) (Xrandr: $use_Xrandr)"
|
||||
echo " Ecore_FB.....................: $have_ecore_fb"
|
||||
echo " Ecore_DFB....................: $have_ecore_dfb"
|
||||
echo " Ecore_Evas...................: $have_ecore_evas"
|
||||
echo " Ecore_Evas GL Support........: $have_ecore_evas_gl"
|
||||
echo " Ecore_Evas XRender Support...: $have_ecore_evas_xrender"
|
||||
echo " Ecore_Evas FB Support........: $have_ecore_evas_fb"
|
||||
echo " Ecore_Evas DFB Support.......: $have_ecore_evas_dfb"
|
||||
echo " Ecore_Buffer.................: $have_ecore_evas_buffer"
|
||||
echo " Ecore_Ipc....................: $have_ecore_ipc (OpenSSL: $use_openssl)"
|
||||
echo " Ecore_Config.................: $have_ecore_config"
|
||||
|
|
|
@ -6,6 +6,12 @@ else
|
|||
ECORE_EVAS_LIB =
|
||||
endif
|
||||
|
||||
if BUILD_ECORE_DIRECTFB
|
||||
ECORE_DIRECTFB_LIB = $(top_builddir)/src/lib/ecore_directfb/libecore_directfb.la
|
||||
else
|
||||
ECORE_DIRECTFB_LIB =
|
||||
endif
|
||||
|
||||
if BUILD_ECORE_X
|
||||
ECORE_X_LIB = $(top_builddir)/src/lib/ecore_x/libecore_x.la
|
||||
else
|
||||
|
@ -51,6 +57,7 @@ endif
|
|||
INCLUDES = \
|
||||
-I$(top_srcdir)/src/lib/ecore \
|
||||
-I$(top_srcdir)/src/lib/ecore_evas \
|
||||
-I$(top_srcdir)/src/lib/ecore_directfb \
|
||||
-I$(top_srcdir)/src/lib/ecore_x \
|
||||
-I$(top_srcdir)/src/lib/ecore_fb \
|
||||
-I$(top_srcdir)/src/lib/ecore_job \
|
||||
|
@ -60,6 +67,7 @@ INCLUDES = \
|
|||
-I$(top_srcdir)/src/lib/ecore_config \
|
||||
-I$(top_builddir)/src/lib/ecore \
|
||||
-I$(top_builddir)/src/lib/ecore_evas \
|
||||
-I$(top_builddir)/src/lib/ecore_directfb \
|
||||
-I$(top_builddir)/src/lib/ecore_x \
|
||||
-I$(top_builddir)/src/lib/ecore_fb \
|
||||
-I$(top_builddir)/src/lib/ecore_job \
|
||||
|
|
|
@ -83,6 +83,13 @@ app_start(int argc, const char **argv)
|
|||
ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 240, 320);
|
||||
evas = ecore_evas_get(ee);
|
||||
}
|
||||
#endif
|
||||
#if HAVE_ECORE_EVAS_DIRECTFB
|
||||
else if ((argc > 1) && (!strcmp(argv[1], "-dfb")))
|
||||
{
|
||||
ee = ecore_evas_directfb_new(NULL, 0, 0, 0, 240, 320);
|
||||
evas = ecore_evas_get(ee);
|
||||
}
|
||||
#endif
|
||||
else if ((argc > 1) && (!strcmp(argv[1], "-buf")))
|
||||
{
|
||||
|
@ -116,11 +123,12 @@ app_start(int argc, const char **argv)
|
|||
{
|
||||
printf("%s -x Test ecore_evas in X (default)\n"
|
||||
"%s -gl Test ecore_evas in X GL\n"
|
||||
"%s -dfb Test ecore_evas in DirectFB\n"
|
||||
"%s -fb Test ecore_evas in the Framebuffer\n"
|
||||
"%s -buf Test ecore_evas in the Buffer\n"
|
||||
"%s -buf2 Test ecore_evas in the Image Buffer\n"
|
||||
"%s -h Display this help\n",
|
||||
argv[0], argv[0], argv[0], argv[0], argv[0], argv[0]);
|
||||
argv[0], argv[0], argv[0], argv[0], argv[0], argv[0], argv[0]);
|
||||
ecore_evas_shutdown();
|
||||
ecore_shutdown();
|
||||
return 0;
|
||||
|
|
|
@ -4,10 +4,11 @@ ecore \
|
|||
ecore_job \
|
||||
ecore_txt \
|
||||
ecore_fb \
|
||||
ecore_directfb \
|
||||
ecore_con \
|
||||
ecore_x \
|
||||
ecore_ipc \
|
||||
ecore_evas \
|
||||
ecore_config \
|
||||
ecore_file \
|
||||
ecore_dbus
|
||||
ecore_dbus
|
||||
|
|
|
@ -316,7 +316,7 @@ static int
|
|||
_ecore_hash_add_node(Ecore_Hash *hash, Ecore_Hash_Node *node)
|
||||
{
|
||||
unsigned int hash_val;
|
||||
|
||||
|
||||
CHECK_PARAM_POINTER_RETURN("hash", hash, FALSE);
|
||||
CHECK_PARAM_POINTER_RETURN("node", node, FALSE);
|
||||
|
||||
|
@ -326,8 +326,7 @@ _ecore_hash_add_node(Ecore_Hash *hash, Ecore_Hash_Node *node)
|
|||
|
||||
/* Compute the position in the table */
|
||||
if (!hash->hash_func)
|
||||
hash_val = (unsigned int)node->key %
|
||||
ecore_prime_table[hash->size];
|
||||
hash_val = (unsigned int)node->key % ecore_prime_table[hash->size];
|
||||
else
|
||||
hash_val = ECORE_COMPUTE_HASH(hash, node->key);
|
||||
|
||||
|
@ -392,7 +391,7 @@ void *ecore_hash_remove(Ecore_Hash *hash, void *key)
|
|||
|
||||
/* Compute the position in the table */
|
||||
if (!hash->hash_func)
|
||||
hash_val = (unsigned int)key % ecore_prime_table[hash->size];
|
||||
hash_val = (unsigned int )key % ecore_prime_table[hash->size];
|
||||
else
|
||||
hash_val = ECORE_COMPUTE_HASH(hash, key);
|
||||
|
||||
|
@ -453,7 +452,7 @@ _ecore_hash_get_node(Ecore_Hash *hash, void *key)
|
|||
|
||||
/* Compute the position in the table */
|
||||
if (!hash->hash_func)
|
||||
hash_val = (unsigned int)key % ecore_prime_table[hash->size];
|
||||
hash_val = (unsigned int )key % ecore_prime_table[hash->size];
|
||||
else
|
||||
hash_val = ECORE_COMPUTE_HASH(hash, key);
|
||||
|
||||
|
|
|
@ -0,0 +1,182 @@
|
|||
#ifndef _ECORE_DIRECTFB_H
|
||||
#define _ECORE_DIRECTFB_H
|
||||
|
||||
#ifdef EAPI
|
||||
#undef EAPI
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
# ifdef BUILDING_DLL
|
||||
# define EAPI __declspec(dllexport)
|
||||
# else
|
||||
# define EAPI __declspec(dllimport)
|
||||
# endif
|
||||
#else
|
||||
# ifdef GCC_HASCLASSVISIBILITY
|
||||
# define EAPI __attribute__ ((visibility("default")))
|
||||
# else
|
||||
# define EAPI
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <Ecore_Data.h>
|
||||
#include "directfb.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int ECORE_DIRECTFB_EVENT_POSITION;
|
||||
extern int ECORE_DIRECTFB_EVENT_SIZE;
|
||||
extern int ECORE_DIRECTFB_EVENT_CLOSE;
|
||||
extern int ECORE_DIRECTFB_EVENT_DESTROYED;
|
||||
extern int ECORE_DIRECTFB_EVENT_GOT_FOCUS;
|
||||
extern int ECORE_DIRECTFB_EVENT_LOST_FOCUS;
|
||||
extern int ECORE_DIRECTFB_EVENT_KEY_DOWN;
|
||||
extern int ECORE_DIRECTFB_EVENT_KEY_UP;
|
||||
extern int ECORE_DIRECTFB_EVENT_BUTTON_DOWN;
|
||||
extern int ECORE_DIRECTFB_EVENT_BUTTON_UP;
|
||||
extern int ECORE_DIRECTFB_EVENT_MOTION;
|
||||
extern int ECORE_DIRECTFB_EVENT_ENTER;
|
||||
extern int ECORE_DIRECTFB_EVENT_LEAVE;
|
||||
extern int ECORE_DIRECTFB_EVENT_WHEEL;
|
||||
|
||||
|
||||
|
||||
#ifdnef _ECORE_DIRECTFB_WINDOW_PREDEF
|
||||
typedef struct _Ecore_DirectFB_Window Ecore_DirectFB_Window;
|
||||
#endif
|
||||
typedef struct _Ecore_DirectFB_Cursor Ecore_DirectFB_Cursor;
|
||||
|
||||
typedef struct _Ecore_DirectFB_Event_Key_Down Ecore_DirectFB_Event_Key_Down;
|
||||
typedef struct _Ecore_DirectFB_Event_Key_Up Ecore_DirectFB_Event_Key_Up;
|
||||
typedef struct _Ecore_DirectFB_Event_Button_Down Ecore_DirectFB_Event_Button_Down;
|
||||
typedef struct _Ecore_DirectFB_Event_Button_Up Ecore_DirectFB_Event_Button_Up;
|
||||
typedef struct _Ecore_DirectFB_Event_Motion Ecore_DirectFB_Event_Motion;
|
||||
typedef struct _Ecore_DirectFB_Event_Enter Ecore_DirectFB_Event_Enter;
|
||||
typedef struct _Ecore_DirectFB_Event_Leave Ecore_DirectFB_Event_Leave;
|
||||
typedef struct _Ecore_DirectFB_Event_Wheel Ecore_DirectFB_Event_Wheel;
|
||||
typedef struct _Ecore_DirectFB_Event_Got_Focus Ecore_DirectFB_Event_Got_Focus;
|
||||
typedef struct _Ecore_DirectFB_Event_Lost_Focus Ecore_DirectFB_Event_Lost_Focus;
|
||||
|
||||
|
||||
/* this struct is to keep windows data (id, window itself and surface) in memory as every call
|
||||
* to DirectFB for this values (e.g window->GetSurface(window,&surface)) will increment the
|
||||
* reference count, then we will have to release N times the data, so better we just ask for
|
||||
them once */
|
||||
struct _Ecore_DirectFB_Window
|
||||
{
|
||||
DFBWindowID id;
|
||||
IDirectFBWindow *window;
|
||||
IDirectFBSurface *surface;
|
||||
Ecore_DirectFB_Cursor *cursor;
|
||||
|
||||
};
|
||||
|
||||
struct _Ecore_DirectFB_Cursor
|
||||
{
|
||||
IDirectFBSurface *surface;
|
||||
int hot_x;
|
||||
int hot_y;
|
||||
|
||||
};
|
||||
|
||||
struct _Ecore_DirectFB_Event_Key_Down /** DirectFB Key Down event */
|
||||
{
|
||||
char *keyname; /**< The name of the key that was released */
|
||||
char *keysymbol; /**< The logical symbol of the key that was pressed */
|
||||
char *key_compose; /**< The UTF-8 string conversion if any */
|
||||
unsigned int time;
|
||||
DFBWindowID win;
|
||||
};
|
||||
|
||||
struct _Ecore_DirectFB_Event_Key_Up /** DirectFB Key Up event */
|
||||
{
|
||||
char *keyname; /**< The name of the key that was released */
|
||||
char *keysymbol; /**< The logical symbol of the key that was pressed */
|
||||
char *key_compose; /**< The UTF-8 string conversion if any */
|
||||
unsigned int time;
|
||||
DFBWindowID win;
|
||||
};
|
||||
|
||||
struct _Ecore_DirectFB_Event_Button_Down
|
||||
{
|
||||
int button;
|
||||
int modifiers;
|
||||
int x, y;
|
||||
unsigned int time;
|
||||
int double_click : 1;
|
||||
int triple_click : 1;
|
||||
DFBWindowID win;
|
||||
};
|
||||
struct _Ecore_DirectFB_Event_Button_Up
|
||||
{
|
||||
int button;
|
||||
int modifiers;
|
||||
int x, y;
|
||||
unsigned int time;
|
||||
DFBWindowID win;
|
||||
};
|
||||
struct _Ecore_DirectFB_Event_Motion
|
||||
{
|
||||
int modifiers;
|
||||
int x, y;
|
||||
unsigned int time;
|
||||
DFBWindowID win;
|
||||
};
|
||||
|
||||
struct _Ecore_DirectFB_Event_Enter
|
||||
{
|
||||
int modifiers;
|
||||
int x, y;
|
||||
unsigned int time;
|
||||
DFBWindowID win;
|
||||
};
|
||||
|
||||
struct _Ecore_DirectFB_Event_Leave
|
||||
{
|
||||
int modifiers;
|
||||
int x, y;
|
||||
unsigned int time;
|
||||
DFBWindowID win;
|
||||
};
|
||||
|
||||
struct _Ecore_DirectFB_Event_Wheel
|
||||
{
|
||||
int direction;
|
||||
int z;
|
||||
int modifiers;
|
||||
unsigned int time;
|
||||
DFBWindowID win;
|
||||
};
|
||||
|
||||
struct _Ecore_DirectFB_Event_Got_Focus
|
||||
{
|
||||
unsigned int time;
|
||||
DFBWindowID win;
|
||||
};
|
||||
|
||||
struct _Ecore_DirectFB_Event_Lost_Focus
|
||||
{
|
||||
unsigned int time;
|
||||
DFBWindowID win;
|
||||
};
|
||||
|
||||
/* main functions */
|
||||
EAPI int ecore_directfb_init(const char *name);
|
||||
EAPI int ecore_directfb_shutdown(void);
|
||||
EAPI IDirectFB * ecore_directfb_interface_get(void);
|
||||
/* window operations */
|
||||
EAPI Ecore_DirectFB_Window * ecore_directfb_window_new(int x, int y, int w, int h);
|
||||
EAPI void ecore_directfb_window_del(Ecore_DirectFB_Window *window);
|
||||
EAPI void ecore_directfb_window_move(Ecore_DirectFB_Window *window, int x, int y);
|
||||
EAPI void ecore_directfb_window_resize(Ecore_DirectFB_Window *window, int w, int h);
|
||||
EAPI void ecore_directfb_window_focus(Ecore_DirectFB_Window *window);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,33 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
INCLUDES = \
|
||||
-I$(top_srcdir)/src/lib/ecore \
|
||||
-I$(top_builddir)/src/lib/ecore \
|
||||
@DIRECTFB_CFLAGS@
|
||||
|
||||
libecore_directfb_la_LDFLAGS = -version-info 1:0:0 \
|
||||
-L$(top_builddir)/src/lib/ecore/.libs
|
||||
|
||||
if BUILD_ECORE_DIRECTFB
|
||||
|
||||
lib_LTLIBRARIES = libecore_directfb.la
|
||||
include_HEADERS = \
|
||||
Ecore_DirectFB.h
|
||||
|
||||
libecore_directfb_la_SOURCES = \
|
||||
ecore_directfb.c \
|
||||
ecore_directfb_private.h
|
||||
|
||||
libecore_directfb_la_LIBADD = \
|
||||
$(top_builddir)/src/lib/ecore/libecore.la \
|
||||
@DIRECTFB_LIBS@
|
||||
|
||||
libecore_directfb_la_DEPENDENCIES = \
|
||||
$(top_builddir)/src/lib/ecore/libecore.la
|
||||
|
||||
endif
|
||||
|
||||
EXTRA_DIST = \
|
||||
Ecore_DirectFB.h \
|
||||
ecore_directfb.c \
|
||||
ecore_directfb_private.h
|
|
@ -0,0 +1,735 @@
|
|||
#include "ecore_private.h"
|
||||
#include "Ecore_DirectFB.h"
|
||||
#include "ecore_directfb_private.h"
|
||||
#include "ecore_directfb_keys.h"
|
||||
#include "Ecore.h"
|
||||
|
||||
/* ecore_directfb */
|
||||
/******************/
|
||||
/* About */
|
||||
/* with this you can create windows of directfb and handle events through ecore */
|
||||
|
||||
static int _ecore_directfb_key_symbols_count = sizeof(_ecore_directfb_key_symbols)/sizeof(Ecore_DirectFB_Key_Symbols);
|
||||
static int _ecore_directfb_init_count = 0;
|
||||
|
||||
static int _window_event_fd = 0;
|
||||
static int _input_event_fd = 0;
|
||||
|
||||
static int _ecore_directfb_fullscreen_window_id = 0;
|
||||
static int _cursor_x = 0;
|
||||
static int _cursor_y = 0;
|
||||
|
||||
int ECORE_DIRECTFB_EVENT_POSITION = 0;
|
||||
int ECORE_DIRECTFB_EVENT_SIZE = 0;
|
||||
int ECORE_DIRECTFB_EVENT_CLOSE = 0;
|
||||
int ECORE_DIRECTFB_EVENT_DESTROYED = 0;
|
||||
int ECORE_DIRECTFB_EVENT_GOT_FOCUS = 0;
|
||||
int ECORE_DIRECTFB_EVENT_LOST_FOCUS = 0;
|
||||
int ECORE_DIRECTFB_EVENT_KEY_DOWN = 0;
|
||||
int ECORE_DIRECTFB_EVENT_KEY_UP = 0;
|
||||
int ECORE_DIRECTFB_EVENT_BUTTON_DOWN = 0;
|
||||
int ECORE_DIRECTFB_EVENT_BUTTON_UP = 0;
|
||||
int ECORE_DIRECTFB_EVENT_MOTION = 0;
|
||||
int ECORE_DIRECTFB_EVENT_ENTER = 0;
|
||||
int ECORE_DIRECTFB_EVENT_LEAVE = 0;
|
||||
int ECORE_DIRECTFB_EVENT_WHEEL = 0;
|
||||
|
||||
|
||||
static int _ecore_directfb_event_fd_handler(void *data, Ecore_Fd_Handler *fd_handler);
|
||||
|
||||
static Ecore_Fd_Handler *_window_event_fd_handler_handle = NULL;
|
||||
static Ecore_Fd_Handler *_input_event_fd_handler_handle = NULL;
|
||||
|
||||
/* this hash is to store all the possible key names for fast lookup */
|
||||
static Ecore_Hash *_ecore_directfb_key_symbols_hash = NULL;
|
||||
|
||||
|
||||
static IDirectFB *_dfb = NULL; // the main interface
|
||||
static IDirectFBEventBuffer *_window_event; // the main event buffer (all windows are attached to this)
|
||||
static IDirectFBEventBuffer *_input_event; // the main event buffer (all windows are attached to this)
|
||||
static IDirectFBDisplayLayer *_layer; // the main layer
|
||||
static DFBResult _err; // usefull for DFBCHECK
|
||||
|
||||
|
||||
/*******************/
|
||||
/* local functions */
|
||||
/*******************/
|
||||
|
||||
/* free ecore directfb events functions */
|
||||
/****************************************/
|
||||
|
||||
static void
|
||||
_ecore_directfb_event_free_key_down(void *data __UNUSED__, void *ev)
|
||||
{
|
||||
Ecore_DirectFB_Event_Key_Up *e;
|
||||
|
||||
e = ev;
|
||||
free(e->keyname);
|
||||
if (e->keysymbol) free(e->keysymbol);
|
||||
if (e->key_compose) free(e->key_compose);
|
||||
free(e);
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_directfb_event_free_key_up(void *data __UNUSED__, void *ev)
|
||||
{
|
||||
Ecore_DirectFB_Event_Key_Up *e;
|
||||
|
||||
e = ev;
|
||||
free(e->keyname);
|
||||
if (e->keysymbol) free(e->keysymbol);
|
||||
if (e->key_compose) free(e->key_compose);
|
||||
free(e);
|
||||
}
|
||||
|
||||
|
||||
/* helpers */
|
||||
/***********/
|
||||
int
|
||||
_ecore_directfb_hash_compare(void *key1, void *key2)
|
||||
{
|
||||
if(*(unsigned int*)key1 == *(unsigned int*)key2)
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
unsigned int _ecore_directfb_hash_create(void *key)
|
||||
{
|
||||
return *(unsigned int*)key % ecore_prime_table[_ecore_directfb_key_symbols_hash->size];
|
||||
}
|
||||
|
||||
|
||||
/* directfb window input events handler */
|
||||
/****************************************/
|
||||
|
||||
static void
|
||||
_ecore_directfb_event_handle_motion(DFBEvent *evt)
|
||||
{
|
||||
|
||||
Ecore_DirectFB_Event_Motion *e;
|
||||
e = calloc(1, sizeof(Ecore_DirectFB_Event_Motion));
|
||||
|
||||
switch(evt->clazz)
|
||||
{
|
||||
case DFEC_INPUT:
|
||||
e->modifiers = 0;
|
||||
switch(evt->input.axis)
|
||||
{
|
||||
case DIAI_X:
|
||||
e->x = _cursor_x = evt->input.axisabs;
|
||||
e->y = _cursor_y;
|
||||
break;
|
||||
case DIAI_Y:
|
||||
e->y = _cursor_y = evt->input.axisabs;
|
||||
e->x = _cursor_x;
|
||||
break;
|
||||
case DIAI_Z:
|
||||
//_ecore_directfb_event_handle_wheel(evt);
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
e->win = _ecore_directfb_fullscreen_window_id;
|
||||
e->time = 0;
|
||||
break;
|
||||
|
||||
case DFEC_WINDOW:
|
||||
e->modifiers = 0;
|
||||
e->x = evt->window.x;
|
||||
e->y = evt->window.y;
|
||||
e->win = evt->window.window_id;
|
||||
e->time = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ecore_event_add(ECORE_DIRECTFB_EVENT_MOTION, e, NULL, NULL);
|
||||
}
|
||||
static void
|
||||
_ecore_directfb_event_handle_key_down(DFBEvent *evt)
|
||||
{
|
||||
|
||||
Ecore_DirectFB_Event_Key_Down *e;
|
||||
unsigned int key_symbol;
|
||||
char *key_name;
|
||||
|
||||
e = calloc(1, sizeof(Ecore_DirectFB_Event_Key_Down));
|
||||
|
||||
switch(evt->clazz)
|
||||
{
|
||||
case DFEC_INPUT:
|
||||
key_symbol = evt->input.key_symbol;
|
||||
key_name = ecore_hash_get(_ecore_directfb_key_symbols_hash, &key_symbol);
|
||||
|
||||
if(!key_name)
|
||||
{
|
||||
printf("error en el numero, %0X\n", evt->input.key_symbol);
|
||||
return;
|
||||
}
|
||||
e->keyname = strdup(key_name);
|
||||
e->keysymbol = strdup(key_name);
|
||||
e->key_compose = NULL;
|
||||
e->win = _ecore_directfb_fullscreen_window_id;
|
||||
e->time = 0;
|
||||
break;
|
||||
|
||||
case DFEC_WINDOW:
|
||||
key_symbol = evt->window.key_symbol;
|
||||
key_name = ecore_hash_get(_ecore_directfb_key_symbols_hash, &key_symbol);
|
||||
|
||||
if(!key_name)
|
||||
{
|
||||
printf("error en el numero, %0X\n", evt->window.key_symbol);
|
||||
return;
|
||||
}
|
||||
e->keyname = strdup(key_name);
|
||||
e->keysymbol = strdup(key_name);
|
||||
e->key_compose = NULL;
|
||||
e->win = evt->window.window_id;
|
||||
e->time = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
ecore_event_add(ECORE_DIRECTFB_EVENT_KEY_DOWN, e, _ecore_directfb_event_free_key_down, NULL);
|
||||
}
|
||||
static void
|
||||
_ecore_directfb_event_handle_key_up(DFBEvent *evt)
|
||||
{
|
||||
Ecore_DirectFB_Event_Key_Up *e;
|
||||
unsigned int key_symbol;
|
||||
char *key_name;
|
||||
|
||||
e = calloc(1, sizeof(Ecore_DirectFB_Event_Key_Up));
|
||||
|
||||
switch(evt->clazz)
|
||||
{
|
||||
case DFEC_INPUT:
|
||||
key_symbol = evt->input.key_symbol;
|
||||
key_name = ecore_hash_get(_ecore_directfb_key_symbols_hash, &key_symbol);
|
||||
|
||||
if(!key_name)
|
||||
{
|
||||
printf("error en el numero, %0X\n", evt->input.key_symbol);
|
||||
return;
|
||||
}
|
||||
e->keyname = strdup(key_name);
|
||||
e->keysymbol = strdup(key_name);
|
||||
e->key_compose = NULL;
|
||||
e->win = _ecore_directfb_fullscreen_window_id;
|
||||
e->time = 0;
|
||||
break;
|
||||
|
||||
case DFEC_WINDOW:
|
||||
key_symbol = evt->window.key_symbol;
|
||||
key_name = ecore_hash_get(_ecore_directfb_key_symbols_hash, &key_symbol);
|
||||
|
||||
if(!key_name)
|
||||
{
|
||||
printf("error en el numero, %0X\n", evt->window.key_symbol);
|
||||
return;
|
||||
}
|
||||
e->keyname = strdup(key_name);
|
||||
e->keysymbol = strdup(key_name);
|
||||
e->key_compose = NULL;
|
||||
e->win = evt->window.window_id;
|
||||
e->time = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ecore_event_add(ECORE_DIRECTFB_EVENT_KEY_UP, e, _ecore_directfb_event_free_key_up, NULL);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_directfb_event_handle_button_down(DFBEvent *evt)
|
||||
{
|
||||
Ecore_DirectFB_Event_Button_Down *e;
|
||||
e = calloc(1, sizeof(Ecore_DirectFB_Event_Button_Down));
|
||||
|
||||
switch(evt->clazz)
|
||||
{
|
||||
case DFEC_INPUT:
|
||||
e->button = evt->input.button + 1;
|
||||
e->modifiers = 0;
|
||||
DFBCHECK(_layer->GetCursorPosition(_layer,&e->x,&e->y));
|
||||
e->x = _cursor_x;
|
||||
e->y = _cursor_y;
|
||||
e->win = _ecore_directfb_fullscreen_window_id;
|
||||
e->time = 0;
|
||||
|
||||
break;
|
||||
|
||||
case DFEC_WINDOW:
|
||||
e->button = evt->window.button + 1;
|
||||
e->modifiers = 0;
|
||||
e->x = evt->window.x;
|
||||
e->y = evt->window.y;
|
||||
e->win = evt->window.window_id;
|
||||
e->time = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
ecore_event_add(ECORE_DIRECTFB_EVENT_BUTTON_DOWN, e, NULL, NULL);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_directfb_event_handle_button_up(DFBEvent *evt)
|
||||
{
|
||||
Ecore_DirectFB_Event_Button_Up *e;
|
||||
e = calloc(1, sizeof(Ecore_DirectFB_Event_Button_Up));
|
||||
|
||||
switch(evt->clazz)
|
||||
{
|
||||
case DFEC_INPUT:
|
||||
e->button = evt->input.button + 1;
|
||||
e->modifiers = 0;
|
||||
e->x = _cursor_x;
|
||||
e->y = _cursor_y;
|
||||
e->win = _ecore_directfb_fullscreen_window_id;
|
||||
e->time = 0;
|
||||
|
||||
break;
|
||||
|
||||
case DFEC_WINDOW:
|
||||
e->button = evt->window.button + 1;
|
||||
e->modifiers = 0;
|
||||
e->x = evt->window.x;
|
||||
e->y = evt->window.y;
|
||||
e->win = evt->window.window_id;
|
||||
e->time = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ecore_event_add(ECORE_DIRECTFB_EVENT_BUTTON_UP, e, NULL, NULL);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_directfb_event_handle_enter(DFBWindowEvent *evt)
|
||||
{
|
||||
Ecore_DirectFB_Event_Enter *e;
|
||||
e = calloc(1, sizeof(Ecore_DirectFB_Event_Enter));
|
||||
|
||||
e->modifiers = 0;
|
||||
e->x = evt->x;
|
||||
e->y = evt->y;
|
||||
e->win = evt->window_id;
|
||||
e->time = 0;
|
||||
|
||||
ecore_event_add(ECORE_DIRECTFB_EVENT_ENTER, e, NULL, NULL);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_directfb_event_handle_leave(DFBWindowEvent *evt)
|
||||
{
|
||||
Ecore_DirectFB_Event_Leave *e;
|
||||
e = calloc(1, sizeof(Ecore_DirectFB_Event_Leave));
|
||||
|
||||
e->modifiers = 0;
|
||||
e->x = evt->x;
|
||||
e->y = evt->y;
|
||||
e->win = evt->window_id;
|
||||
e->time = 0;
|
||||
|
||||
ecore_event_add(ECORE_DIRECTFB_EVENT_LEAVE, e, NULL, NULL);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_directfb_event_handle_wheel(DFBWindowEvent *evt)
|
||||
{
|
||||
Ecore_DirectFB_Event_Wheel *e;
|
||||
e = calloc(1, sizeof(Ecore_DirectFB_Event_Wheel));
|
||||
|
||||
// currently there's no direction (only up/down);
|
||||
e->direction = 0;
|
||||
e->z = evt->step;
|
||||
e->modifiers = 0;
|
||||
e->win = evt->window_id;
|
||||
e->time = 0;
|
||||
|
||||
ecore_event_add(ECORE_DIRECTFB_EVENT_WHEEL, e, NULL, NULL);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_directfb_event_handle_got_focus(DFBWindowEvent *evt)
|
||||
{
|
||||
Ecore_DirectFB_Event_Got_Focus *e;
|
||||
e = calloc(1, sizeof(Ecore_DirectFB_Event_Got_Focus));
|
||||
|
||||
e->win = evt->window_id;
|
||||
e->time = 0;
|
||||
|
||||
ecore_event_add(ECORE_DIRECTFB_EVENT_GOT_FOCUS, e, NULL, NULL);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_directfb_event_handle_lost_focus(DFBWindowEvent *evt)
|
||||
{
|
||||
Ecore_DirectFB_Event_Lost_Focus *e;
|
||||
e = calloc(1, sizeof(Ecore_DirectFB_Event_Lost_Focus));
|
||||
|
||||
e->win = evt->window_id;
|
||||
e->time = 0;
|
||||
|
||||
ecore_event_add(ECORE_DIRECTFB_EVENT_LOST_FOCUS, e, NULL, NULL);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* inputs and windows fds handlers */
|
||||
/***********************************/
|
||||
/* TODO fix this to handle windows and input events (fullscreen/window mode)
|
||||
* in fullscreen theres no window_id so get the id from a global var (only one fullscreen
|
||||
* window at a time */
|
||||
|
||||
|
||||
static int
|
||||
_ecore_directfb_input_event_fd_handler(void *data __UNUSED__,Ecore_Fd_Handler *fd_handler __UNUSED__)
|
||||
{
|
||||
DFBEvent evt;
|
||||
int v = 0;
|
||||
|
||||
v = read(_input_event_fd, &evt, sizeof(DFBEvent));
|
||||
if (v < 0) return 1;
|
||||
if (v < 1) return 1;
|
||||
|
||||
/* we are getting duplicate events, only parse if we are in fullscreen */
|
||||
//if(_ecore_directfb_fullscreen_window_id == 0) break;
|
||||
if(evt.input.type == DIET_KEYPRESS)
|
||||
_ecore_directfb_event_handle_key_down(&evt);
|
||||
if(evt.input.type == DIET_KEYRELEASE)
|
||||
_ecore_directfb_event_handle_key_up(&evt);
|
||||
if(evt.input.type == DIET_BUTTONPRESS)
|
||||
_ecore_directfb_event_handle_button_down(&evt);
|
||||
if(evt.input.type == DIET_BUTTONRELEASE)
|
||||
_ecore_directfb_event_handle_button_up(&evt);
|
||||
if(evt.input.type == DIET_AXISMOTION)
|
||||
_ecore_directfb_event_handle_motion(&evt);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_ecore_directfb_window_event_fd_handler(void *data __UNUSED__,Ecore_Fd_Handler *fd_handler __UNUSED__)
|
||||
{
|
||||
DFBEvent evt;
|
||||
int v = 0;
|
||||
|
||||
v = read(_window_event_fd, &evt, sizeof(DFBEvent));
|
||||
if (v < 0) return 1;
|
||||
if (v < 1) return 1;
|
||||
|
||||
if(evt.window.type & DWET_POSITION)
|
||||
printf("position\n");
|
||||
if(evt.window.type & DWET_SIZE)
|
||||
printf("size\n");
|
||||
if(evt.window.type & DWET_CLOSE)
|
||||
printf("close\n");
|
||||
if(evt.window.type & DWET_DESTROYED)
|
||||
printf("destroyed\n");
|
||||
if(evt.window.type & DWET_GOTFOCUS)
|
||||
_ecore_directfb_event_handle_got_focus(&evt.window);
|
||||
if(evt.window.type & DWET_LOSTFOCUS)
|
||||
_ecore_directfb_event_handle_lost_focus(&evt.window);
|
||||
if(evt.window.type & DWET_KEYDOWN)
|
||||
_ecore_directfb_event_handle_key_down(&evt);
|
||||
if(evt.window.type & DWET_KEYUP)
|
||||
_ecore_directfb_event_handle_key_up(&evt);
|
||||
if(evt.window.type & DWET_BUTTONDOWN)
|
||||
_ecore_directfb_event_handle_button_down(&evt);
|
||||
if(evt.window.type & DWET_BUTTONUP)
|
||||
_ecore_directfb_event_handle_button_up(&evt);
|
||||
if(evt.window.type & DWET_MOTION)
|
||||
_ecore_directfb_event_handle_motion(&evt);
|
||||
if(evt.window.type & DWET_ENTER)
|
||||
_ecore_directfb_event_handle_enter(&evt.window);
|
||||
if(evt.window.type & DWET_LEAVE)
|
||||
_ecore_directfb_event_handle_leave(&evt.window);
|
||||
if(evt.window.type & DWET_WHEEL)
|
||||
_ecore_directfb_event_handle_wheel(&evt.window);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* api functions */
|
||||
/*****************/
|
||||
|
||||
|
||||
IDirectFB *
|
||||
ecore_directfb_interface_get(void)
|
||||
{
|
||||
return _dfb;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Ecore_DirectFB_Window *
|
||||
ecore_directfb_window_new(int x, int y, int w, int h)
|
||||
{
|
||||
Ecore_DirectFB_Window *window;
|
||||
IDirectFBWindow *dfb_window;
|
||||
IDirectFBSurface *dfb_surface = NULL;
|
||||
DFBWindowDescription desc;
|
||||
DFBWindowID id;
|
||||
|
||||
memset(&desc, 0, sizeof(DFBWindowDescription));
|
||||
desc.flags = (DWDESC_POSX | DWDESC_POSY | DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_CAPS);
|
||||
desc.posx = x;
|
||||
desc.posy = y;
|
||||
desc.width = w;
|
||||
desc.height = h;
|
||||
desc.caps = DWCAPS_ALPHACHANNEL;
|
||||
|
||||
DFBCHECK(_layer->CreateWindow(_layer, &desc, &dfb_window));
|
||||
|
||||
dfb_window->AttachEventBuffer(dfb_window, _window_event);
|
||||
dfb_window->SetOptions(dfb_window,DWOP_NONE);
|
||||
dfb_window->SetOpacity(dfb_window, 0xFF);
|
||||
|
||||
DFBCHECK(dfb_window->GetID(dfb_window, &id));
|
||||
DFBCHECK(dfb_window->GetSurface(dfb_window,&dfb_surface));
|
||||
|
||||
window = malloc(sizeof(Ecore_DirectFB_Window));
|
||||
window->id = id;
|
||||
window->window = dfb_window;
|
||||
window->surface = dfb_surface;
|
||||
window->cursor = NULL;
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
void
|
||||
ecore_directfb_window_del(Ecore_DirectFB_Window *ecore_window)
|
||||
{
|
||||
DFBCHECK(ecore_window->surface->Release(ecore_window->surface));
|
||||
DFBCHECK(ecore_window->window->Release(ecore_window->window));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ecore_directfb_window_move(Ecore_DirectFB_Window *ecore_window, int x, int y)
|
||||
{
|
||||
DFBCHECK(ecore_window->window->MoveTo(ecore_window->window, x, y));
|
||||
}
|
||||
|
||||
void
|
||||
ecore_directfb_window_resize(Ecore_DirectFB_Window *ecore_window, int w, int h)
|
||||
{
|
||||
DFBCHECK(ecore_window->window->Resize(ecore_window->window, w, h));
|
||||
}
|
||||
|
||||
void
|
||||
ecore_directfb_window_focus(Ecore_DirectFB_Window *ecore_window)
|
||||
{
|
||||
DFBCHECK(ecore_window->window->RequestFocus(ecore_window->window));
|
||||
}
|
||||
|
||||
void
|
||||
ecore_directfb_window_hide(Ecore_DirectFB_Window *ecore_window)
|
||||
{
|
||||
DFBCHECK(ecore_window->window->SetOpacity(ecore_window->window,0));
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
ecore_directfb_window_show(Ecore_DirectFB_Window *ecore_window)
|
||||
{
|
||||
DFBCHECK(ecore_window->window->SetOpacity(ecore_window->window, 0xFF));
|
||||
}
|
||||
|
||||
void
|
||||
ecore_directfb_window_shaped_set(Ecore_DirectFB_Window *ecore_window, int set)
|
||||
{
|
||||
DFBWindowOptions opts;
|
||||
|
||||
DFBCHECK(ecore_window->window->GetOptions(ecore_window->window, &opts));
|
||||
if(set)
|
||||
{
|
||||
opts |= DWOP_SHAPED;
|
||||
opts |= DWOP_ALPHACHANNEL;
|
||||
DFBCHECK(ecore_window->window->SetOptions(ecore_window->window, opts));
|
||||
}
|
||||
else
|
||||
{
|
||||
opts &= ~DWOP_SHAPED;
|
||||
opts &= ~DWOP_ALPHACHANNEL;
|
||||
DFBCHECK(ecore_window->window->SetOptions(ecore_window->window, opts));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ecore_directfb_window_cursor_show(Ecore_DirectFB_Window *ecore_window, int show)
|
||||
{
|
||||
if(!show)
|
||||
{
|
||||
/* create an empty cursor and set it */
|
||||
IDirectFBSurface *cursor;
|
||||
DFBSurfaceDescription desc;
|
||||
|
||||
memset(&desc, 0, sizeof(DFBSurfaceDescription));
|
||||
desc.flags = (DSDESC_HEIGHT | DSDESC_WIDTH | DSDESC_PIXELFORMAT);
|
||||
desc.width = 1;
|
||||
desc.height = 1;
|
||||
desc.pixelformat = DSPF_A1;
|
||||
|
||||
DFBCHECK(_dfb->CreateSurface(_dfb,&desc,&cursor));
|
||||
DFBCHECK(cursor->Clear(cursor,0,0,0,0));
|
||||
DFBCHECK(ecore_window->window->SetCursorShape(ecore_window->window, cursor, 0, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* we already have a cursor surface so set it*/
|
||||
if(ecore_window->cursor)
|
||||
{
|
||||
DFBCHECK(ecore_window->window->SetCursorShape(ecore_window->window, ecore_window->cursor->surface, ecore_window->cursor->hot_x, ecore_window->cursor->hot_y));
|
||||
}
|
||||
/* or just set the default directfb cursor */
|
||||
else
|
||||
{
|
||||
DFBCHECK(ecore_window->window->SetCursorShape(ecore_window->window, NULL, 0, 0));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ecore_directfb_window_cursor_set(Ecore_DirectFB_Window *ecore_window, Ecore_DirectFB_Cursor *cursor)
|
||||
{
|
||||
if( (!cursor) && (ecore_window->cursor))
|
||||
{
|
||||
ecore_window->cursor = NULL;
|
||||
DFBCHECK(ecore_window->window->SetCursorShape(ecore_window->window, NULL, 0, 0));
|
||||
return;
|
||||
}
|
||||
if(cursor)
|
||||
{
|
||||
ecore_window->cursor = cursor;
|
||||
DFBCHECK(ecore_window->window->SetCursorShape(ecore_window->window, cursor->surface, cursor->hot_x, cursor->hot_y));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
ecore_directfb_window_fullscreen_set(Ecore_DirectFB_Window *ecore_window, int on)
|
||||
{
|
||||
// always release the surface (we are going to get a new one in both cases)
|
||||
DFBCHECK(ecore_window->surface->Release(ecore_window->surface));
|
||||
if(on)
|
||||
{
|
||||
DFBCHECK(_layer->SetCooperativeLevel(_layer,DLSCL_EXCLUSIVE));
|
||||
DFBCHECK(_layer->GetSurface(_layer,&ecore_window->surface));
|
||||
DFBCHECK(_dfb->CreateInputEventBuffer(_dfb, DICAPS_ALL, DFB_FALSE, &_input_event));
|
||||
DFBCHECK(_input_event->CreateFileDescriptor(_input_event,&_input_event_fd));
|
||||
/* the event of axismove sends one axis at a time, so we must store both */
|
||||
DFBCHECK(_layer->GetCursorPosition(_layer,&_cursor_x,&_cursor_y));
|
||||
|
||||
_input_event_fd_handler_handle = ecore_main_fd_handler_add(_input_event_fd,ECORE_FD_READ,_ecore_directfb_input_event_fd_handler, NULL,NULL,NULL);
|
||||
_ecore_directfb_fullscreen_window_id = ecore_window->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
DFBCHECK(_input_event->Release(_input_event));
|
||||
DFBCHECK(_layer->SetCooperativeLevel(_layer,DLSCL_SHARED));
|
||||
DFBCHECK(ecore_window->window->GetSurface(ecore_window->window, &ecore_window->surface));
|
||||
ecore_main_fd_handler_del(_input_event_fd_handler_handle);
|
||||
_ecore_directfb_fullscreen_window_id = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
ecore_directfb_window_size_get(Ecore_DirectFB_Window *ecore_window, int *w, int *h)
|
||||
{
|
||||
DFBCHECK(ecore_window->surface->GetSize(ecore_window->surface,w,h));
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
ecore_directfb_init(const char *name)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
_ecore_directfb_init_count++;
|
||||
if (_ecore_directfb_init_count > 1) return _ecore_directfb_init_count;
|
||||
|
||||
DFBCHECK(DirectFBInit(NULL,NULL));
|
||||
DFBCHECK(DirectFBCreate(&_dfb));
|
||||
|
||||
DFBCHECK(_dfb->GetDisplayLayer(_dfb, DLID_PRIMARY, &_layer));
|
||||
DFBCHECK(_layer->SetCooperativeLevel(_layer, DLSCL_SHARED));
|
||||
|
||||
|
||||
/* window events and fd */
|
||||
DFBCHECK(_dfb->CreateEventBuffer(_dfb, &_window_event));
|
||||
DFBCHECK(_window_event->CreateFileDescriptor(_window_event,&_window_event_fd));
|
||||
_window_event_fd_handler_handle = ecore_main_fd_handler_add(_window_event_fd,ECORE_FD_READ,_ecore_directfb_window_event_fd_handler, NULL,NULL,NULL);
|
||||
|
||||
/* register ecore directfb events */
|
||||
ECORE_DIRECTFB_EVENT_POSITION = ecore_event_type_new();
|
||||
ECORE_DIRECTFB_EVENT_SIZE = ecore_event_type_new();;
|
||||
ECORE_DIRECTFB_EVENT_CLOSE = ecore_event_type_new();;
|
||||
ECORE_DIRECTFB_EVENT_DESTROYED = ecore_event_type_new();;
|
||||
ECORE_DIRECTFB_EVENT_GOT_FOCUS = ecore_event_type_new();;
|
||||
ECORE_DIRECTFB_EVENT_LOST_FOCUS = ecore_event_type_new();;
|
||||
ECORE_DIRECTFB_EVENT_KEY_DOWN = ecore_event_type_new();;
|
||||
ECORE_DIRECTFB_EVENT_KEY_UP = ecore_event_type_new();;
|
||||
ECORE_DIRECTFB_EVENT_BUTTON_DOWN = ecore_event_type_new();;
|
||||
ECORE_DIRECTFB_EVENT_BUTTON_UP = ecore_event_type_new();;
|
||||
ECORE_DIRECTFB_EVENT_MOTION = ecore_event_type_new();;
|
||||
ECORE_DIRECTFB_EVENT_ENTER = ecore_event_type_new();;
|
||||
ECORE_DIRECTFB_EVENT_LEAVE = ecore_event_type_new();;
|
||||
ECORE_DIRECTFB_EVENT_WHEEL = ecore_event_type_new();;
|
||||
|
||||
/* create the hash table for the keynames */
|
||||
_ecore_directfb_key_symbols_hash = ecore_hash_new(_ecore_directfb_hash_create,_ecore_directfb_hash_compare);
|
||||
for(i=0; i<_ecore_directfb_key_symbols_count; i++)
|
||||
{
|
||||
ecore_hash_set(_ecore_directfb_key_symbols_hash, &_ecore_directfb_key_symbols[i].keycode, _ecore_directfb_key_symbols[i].keysymbol);
|
||||
}
|
||||
/* create the hash for the windows(key = windowid, val = Ecore_DirectFB_Window struct) */
|
||||
return _ecore_directfb_init_count;
|
||||
}
|
||||
|
||||
int
|
||||
ecore_directfb_shutdown(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
_ecore_directfb_init_count--;
|
||||
if (_ecore_directfb_init_count > 0) return _ecore_directfb_init_count;
|
||||
if (_ecore_directfb_init_count < 0)
|
||||
{
|
||||
_ecore_directfb_init_count = 0;
|
||||
return 0;
|
||||
}
|
||||
ecore_main_fd_handler_del(_window_event_fd_handler_handle);
|
||||
/* free the key symbol names hash */
|
||||
for(i=0; i<_ecore_directfb_key_symbols_count; i++)
|
||||
{
|
||||
ecore_hash_remove(_ecore_directfb_key_symbols_hash, &_ecore_directfb_key_symbols[i].keycode);
|
||||
}
|
||||
|
||||
if(_ecore_directfb_fullscreen_window_id)
|
||||
{
|
||||
DFBCHECK(_input_event->Release(_input_event));
|
||||
ecore_main_fd_handler_del(_input_event_fd_handler_handle);
|
||||
}
|
||||
DFBCHECK(_window_event->Release(_window_event));
|
||||
DFBCHECK(_layer->Release(_layer));
|
||||
DFBCHECK(_dfb->Release(_dfb));
|
||||
|
||||
return 1;
|
||||
}
|
|
@ -0,0 +1,180 @@
|
|||
typedef struct _Ecore_DirectFB_Key_Symbols Ecore_DirectFB_Key_Symbols;
|
||||
struct _Ecore_DirectFB_Key_Symbols
|
||||
{
|
||||
char *keysymbol;
|
||||
unsigned int keycode;
|
||||
} _ecore_directfb_key_symbols[] = {
|
||||
{"BackSpace",DIKS_BACKSPACE},
|
||||
{"Tab", DIKS_TAB},
|
||||
{"Return", DIKS_RETURN},
|
||||
{"Cancel", DIKS_CANCEL},
|
||||
{"Escape", DIKS_ESCAPE},
|
||||
{"space", DIKS_SPACE},
|
||||
{"exclam", DIKS_EXCLAMATION_MARK},
|
||||
{"quotedbl", DIKS_QUOTATION},
|
||||
{"numbersign", DIKS_NUMBER_SIGN},
|
||||
{"dollar", DIKS_DOLLAR_SIGN},
|
||||
{"percent", DIKS_PERCENT_SIGN},
|
||||
{"ampersand", DIKS_AMPERSAND},
|
||||
{"apostrophe", DIKS_APOSTROPHE},
|
||||
{"parenleft", DIKS_PARENTHESIS_LEFT},
|
||||
{"parenright", DIKS_PARENTHESIS_RIGHT},
|
||||
{"asterisk", DIKS_ASTERISK},
|
||||
{"plus", DIKS_PLUS_SIGN},
|
||||
{"comma", DIKS_COMMA},
|
||||
{"minus", DIKS_MINUS_SIGN},
|
||||
{"period", DIKS_PERIOD},
|
||||
{"slash", DIKS_SLASH},
|
||||
{"0", DIKS_0},
|
||||
{"1", DIKS_1},
|
||||
{"2", DIKS_2},
|
||||
{"3", DIKS_3},
|
||||
{"4", DIKS_4},
|
||||
{"5", DIKS_5},
|
||||
{"6", DIKS_6},
|
||||
{"7", DIKS_7},
|
||||
{"8", DIKS_8},
|
||||
{"9", DIKS_9},
|
||||
{"colon", DIKS_COLON},
|
||||
{"semicolon", DIKS_SEMICOLON},
|
||||
{"less", DIKS_LESS_THAN_SIGN},
|
||||
{"equal", DIKS_EQUALS_SIGN},
|
||||
{"greater", DIKS_GREATER_THAN_SIGN},
|
||||
{"question", DIKS_QUESTION_MARK},
|
||||
{"at", DIKS_AT},
|
||||
{"A", DIKS_CAPITAL_A },
|
||||
{"B", DIKS_CAPITAL_B },
|
||||
{"C", DIKS_CAPITAL_C },
|
||||
{"D", DIKS_CAPITAL_D },
|
||||
{"E", DIKS_CAPITAL_E },
|
||||
{"F", DIKS_CAPITAL_F },
|
||||
{"G", DIKS_CAPITAL_G },
|
||||
{"H", DIKS_CAPITAL_H },
|
||||
{"I", DIKS_CAPITAL_I },
|
||||
{"J", DIKS_CAPITAL_J },
|
||||
{"K", DIKS_CAPITAL_K },
|
||||
{"L", DIKS_CAPITAL_L },
|
||||
{"M", DIKS_CAPITAL_M },
|
||||
{"N", DIKS_CAPITAL_N },
|
||||
{"O", DIKS_CAPITAL_O },
|
||||
{"P", DIKS_CAPITAL_P },
|
||||
{"Q", DIKS_CAPITAL_Q },
|
||||
{"R", DIKS_CAPITAL_R },
|
||||
{"S", DIKS_CAPITAL_S },
|
||||
{"T", DIKS_CAPITAL_T },
|
||||
{"U", DIKS_CAPITAL_U },
|
||||
{"V", DIKS_CAPITAL_V },
|
||||
{"W", DIKS_CAPITAL_W },
|
||||
{"X", DIKS_CAPITAL_X },
|
||||
{"Y", DIKS_CAPITAL_Y },
|
||||
{"Z", DIKS_CAPITAL_Z },
|
||||
{"bracketleft", DIKS_SQUARE_BRACKET_LEFT },
|
||||
{"backslash", DIKS_BACKSLASH },
|
||||
{"bracketright", DIKS_SQUARE_BRACKET_RIGHT },
|
||||
{"asciicircum", DIKS_CIRCUMFLEX_ACCENT },
|
||||
{"underscore", DIKS_UNDERSCORE },
|
||||
{"grave", DIKS_GRAVE_ACCENT},
|
||||
{"a", DIKS_SMALL_A },
|
||||
{"b", DIKS_SMALL_B },
|
||||
{"c", DIKS_SMALL_C },
|
||||
{"d", DIKS_SMALL_D },
|
||||
{"e", DIKS_SMALL_E },
|
||||
{"f", DIKS_SMALL_F },
|
||||
{"g", DIKS_SMALL_G },
|
||||
{"h", DIKS_SMALL_H },
|
||||
{"i", DIKS_SMALL_I },
|
||||
{"j", DIKS_SMALL_J },
|
||||
{"k", DIKS_SMALL_K },
|
||||
{"l", DIKS_SMALL_L },
|
||||
{"m", DIKS_SMALL_M },
|
||||
{"n", DIKS_SMALL_N },
|
||||
{"o", DIKS_SMALL_O },
|
||||
{"p", DIKS_SMALL_P },
|
||||
{"q", DIKS_SMALL_Q },
|
||||
{"r", DIKS_SMALL_R },
|
||||
{"s", DIKS_SMALL_S },
|
||||
{"t", DIKS_SMALL_T },
|
||||
{"u", DIKS_SMALL_U },
|
||||
{"v", DIKS_SMALL_V },
|
||||
{"w", DIKS_SMALL_W },
|
||||
{"x", DIKS_SMALL_X },
|
||||
{"y", DIKS_SMALL_Y },
|
||||
{"z", DIKS_SMALL_Z },
|
||||
{"braceleft",DIKS_CURLY_BRACKET_LEFT },
|
||||
{"bar", DIKS_VERTICAL_BAR },
|
||||
{"braceright", DIKS_CURLY_BRACKET_RIGHT },
|
||||
{"asciitilde", DIKS_TILDE },
|
||||
{"Delete", DIKS_DELETE },
|
||||
{"Left", DIKS_CURSOR_LEFT },
|
||||
{"Right", DIKS_CURSOR_RIGHT},
|
||||
{"Up", DIKS_CURSOR_UP},
|
||||
{"Down", DIKS_CURSOR_DOWN},
|
||||
{"Insert", DIKS_INSERT},
|
||||
{"Home", DIKS_HOME},
|
||||
{"End", DIKS_END},
|
||||
{"Page_Up", DIKS_PAGE_UP},
|
||||
{"Page_Down", DIKS_PAGE_DOWN},
|
||||
{"Print", DIKS_PRINT},
|
||||
{"Pause", DIKS_PAUSE},
|
||||
/* ok */
|
||||
{"Select",DIKS_SELECT},
|
||||
/* goto */
|
||||
{"Clear", DIKS_CLEAR},
|
||||
/* power */
|
||||
/* power 2 */
|
||||
/* option */
|
||||
{"Menu",DIKS_MENU},
|
||||
{"Help",DIKS_HELP},
|
||||
/* info */
|
||||
/* time */
|
||||
/* vendor */
|
||||
/* archive */
|
||||
/* program */
|
||||
/* channel */
|
||||
/* favorites */
|
||||
/* hasta next */
|
||||
{"Next",DIKS_NEXT},
|
||||
{"Begin",DIKS_BEGIN},
|
||||
/* digits */
|
||||
/* teen */
|
||||
/* twen */
|
||||
{"Break", DIKS_BREAK},
|
||||
/* exit */
|
||||
/* setup */
|
||||
{"upleftcorner", DIKS_CURSOR_LEFT_UP },
|
||||
{"lowleftcorner", DIKS_CURSOR_LEFT_DOWN },
|
||||
{"uprightcorner", DIKS_CURSOR_UP_RIGHT },
|
||||
{"lowrightcorner",DIKS_CURSOR_DOWN_RIGHT },
|
||||
{"F1",DIKS_F1},
|
||||
{"F2",DIKS_F2},
|
||||
{"F3",DIKS_F3},
|
||||
{"F4",DIKS_F4},
|
||||
{"F5",DIKS_F5},
|
||||
{"F6",DIKS_F6},
|
||||
{"F7",DIKS_F7},
|
||||
{"F8",DIKS_F8},
|
||||
{"F9",DIKS_F9},
|
||||
{"F10",DIKS_F10},
|
||||
{"F11",DIKS_F11},
|
||||
{"F12",DIKS_F12},
|
||||
/* this are only mapped to one, not left right */
|
||||
{"Shift_L", DIKS_SHIFT},
|
||||
/*{"Shift_R",0xFFE2},*/
|
||||
{"Control_L", DIKS_CONTROL},
|
||||
/*{"Control_R",0xFFE4},*/
|
||||
{"Meta_L", DIKS_META},
|
||||
/* {"Meta_R",0xFFE8},*/
|
||||
{"Alt_L", DIKS_ALT},
|
||||
{"Alt_R", DIKS_ALTGR},
|
||||
{"Super_L", DIKS_SUPER},
|
||||
/*{"Super_R",0xFFEC},*/
|
||||
{"Hyper_L", DIKS_HYPER},
|
||||
/*{"Hyper_R",0xFFEE},*/
|
||||
|
||||
{"Caps_Lock", DIKS_CAPS_LOCK},
|
||||
{"Num_Lock", DIKS_NUM_LOCK},
|
||||
{"Scroll_Lock", DIKS_SCROLL_LOCK},
|
||||
/* not included the dead keys */
|
||||
/* not included the custom keys */
|
||||
{"VoidSymbol", DIKS_NULL}
|
||||
};
|
|
@ -0,0 +1,11 @@
|
|||
/* macro for a safe call to DirectFB functions */
|
||||
#define DFBCHECK(x...) \
|
||||
{ \
|
||||
_err = x; \
|
||||
if (_err != DFB_OK) { \
|
||||
fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \
|
||||
DirectFBErrorFatal( #x, _err ); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
|
@ -47,6 +47,7 @@ extern "C" {
|
|||
#define HAVE_ECORE_EVAS_X 1
|
||||
#define HAVE_ECORE_EVAS_FB 1
|
||||
#define HAVE_ECORE_EVAS_GL 1
|
||||
#define HAVE_ECORE_EVAS_DIRECTFB 1
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
@ -54,7 +55,8 @@ typedef enum
|
|||
ECORE_EVAS_ENGINE_SOFTWARE_FB,
|
||||
ECORE_EVAS_ENGINE_GL_X11,
|
||||
ECORE_EVAS_ENGINE_SOFTWARE_BUFFER,
|
||||
ECORE_EVAS_ENGINE_XRENDER_X11
|
||||
ECORE_EVAS_ENGINE_XRENDER_X11,
|
||||
ECORE_EVAS_ENGINE_DIRECTFB
|
||||
} Ecore_Evas_Engine_Type;
|
||||
|
||||
#ifndef _ECORE_X_H
|
||||
|
@ -62,6 +64,11 @@ typedef enum
|
|||
typedef unsigned int Ecore_X_Window;
|
||||
#endif
|
||||
|
||||
#ifndef _ECORE_DIRECTFB_H
|
||||
#define _ECORE_DIRECTFB_WINDOW_PREDEF
|
||||
typedef void Ecore_DirectFB_Window;
|
||||
#endif
|
||||
|
||||
#ifndef _ECORE_EVAS_PRIVATE_H
|
||||
/* basic data types */
|
||||
typedef void Ecore_Evas;
|
||||
|
|
|
@ -20,6 +20,16 @@ ECORE_FB_LIB =
|
|||
ECORE_FB_LDF =
|
||||
endif
|
||||
|
||||
if BUILD_ECORE_DIRECTFB
|
||||
ECORE_DIRECTFB_INC = -I$(top_srcdir)/src/lib/ecore_directfb -I@DIRECTFB_CFLAGS@
|
||||
ECORE_DIRECTFB_LIB = $(top_builddir)/src/lib/ecore_directfb/libecore_directfb.la
|
||||
ECORE_DIRECTFB_LDF = -L$(top_builddir)/src/lib/ecore_directfb/.libs
|
||||
else
|
||||
ECORE_DIRECTFB_INC =
|
||||
ECORE_DIRECTFB_LIB =
|
||||
ECORE_DIRECTFB_LDF =
|
||||
endif
|
||||
|
||||
INCLUDES = \
|
||||
-I$(top_srcdir)/src/lib/ecore \
|
||||
-I$(top_srcdir)/src/lib/ecore_evas \
|
||||
|
@ -27,11 +37,13 @@ INCLUDES = \
|
|||
-I$(top_builddir)/src/lib/ecore_evas \
|
||||
$(ECORE_X_INC) \
|
||||
$(ECORE_FB_INC) \
|
||||
$(ECORE_DIRECTFB_INC) \
|
||||
@EVAS_CFLAGS@
|
||||
|
||||
libecore_evas_la_LDFLAGS = -version-info 1:0:0 \
|
||||
$(ECORE_X_LDF) \
|
||||
$(ECORE_FB_LDF) \
|
||||
$(ECORE_DIRECTFB_LDF) \
|
||||
-L$(top_builddir)/src/lib/ecore/.libs
|
||||
|
||||
if BUILD_ECORE_EVAS
|
||||
|
@ -45,17 +57,20 @@ ecore_evas.c \
|
|||
ecore_evas_private.h \
|
||||
ecore_evas_x.c \
|
||||
ecore_evas_fb.c \
|
||||
ecore_evas_buffer.c
|
||||
ecore_evas_buffer.c \
|
||||
ecore_evas_directfb.c
|
||||
|
||||
libecore_evas_la_LIBADD = \
|
||||
$(ECORE_X_LIB) \
|
||||
$(ECORE_FB_LIB) \
|
||||
$(ECORE_DIRECTFB_LIB) \
|
||||
$(top_builddir)/src/lib/ecore/libecore.la \
|
||||
@EVAS_LIBS@
|
||||
|
||||
libecore_evas_la_DEPENDENCIES = \
|
||||
$(ECORE_X_LIB) \
|
||||
$(ECORE_FB_LIB) \
|
||||
$(ECORE_DIRECTFB_LIB) \
|
||||
$(top_builddir)/src/lib/ecore/libecore.la
|
||||
|
||||
endif
|
||||
|
@ -65,5 +80,6 @@ ecore_evas.c \
|
|||
ecore_evas_private.h \
|
||||
ecore_evas_x.c \
|
||||
ecore_evas_fb.c \
|
||||
ecore_evas_buffer.c
|
||||
ecore_evas_buffer.c \
|
||||
ecore_evas_directfb.c
|
||||
|
||||
|
|
|
@ -56,6 +56,11 @@ ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine)
|
|||
return 0;
|
||||
#endif
|
||||
break;
|
||||
case ECORE_EVAS_ENGINE_DIRECTFB:
|
||||
#ifdef BUILD_ECORE_EVAS_DIRECTFB
|
||||
return 1;
|
||||
#endif
|
||||
return 0;
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
|
@ -97,6 +102,9 @@ ecore_evas_shutdown(void)
|
|||
#endif
|
||||
#ifdef BUILD_ECORE_EVAS_BUFFER
|
||||
while (_ecore_evas_buffer_shutdown());
|
||||
#endif
|
||||
#ifdef BUILD_ECORE_EVAS_DIRECTFB
|
||||
while (_ecore_evas_directfb_shutdown());
|
||||
#endif
|
||||
evas_shutdown();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,623 @@
|
|||
#include "config.h"
|
||||
#include "Ecore.h"
|
||||
#include "ecore_private.h"
|
||||
#include "ecore_evas_private.h"
|
||||
#include "Ecore_Evas.h"
|
||||
#ifdef BUILD_ECORE_EVAS_DIRECTFB
|
||||
#include "Ecore_DirectFB.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef BUILD_ECORE_EVAS_DIRECTFB
|
||||
static int _ecore_evas_init_count = 0;
|
||||
static int _ecore_evas_fps_debug = 0;
|
||||
static Ecore_Event_Handler *ecore_evas_event_handlers[13];
|
||||
|
||||
static Ecore_Evas *ecore_evases = NULL;
|
||||
static Evas_Hash *ecore_evases_hash = NULL;
|
||||
|
||||
static Ecore_Idle_Enterer *ecore_evas_directfb_idle_enterer = NULL;
|
||||
|
||||
static void
|
||||
_ecore_evas_directfb_render(Ecore_Evas *ee)
|
||||
{
|
||||
if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee);
|
||||
Evas_List *updates;
|
||||
updates = evas_render_updates(ee->evas);
|
||||
if (updates)
|
||||
{
|
||||
DFBRegion region;
|
||||
IDirectFBSurface *surface;
|
||||
Evas_List *l;
|
||||
surface = ee->engine.directfb.window->surface;
|
||||
for (l = updates; l; l = l->next)
|
||||
{
|
||||
Evas_Rectangle *rect;
|
||||
rect = l->data;
|
||||
region.x1 = rect->x;
|
||||
region.y1 = rect->y;
|
||||
region.x2 = rect->x + rect->w - 1;
|
||||
region.y2 = rect->y + rect->h - 1;
|
||||
surface->Flip(surface, ®ion,DSFLIP_BLIT);
|
||||
}
|
||||
evas_render_updates_free(updates);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
_ecore_evas_directfb_idle_enter(void *data __UNUSED__)
|
||||
{
|
||||
Ecore_List2 *l;
|
||||
double t1 = 0.;
|
||||
double t2 = 0.;
|
||||
|
||||
if (_ecore_evas_fps_debug)
|
||||
{
|
||||
t1 = ecore_time_get();
|
||||
}
|
||||
for (l = (Ecore_List2 *)ecore_evases; l; l = l->next)
|
||||
{
|
||||
Ecore_Evas *ee;
|
||||
ee = (Ecore_Evas *)l;
|
||||
_ecore_evas_directfb_render(ee);
|
||||
}
|
||||
if (_ecore_evas_fps_debug)
|
||||
{
|
||||
t2 = ecore_time_get();
|
||||
_ecore_evas_fps_debug_rendertime_add(t2 - t1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static char *
|
||||
_ecore_evas_directfb_winid_str_get(Ecore_X_Window win)
|
||||
{
|
||||
const char *vals = "qWeRtYuIoP5-$&<~";
|
||||
static char id[9];
|
||||
unsigned int val;
|
||||
val = (unsigned int)win;
|
||||
id[0] = vals[(val >> 28) & 0xf];
|
||||
id[1] = vals[(val >> 24) & 0xf];
|
||||
id[2] = vals[(val >> 20) & 0xf];
|
||||
id[3] = vals[(val >> 16) & 0xf];
|
||||
id[4] = vals[(val >> 12) & 0xf];
|
||||
id[5] = vals[(val >> 8) & 0xf];
|
||||
id[6] = vals[(val >> 4) & 0xf];
|
||||
id[7] = vals[(val ) & 0xf];
|
||||
id[8] = 0;
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
static Ecore_Evas *
|
||||
_ecore_evas_directfb_match(DFBWindowID win)
|
||||
{
|
||||
Ecore_Evas *ee;
|
||||
|
||||
ee = evas_hash_find(ecore_evases_hash, _ecore_evas_directfb_winid_str_get(win));
|
||||
if ((ee) && (ee->delete_idle_enterer)) return NULL;
|
||||
return ee;
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_evas_directfb_mouse_move_process(Ecore_Evas *ee, int x, int y, unsigned int timestamp)
|
||||
{
|
||||
ee->mouse.x = x;
|
||||
ee->mouse.y = y;
|
||||
|
||||
if (ee->prop.cursor.object)
|
||||
{
|
||||
evas_object_show(ee->prop.cursor.object);
|
||||
if (ee->rotation == 0)
|
||||
evas_object_move(ee->prop.cursor.object,x - ee->prop.cursor.hot.x,y - ee->prop.cursor.hot.y);
|
||||
else if (ee->rotation == 90)
|
||||
evas_object_move(ee->prop.cursor.object,
|
||||
ee->h - y - 1 - ee->prop.cursor.hot.x,
|
||||
x - ee->prop.cursor.hot.y);
|
||||
else if (ee->rotation == 180)
|
||||
evas_object_move(ee->prop.cursor.object,
|
||||
ee->w - x - 1 - ee->prop.cursor.hot.x,
|
||||
ee->h - y - 1 - ee->prop.cursor.hot.y);
|
||||
else if (ee->rotation == 270)
|
||||
evas_object_move(ee->prop.cursor.object,
|
||||
y - ee->prop.cursor.hot.x,
|
||||
ee->w - x - 1 - ee->prop.cursor.hot.y);
|
||||
}
|
||||
if (ee->rotation == 0)
|
||||
evas_event_feed_mouse_move(ee->evas, x, y, timestamp, NULL);
|
||||
else if (ee->rotation == 90)
|
||||
evas_event_feed_mouse_move(ee->evas, ee->h - y - 1, x, timestamp, NULL);
|
||||
else if (ee->rotation == 180)
|
||||
evas_event_feed_mouse_move(ee->evas, ee->w - x - 1, ee->h - y - 1, timestamp, NULL);
|
||||
else if (ee->rotation == 270)
|
||||
evas_event_feed_mouse_move(ee->evas, y, ee->w - x - 1, timestamp, NULL);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
_ecore_evas_directfb_event_key_down(void *data __UNUSED__, int type __UNUSED__, void *event)
|
||||
{
|
||||
Ecore_Evas *ee;
|
||||
Ecore_DirectFB_Event_Key_Down *e;
|
||||
|
||||
e = event;
|
||||
ee = _ecore_evas_directfb_match(e->win);
|
||||
|
||||
if (!ee) return 1; /* pass on event */
|
||||
evas_event_feed_key_down(ee->evas, e->keyname, e->keysymbol, e->key_compose, NULL, e->time, NULL);
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
static int
|
||||
_ecore_evas_directfb_event_key_up(void *data __UNUSED__, int type __UNUSED__, void *event)
|
||||
{
|
||||
Ecore_Evas *ee;
|
||||
Ecore_DirectFB_Event_Key_Up *e;
|
||||
|
||||
e = event;
|
||||
ee = _ecore_evas_directfb_match(e->win);
|
||||
|
||||
if (!ee) return 1; /* pass on event */
|
||||
evas_event_feed_key_up(ee->evas, e->keyname, e->keysymbol, e->key_compose, NULL, e->time, NULL);
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
static int
|
||||
_ecore_evas_directfb_event_motion(void *data __UNUSED__, int type __UNUSED__, void *event)
|
||||
{
|
||||
Ecore_Evas *ee;
|
||||
Ecore_DirectFB_Event_Motion *e;
|
||||
|
||||
e = event;
|
||||
ee = _ecore_evas_directfb_match(e->win);
|
||||
|
||||
if (!ee) return 1; /* pass on event */
|
||||
_ecore_evas_directfb_mouse_move_process(ee, e->x, e->y, e->time);
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
static int
|
||||
_ecore_evas_directfb_event_button_down(void *data __UNUSED__, int type __UNUSED__, void *event)
|
||||
{
|
||||
Ecore_Evas *ee;
|
||||
Ecore_DirectFB_Event_Button_Down *e;
|
||||
|
||||
e = event;
|
||||
ee = _ecore_evas_directfb_match(e->win);
|
||||
|
||||
if (!ee) return 1; /* pass on event */
|
||||
// _ecore_evas_directfb_mouse_move_process(ee, e->x, e->y, e->time);
|
||||
evas_event_feed_mouse_down(ee->evas, e->button, EVAS_BUTTON_NONE, e->time, NULL);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_ecore_evas_directfb_event_button_up(void *data __UNUSED__, int type __UNUSED__, void *event)
|
||||
{
|
||||
Ecore_Evas *ee;
|
||||
Ecore_DirectFB_Event_Button_Up *e;
|
||||
Evas_Button_Flags flags = EVAS_BUTTON_NONE;
|
||||
|
||||
e = event;
|
||||
ee = _ecore_evas_directfb_match(e->win);
|
||||
|
||||
if (!ee) return 1; /* pass on event */
|
||||
//_ecore_evas_directfb_mouse_move_process(ee, e->x, e->y, e->time);
|
||||
evas_event_feed_mouse_up(ee->evas, e->button, flags, e->time, NULL);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_ecore_evas_directfb_event_enter(void *data __UNUSED__, int type __UNUSED__, void *event)
|
||||
{
|
||||
Ecore_Evas *ee;
|
||||
Ecore_DirectFB_Event_Enter *e;
|
||||
|
||||
e = event;
|
||||
ee = _ecore_evas_directfb_match(e->win);
|
||||
|
||||
if (!ee) return 1; /* pass on event */
|
||||
evas_event_feed_mouse_in(ee->evas, e->time, NULL);
|
||||
//_ecore_evas_directfb_mouse_move_process(ee, e->x, e->y, e->time);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_ecore_evas_directfb_event_leave(void *data __UNUSED__, int type __UNUSED__, void *event)
|
||||
{
|
||||
Ecore_Evas *ee;
|
||||
Ecore_DirectFB_Event_Leave *e;
|
||||
|
||||
e = event;
|
||||
ee = _ecore_evas_directfb_match(e->win);
|
||||
|
||||
if (!ee) return 1; /* pass on event */
|
||||
evas_event_feed_mouse_out(ee->evas, e->time, NULL);
|
||||
//_ecore_evas_directfb_mouse_move_process(ee, e->x, e->y, e->time);
|
||||
if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
|
||||
if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_ecore_evas_directfb_event_wheel(void *data __UNUSED__, int type __UNUSED__, void *event)
|
||||
{
|
||||
Ecore_Evas *ee;
|
||||
Ecore_DirectFB_Event_Wheel *e;
|
||||
|
||||
e = event;
|
||||
ee = _ecore_evas_directfb_match(e->win);
|
||||
|
||||
if (!ee) return 1; /* pass on event */
|
||||
evas_event_feed_mouse_wheel(ee->evas, e->direction, e->z, e->time, NULL);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_ecore_evas_directfb_event_got_focus(void *data __UNUSED__, int type __UNUSED__, void *event)
|
||||
{
|
||||
Ecore_Evas *ee;
|
||||
Ecore_DirectFB_Event_Got_Focus *e;
|
||||
|
||||
e = event;
|
||||
ee = _ecore_evas_directfb_match(e->win);
|
||||
|
||||
if (!ee) return 1; /* pass on event */
|
||||
ee->prop.focused = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_ecore_evas_directfb_event_lost_focus(void *data __UNUSED__, int type __UNUSED__, void *event)
|
||||
{
|
||||
Ecore_Evas *ee;
|
||||
Ecore_DirectFB_Event_Lost_Focus *e;
|
||||
|
||||
e = event;
|
||||
ee = _ecore_evas_directfb_match(e->win);
|
||||
|
||||
if (!ee) return 1; /* pass on event */
|
||||
ee->prop.focused = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
_ecore_evas_directfb_shutdown(void)
|
||||
{
|
||||
_ecore_evas_init_count--;
|
||||
if (_ecore_evas_init_count == 0)
|
||||
{
|
||||
int i;
|
||||
|
||||
while (ecore_evases) _ecore_evas_free(ecore_evases);
|
||||
for (i = 0; i < 8; i++)
|
||||
ecore_event_handler_del(ecore_evas_event_handlers[i]);
|
||||
ecore_idle_enterer_del(ecore_evas_directfb_idle_enterer);
|
||||
ecore_evas_directfb_idle_enterer = NULL;
|
||||
if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_shutdown();
|
||||
}
|
||||
if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0;
|
||||
return _ecore_evas_init_count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int
|
||||
_ecore_evas_directfb_init(void)
|
||||
{
|
||||
_ecore_evas_init_count++;
|
||||
if (_ecore_evas_init_count > 1) return _ecore_evas_init_count;
|
||||
if (getenv("ECORE_EVAS_FPS_DEBUG")) _ecore_evas_fps_debug = 1;
|
||||
ecore_evas_directfb_idle_enterer = ecore_idle_enterer_add(_ecore_evas_directfb_idle_enter, NULL);
|
||||
if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_init();
|
||||
|
||||
ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_KEY_DOWN, _ecore_evas_directfb_event_key_down, NULL);
|
||||
ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_KEY_UP, _ecore_evas_directfb_event_key_up, NULL);
|
||||
ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_BUTTON_DOWN, _ecore_evas_directfb_event_button_down, NULL);
|
||||
ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_BUTTON_UP, _ecore_evas_directfb_event_button_up, NULL);
|
||||
ecore_evas_event_handlers[4] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_MOTION, _ecore_evas_directfb_event_motion, NULL);
|
||||
ecore_evas_event_handlers[5] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_ENTER, _ecore_evas_directfb_event_enter, NULL);
|
||||
ecore_evas_event_handlers[6] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_LEAVE, _ecore_evas_directfb_event_leave, NULL);
|
||||
ecore_evas_event_handlers[7] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_WHEEL, _ecore_evas_directfb_event_wheel, NULL);
|
||||
ecore_evas_event_handlers[8] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_GOT_FOCUS, _ecore_evas_directfb_event_got_focus, NULL);
|
||||
ecore_evas_event_handlers[9] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_LOST_FOCUS, _ecore_evas_directfb_event_lost_focus, NULL);
|
||||
ecore_evas_event_handlers[10] = NULL;
|
||||
ecore_evas_event_handlers[11] = NULL;
|
||||
ecore_evas_event_handlers[12] = NULL;
|
||||
|
||||
return _ecore_evas_init_count;
|
||||
}
|
||||
|
||||
/* engine functions */
|
||||
/********************/
|
||||
|
||||
static void
|
||||
_ecore_evas_directfb_free(Ecore_Evas *ee)
|
||||
{
|
||||
ecore_directfb_window_del(ee->engine.directfb.window);
|
||||
free(ee->engine.directfb.window);
|
||||
ecore_evases_hash = evas_hash_del(ecore_evases_hash, _ecore_evas_directfb_winid_str_get(ee->engine.directfb.window->id), ee);
|
||||
ecore_evases = _ecore_list2_remove(ecore_evases, ee);
|
||||
_ecore_evas_directfb_shutdown();
|
||||
ecore_directfb_shutdown();
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_evas_directfb_move(Ecore_Evas *ee, int x, int y)
|
||||
{
|
||||
ecore_directfb_window_move(ee->engine.directfb.window, x, y);
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_evas_directfb_resize(Ecore_Evas *ee, int w, int h)
|
||||
{
|
||||
if ((w == ee->w) && (h == ee->h)) return;
|
||||
ecore_directfb_window_resize(ee->engine.directfb.window, w, h);
|
||||
ee->w = w;
|
||||
ee->h = h;
|
||||
if ((ee->rotation == 90) || (ee->rotation == 270))
|
||||
{
|
||||
evas_output_size_set(ee->evas, ee->h, ee->w);
|
||||
evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
|
||||
}
|
||||
else
|
||||
{
|
||||
evas_output_size_set(ee->evas, ee->w, ee->h);
|
||||
evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_evas_directfb_focus_set(Ecore_Evas *ee, int on __UNUSED__)
|
||||
{
|
||||
ecore_directfb_window_focus(ee->engine.directfb.window);
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_evas_directfb_hide(Ecore_Evas *ee)
|
||||
{
|
||||
ecore_directfb_window_hide(ee->engine.directfb.window);
|
||||
ee->should_be_visible = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_evas_directfb_show(Ecore_Evas *ee)
|
||||
{
|
||||
ecore_directfb_window_show(ee->engine.directfb.window);
|
||||
ee->should_be_visible = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_evas_directfb_shaped_set(Ecore_Evas *ee, int shaped)
|
||||
{
|
||||
if (((ee->shaped) && (shaped)) || ((!ee->shaped) && (!shaped)))
|
||||
return;
|
||||
ee->shaped = shaped;
|
||||
if(ee->shaped)
|
||||
ecore_directfb_window_shaped_set(ee->engine.directfb.window, 1);
|
||||
else
|
||||
ecore_directfb_window_shaped_set(ee->engine.directfb.window, 0);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_evas_directfb_cursor_set(Ecore_Evas *ee, const char *file, int layer __UNUSED__, int hot_x, int hot_y)
|
||||
{
|
||||
int x, y;
|
||||
|
||||
if (!file)
|
||||
{
|
||||
if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object);
|
||||
if (ee->prop.cursor.file) free(ee->prop.cursor.file);
|
||||
ee->prop.cursor.object = NULL;
|
||||
ee->prop.cursor.file = NULL;
|
||||
ee->prop.cursor.layer = 0;
|
||||
ee->prop.cursor.hot.x = 0;
|
||||
ee->prop.cursor.hot.y = 0;
|
||||
ecore_directfb_window_cursor_show(ee->engine.directfb.window, 1);
|
||||
return;
|
||||
|
||||
}
|
||||
ecore_directfb_window_cursor_show(ee->engine.directfb.window, 0);
|
||||
if (!ee->prop.cursor.object) ee->prop.cursor.object = evas_object_image_add(ee->evas);
|
||||
if (ee->prop.cursor.file) free(ee->prop.cursor.file);
|
||||
ee->prop.cursor.file = strdup(file);
|
||||
ee->prop.cursor.layer = layer;
|
||||
ee->prop.cursor.hot.x = hot_x;
|
||||
ee->prop.cursor.hot.y = hot_y;
|
||||
evas_pointer_output_xy_get(ee->evas, &x, &y);
|
||||
evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer);
|
||||
evas_object_color_set(ee->prop.cursor.object, 255, 255, 255, 255);
|
||||
evas_object_move(ee->prop.cursor.object,x - ee->prop.cursor.hot.x,y - ee->prop.cursor.hot.y);
|
||||
evas_object_image_file_set(ee->prop.cursor.object, ee->prop.cursor.file, NULL);
|
||||
evas_object_image_size_get(ee->prop.cursor.object, &x, &y);
|
||||
evas_object_resize(ee->prop.cursor.object, x, y);
|
||||
evas_object_image_fill_set(ee->prop.cursor.object, 0, 0, x, y);
|
||||
evas_object_pass_events_set(ee->prop.cursor.object, 1);
|
||||
if (evas_pointer_inside_get(ee->evas))
|
||||
evas_object_show(ee->prop.cursor.object);
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_evas_directfb_fullscreen_set(Ecore_Evas *ee, int on)
|
||||
{
|
||||
Evas_Engine_Info_DirectFB *einfo;
|
||||
int w;
|
||||
int h;
|
||||
int resized = 0;
|
||||
|
||||
if (((ee->prop.fullscreen) && (on)) || ((!ee->prop.fullscreen) && (!on)))
|
||||
return;
|
||||
|
||||
if (on)
|
||||
ecore_directfb_window_fullscreen_set(ee->engine.directfb.window, 1);
|
||||
else
|
||||
ecore_directfb_window_fullscreen_set(ee->engine.directfb.window, 0);
|
||||
/* set the new size of the evas */
|
||||
ecore_directfb_window_size_get(ee->engine.directfb.window, &w, &h);
|
||||
if( (ee->w != w) || (ee->h != h))
|
||||
{
|
||||
resized = 1;
|
||||
ee->w = w;
|
||||
ee->h = h;
|
||||
if ((ee->rotation == 90) || (ee->rotation == 270))
|
||||
{
|
||||
evas_output_size_set(ee->evas, ee->h, ee->w);
|
||||
evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
|
||||
}
|
||||
else
|
||||
{
|
||||
evas_output_size_set(ee->evas, ee->w, ee->h);
|
||||
evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
|
||||
}
|
||||
}
|
||||
einfo = (Evas_Engine_Info_DirectFB *)evas_engine_info_get(ee->evas);
|
||||
if(einfo)
|
||||
{
|
||||
einfo->info.surface = ee->engine.directfb.window->surface;
|
||||
evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
|
||||
}
|
||||
ee->prop.fullscreen = on;
|
||||
if(resized)
|
||||
{
|
||||
if(ee->func.fn_resize) ee->func.fn_resize(ee);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static const Ecore_Evas_Engine_Func _ecore_directfb_engine_func =
|
||||
{
|
||||
_ecore_evas_directfb_free, /* free an ecore_evas */
|
||||
NULL, /* cb resize */
|
||||
NULL, /* cb move */
|
||||
NULL, /* cb show */
|
||||
NULL, /* cb hide */
|
||||
NULL, /* cb delete request */
|
||||
NULL, /* cb destroy */
|
||||
NULL, /* cb focus in */
|
||||
NULL, /* cb focus out */
|
||||
NULL, /* cb mouse in */
|
||||
NULL, /* cb mouse out */
|
||||
NULL, /* cb pre render */
|
||||
NULL, /* cb post render */
|
||||
_ecore_evas_directfb_move, /* move */
|
||||
_ecore_evas_directfb_resize, /* resize */
|
||||
NULL, /* move resize */
|
||||
NULL,//_ecore_evas_directfb_rotation_set,/* rotation */
|
||||
_ecore_evas_directfb_shaped_set,/* shaped */
|
||||
_ecore_evas_directfb_show, /* show */
|
||||
_ecore_evas_directfb_hide, /* hide */
|
||||
NULL, /* raise */
|
||||
NULL, /* lower */
|
||||
NULL, /* title set */
|
||||
NULL, /* name class set */
|
||||
NULL, /* size min */
|
||||
NULL, /* size max */
|
||||
NULL, /* size base */
|
||||
NULL, /* size step */
|
||||
_ecore_evas_directfb_cursor_set,/* cursor set */
|
||||
NULL, /* layer set */
|
||||
_ecore_evas_directfb_focus_set, /* focus */
|
||||
NULL, /* iconified */
|
||||
NULL, /* borderless */
|
||||
NULL, /* override */
|
||||
NULL, /* maximized */
|
||||
_ecore_evas_directfb_fullscreen_set,/* fullscreen */
|
||||
NULL, /* avoid damage */
|
||||
NULL, /* withdrawn */
|
||||
NULL /* sticky */
|
||||
};
|
||||
#endif
|
||||
|
||||
/* api */
|
||||
/*******/
|
||||
|
||||
Ecore_DirectFB_Window *
|
||||
ecore_evas_directfb_window_get(Ecore_Evas *ee)
|
||||
{
|
||||
#ifdef BUILD_ECORE_EVAS_DIRECTFB
|
||||
return ee->engine.directfb.window;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Ecore_Evas *
|
||||
ecore_evas_directfb_new(const char *disp_name, int windowed, int x, int y, int w, int h)
|
||||
{
|
||||
#ifdef BUILD_ECORE_EVAS_DIRECTFB
|
||||
Evas_Engine_Info_DirectFB *einfo;
|
||||
Ecore_Evas *ee;
|
||||
|
||||
Ecore_DirectFB_Window *window;
|
||||
|
||||
|
||||
int rmethod;
|
||||
|
||||
rmethod = evas_render_method_lookup("directfb");
|
||||
if (!rmethod) return NULL;
|
||||
if (!ecore_directfb_init(disp_name)) return NULL;
|
||||
ee = calloc(1, sizeof(Ecore_Evas));
|
||||
if (!ee) return NULL;
|
||||
|
||||
ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
|
||||
_ecore_evas_directfb_init();
|
||||
ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_directfb_engine_func;
|
||||
|
||||
ee->driver = strdup("directfb");
|
||||
if (disp_name) ee->name = strdup(disp_name);
|
||||
|
||||
if (w < 1) w = 1;
|
||||
|
||||
if (h < 1) h = 1;
|
||||
|
||||
ee->rotation = 0;
|
||||
ee->visible = 1;
|
||||
ee->x = x;
|
||||
ee->y = y;
|
||||
ee->w = w;
|
||||
ee->h = h;
|
||||
ee->prop.layer = 1;
|
||||
ee->prop.fullscreen = 0;
|
||||
/*ee->prop.max.w = 0;
|
||||
ee->prop.max.h = 0;
|
||||
ee->prop.layer = 0;
|
||||
ee->prop.focused = 1;
|
||||
ee->prop.borderless = 0;
|
||||
ee->prop.override = 1;
|
||||
ee->prop.maximized = 0;
|
||||
ee->prop.withdrawn = 0;
|
||||
ee->prop.sticky = 0;*/
|
||||
//ee->prop.cursor.object = 0;
|
||||
|
||||
/* init evas here */
|
||||
ee->evas = evas_new();
|
||||
evas_output_method_set(ee->evas, rmethod);
|
||||
evas_output_size_set(ee->evas, w, h);
|
||||
evas_output_viewport_set(ee->evas, 0, 0, w, h);
|
||||
einfo = (Evas_Engine_Info_DirectFB *)evas_engine_info_get(ee->evas);
|
||||
|
||||
window = ecore_directfb_window_new(x,y,w,h);
|
||||
ee->engine.directfb.window = window;
|
||||
if (einfo)
|
||||
{
|
||||
einfo->info.dfb = ecore_directfb_interface_get();
|
||||
einfo->info.surface = window->surface;
|
||||
einfo->info.flags = DSDRAW_BLEND;
|
||||
evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
|
||||
}
|
||||
ecore_evases = _ecore_list2_prepend(ecore_evases, ee);
|
||||
ecore_evases_hash = evas_hash_add(ecore_evases_hash, _ecore_evas_directfb_winid_str_get(ee->engine.directfb.window->id), ee);
|
||||
|
||||
return ee;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
|
@ -18,6 +18,10 @@
|
|||
|
||||
#define ECORE_MAGIC_EVAS 0x76543211
|
||||
|
||||
#ifndef BUILD_ECORE_DIRECTFB
|
||||
#undef BUILD_ECORE_EVAS_DIRECTFB
|
||||
#endif
|
||||
|
||||
#ifdef BUILD_ECORE_X
|
||||
#include "Ecore_X.h"
|
||||
#include <Evas_Engine_Software_X11.h>
|
||||
|
@ -33,6 +37,10 @@
|
|||
#ifdef BUILD_ECORE_EVAS_FB
|
||||
#include <Evas_Engine_FB.h>
|
||||
#endif
|
||||
#ifdef BUILD_ECORE_EVAS_DIRECTFB
|
||||
#include <Evas_Engine_DirectFB.h>
|
||||
#include "Ecore_DirectFB.h"
|
||||
#endif
|
||||
#ifdef BUILD_ECORE_EVAS_BUFFER
|
||||
#include <Evas_Engine_Buffer.h>
|
||||
#endif
|
||||
|
@ -131,6 +139,14 @@ struct _Ecore_Evas_Engine
|
|||
Evas_Object *image;
|
||||
} buffer;
|
||||
#endif
|
||||
#ifdef BUILD_ECORE_EVAS_DIRECTFB
|
||||
struct {
|
||||
Ecore_DirectFB_Window *window;
|
||||
/*IDirectFBWindow *window;
|
||||
DirectFBSurface *surface;
|
||||
DirectFBWindowID id;*/
|
||||
} directfb;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct _Ecore_Evas
|
||||
|
|
Loading…
Reference in New Issue