After agreement in the mail list, core developers agree to remove this engine that was not being supported for a long time. Given that most operations Evas uses are not accelerated in DirectFB, or at least hardware that exclusively supports DirectFB, it's better for those people to just use Evas/Ecore software (buffer) rendering and expose DirectFB's framebuffer as destination surface. SVN revision: 80232devs/devilhorns/wayland_egl
parent
aa53580814
commit
dfe93a7f0a
26 changed files with 16 additions and 4141 deletions
@ -1,12 +0,0 @@ |
||||
prefix=@prefix@ |
||||
exec_prefix=@exec_prefix@ |
||||
libdir=@libdir@ |
||||
includedir=@includedir@ |
||||
|
||||
Name: ecore-directfb |
||||
Description: E core library, DirectFB module |
||||
Requires.private: @requirements_pc_ecore_directfb@ |
||||
Version: @VERSION@ |
||||
Libs: -L${libdir} -lecore_directfb |
||||
Libs.private: @requirements_libs_ecore_directfb@ |
||||
Cflags: -I${includedir}/ecore-@VMAJ@ |
@ -1,3 +0,0 @@ |
||||
Name: evas-directfb |
||||
Description: Evas DirectFB engine |
||||
Version: @VERSION@ |
@ -1,34 +0,0 @@ |
||||
|
||||
### Library |
||||
|
||||
lib_LTLIBRARIES += lib/ecore_directfb/libecore_directfb.la |
||||
|
||||
installed_ecoredirectfbmainheadersdir = $(includedir)/ecore-@VMAJ@ |
||||
dist_installed_ecoredirectfbmainheaders_DATA = \ |
||||
lib/ecore_directfb/Ecore_DirectFB.h |
||||
|
||||
lib_ecore_directfb_libecore_directfb_la_SOURCES = \ |
||||
lib/ecore_directfb/ecore_directfb.c \ |
||||
lib/ecore_directfb/ecore_directfb_keys.h \ |
||||
lib/ecore_directfb/ecore_directfb_private.h |
||||
|
||||
lib_ecore_directfb_libecore_directfb_la_CPPFLAGS = \ |
||||
-I$(top_srcdir)/src/lib/eina \ |
||||
-I$(top_srcdir)/src/lib/eo \ |
||||
-I$(top_srcdir)/src/lib/ecore \ |
||||
-I$(top_srcdir)/src/lib/ecore_directfb \ |
||||
-I$(top_builddir)/src/lib/eina \ |
||||
-I$(top_builddir)/src/lib/eo \ |
||||
-I$(top_builddir)/src/lib/ecore \ |
||||
-I$(top_builddir)/src/lib/ecore_directfb \ |
||||
@EFL_CFLAGS@ \ |
||||
@EFL_COV_CFLAGS@ \ |
||||
@ECORE_DIRECTFB_CFLAGS@ |
||||
|
||||
lib_ecore_directfb_libecore_directfb_la_LIBADD = \ |
||||
lib/ecore/libecore.la \ |
||||
lib/eo/libeo.la \ |
||||
lib/eina/libeina.la \ |
||||
@ECORE_DIRECTFB_LIBS@ |
||||
|
||||
lib_ecore_directfb_libecore_directfb_la_LDFLAGS = -no-undefined -version-info @version_info@ @release_info@ |
@ -1,181 +0,0 @@ |
||||
#ifndef _ECORE_DIRECTFB_H |
||||
#define _ECORE_DIRECTFB_H |
||||
|
||||
#include <Eina.h> |
||||
|
||||
#include <directfb.h> |
||||
|
||||
#ifdef EAPI |
||||
# undef EAPI |
||||
#endif /* ifdef EAPI */ |
||||
|
||||
#ifdef __GNUC__ |
||||
# if __GNUC__ >= 4 |
||||
# define EAPI __attribute__ ((visibility("default"))) |
||||
# else /* if __GNUC__ >= 4 */ |
||||
# define EAPI |
||||
# endif /* if __GNUC__ >= 4 */ |
||||
#else /* ifdef __GNUC__ */ |
||||
# define EAPI |
||||
#endif /* ifdef __GNUC__ */ |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif /* ifdef __cplusplus */ |
||||
|
||||
EAPI extern int ECORE_DIRECTFB_EVENT_POSITION; |
||||
EAPI extern int ECORE_DIRECTFB_EVENT_SIZE; |
||||
EAPI extern int ECORE_DIRECTFB_EVENT_CLOSE; |
||||
EAPI extern int ECORE_DIRECTFB_EVENT_DESTROYED; |
||||
EAPI extern int ECORE_DIRECTFB_EVENT_GOT_FOCUS; |
||||
EAPI extern int ECORE_DIRECTFB_EVENT_LOST_FOCUS; |
||||
EAPI extern int ECORE_DIRECTFB_EVENT_KEY_DOWN; |
||||
EAPI extern int ECORE_DIRECTFB_EVENT_KEY_UP; |
||||
EAPI extern int ECORE_DIRECTFB_EVENT_BUTTON_DOWN; |
||||
EAPI extern int ECORE_DIRECTFB_EVENT_BUTTON_UP; |
||||
EAPI extern int ECORE_DIRECTFB_EVENT_MOTION; |
||||
EAPI extern int ECORE_DIRECTFB_EVENT_ENTER; |
||||
EAPI extern int ECORE_DIRECTFB_EVENT_LEAVE; |
||||
EAPI extern int ECORE_DIRECTFB_EVENT_WHEEL; |
||||
|
||||
#ifndef _ECORE_DIRECTFB_WINDOW_PREDEF |
||||
typedef struct _Ecore_DirectFB_Window Ecore_DirectFB_Window; |
||||
#endif /* ifndef _ECORE_DIRECTFB_WINDOW_PREDEF */ |
||||
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 *name; /**< The name of the key that was released */ |
||||
char *string; /**< 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 *name; /**< The name of the key that was released */ |
||||
char *string; /**< 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; |
||||
int double_click : 1; |
||||
int triple_click : 1; |
||||
}; |
||||
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_free(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); |
||||
EAPI void ecore_directfb_window_show(Ecore_DirectFB_Window *window); |
||||
EAPI void ecore_directfb_window_hide(Ecore_DirectFB_Window *window); |
||||
EAPI void ecore_directfb_window_shaped_set(Ecore_DirectFB_Window *window, Eina_Bool set); |
||||
EAPI void ecore_directfb_window_fullscreen_set(Ecore_DirectFB_Window *window, Eina_Bool set); |
||||
EAPI void ecore_directfb_window_size_get(Ecore_DirectFB_Window *window, int *w, int *h); |
||||
EAPI void ecore_directfb_window_cursor_show(Ecore_DirectFB_Window *window, Eina_Bool show); |
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif /* ifdef __cplusplus */ |
||||
|
||||
#endif /* ifndef _ECORE_DIRECTFB_H */ |
@ -1,758 +0,0 @@ |
||||
#ifdef HAVE_CONFIG_H |
||||
# include <config.h> |
||||
#endif /* ifdef HAVE_CONFIG_H */ |
||||
|
||||
#include <stdio.h> |
||||
#include <string.h> |
||||
#include <unistd.h> |
||||
|
||||
#include "Ecore_DirectFB.h" |
||||
#include "ecore_directfb_private.h" |
||||
#include "ecore_directfb_keys.h" |
||||
#include "Ecore.h" |
||||
#include "ecore_private.h" |
||||
|
||||
/* ecore_directfb */ |
||||
/******************/ |
||||
/* About */ |
||||
/* with this you can create windows of directfb and handle events through ecore
|
||||
* TODO: |
||||
* - handle all event types |
||||
* - |
||||
* */ |
||||
int _ecore_directfb_log_dom = -1; |
||||
|
||||
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; |
||||
|
||||
EAPI int ECORE_DIRECTFB_EVENT_POSITION = 0; |
||||
EAPI int ECORE_DIRECTFB_EVENT_SIZE = 0; |
||||
EAPI int ECORE_DIRECTFB_EVENT_CLOSE = 0; |
||||
EAPI int ECORE_DIRECTFB_EVENT_DESTROYED = 0; |
||||
EAPI int ECORE_DIRECTFB_EVENT_GOT_FOCUS = 0; |
||||
EAPI int ECORE_DIRECTFB_EVENT_LOST_FOCUS = 0; |
||||
EAPI int ECORE_DIRECTFB_EVENT_KEY_DOWN = 0; |
||||
EAPI int ECORE_DIRECTFB_EVENT_KEY_UP = 0; |
||||
EAPI int ECORE_DIRECTFB_EVENT_BUTTON_DOWN = 0; |
||||
EAPI int ECORE_DIRECTFB_EVENT_BUTTON_UP = 0; |
||||
EAPI int ECORE_DIRECTFB_EVENT_MOTION = 0; |
||||
EAPI int ECORE_DIRECTFB_EVENT_ENTER = 0; |
||||
EAPI int ECORE_DIRECTFB_EVENT_LEAVE = 0; |
||||
EAPI int ECORE_DIRECTFB_EVENT_WHEEL = 0; |
||||
|
||||
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 Eina_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; // useful for DFBCHECK
|
||||
|
||||
/*******************/ |
||||
/* local functions */ |
||||
/*******************/ |
||||
|
||||
/* free ecore directfb events functions */ |
||||
/****************************************/ |
||||
|
||||
static void |
||||
_ecore_directfb_event_free_key_down(void *data EINA_UNUSED, void *ev) |
||||
{ |
||||
Ecore_DirectFB_Event_Key_Down *e; |
||||
|
||||
e = ev; |
||||
if(e->name) |
||||
free(e->name); |
||||
|
||||
if (e->string) |
||||
free(e->string); |
||||
|
||||
if (e->key_compose) |
||||
free(e->key_compose); |
||||
|
||||
free(e); |
||||
} |
||||
|
||||
static void |
||||
_ecore_directfb_event_free_key_up(void *data EINA_UNUSED, void *ev) |
||||
{ |
||||
Ecore_DirectFB_Event_Key_Up *e; |
||||
|
||||
e = ev; |
||||
if(e->name) |
||||
free(e->name); |
||||
|
||||
if (e->string) |
||||
free(e->string); |
||||
|
||||
if (e->key_compose) |
||||
free(e->key_compose); |
||||
|
||||
free(e); |
||||
} |
||||
|
||||
/* 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; |
||||
struct keymap *k; |
||||
|
||||
e = calloc(1, sizeof(Ecore_DirectFB_Event_Key_Down)); |
||||
|
||||
switch(evt->clazz) |
||||
{ |
||||
case DFEC_INPUT: |
||||
key_symbol = evt->input.key_symbol; |
||||
k = eina_hash_find(_ecore_directfb_key_symbols_hash, &key_symbol); |
||||
|
||||
if(!k) |
||||
{ |
||||
ERR("Symbol %0X of class DFEC_INPUT not found.", evt->input.key_symbol); |
||||
return; |
||||
} |
||||
|
||||
e->name = strdup(k->name); |
||||
e->string = strdup(k->string); |
||||
e->key_compose = NULL; |
||||
e->win = _ecore_directfb_fullscreen_window_id; |
||||
e->time = 0; |
||||
break; |
||||
|
||||
case DFEC_WINDOW: |
||||
key_symbol = evt->window.key_symbol; |
||||
k = eina_hash_find(_ecore_directfb_key_symbols_hash, &key_symbol); |
||||
|
||||
if(!k) |
||||
{ |
||||
ERR("Symbol %0X of class DFEC_WINDOW not found.", evt->window.key_symbol); |
||||
return; |
||||
} |
||||
|
||||
e->name = strdup(k->name); |
||||
e->string = strdup(k->string); |
||||
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; |
||||
struct keymap *k; |
||||
|
||||
e = calloc(1, sizeof(Ecore_DirectFB_Event_Key_Up)); |
||||
|
||||
switch(evt->clazz) |
||||
{ |
||||
case DFEC_INPUT: |
||||
key_symbol = evt->input.key_symbol; |
||||
k = eina_hash_find(_ecore_directfb_key_symbols_hash, &key_symbol); |
||||
|
||||
if(!k) |
||||
{ |
||||
ERR("Symbol %0X of class DFEC_INPUT not found.", evt->input.key_symbol); |
||||
return; |
||||
} |
||||
|
||||
e->name = strdup(k->name); |
||||
e->string = strdup(k->string); |
||||
e->key_compose = NULL; |
||||
e->win = _ecore_directfb_fullscreen_window_id; |
||||
e->time = 0; |
||||
break; |
||||
|
||||
case DFEC_WINDOW: |
||||
key_symbol = evt->window.key_symbol; |
||||
k = eina_hash_find(_ecore_directfb_key_symbols_hash, &key_symbol); |
||||
|
||||
if(!k) |
||||
{ |
||||
ERR("Symbol %0X of class DFEC_WINDOW not found.", evt->window.key_symbol); |
||||
return; |
||||
} |
||||
|
||||
e->name = strdup(k->name); |
||||
e->string = strdup(k->string); |
||||
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 Eina_Bool |
||||
_ecore_directfb_input_event_fd_handler(void *data EINA_UNUSED,Ecore_Fd_Handler *fd_handler EINA_UNUSED) |
||||
{ |
||||
DFBEvent evt; |
||||
int v = 0; |
||||
|
||||
v = read(_input_event_fd, &evt, sizeof(DFBEvent)); |
||||
if (v < 0) |
||||
return EINA_TRUE; |
||||
|
||||
if (v < 1) |
||||
return EINA_TRUE; |
||||
|
||||
/* 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 EINA_TRUE; |
||||
} |
||||
|
||||
static Eina_Bool |
||||
_ecore_directfb_window_event_fd_handler(void *data EINA_UNUSED,Ecore_Fd_Handler *fd_handler EINA_UNUSED) |
||||
{ |
||||
DFBEvent evt; |
||||
int v = 0; |
||||
|
||||
v = read(_window_event_fd, &evt, sizeof(DFBEvent)); |
||||
if (v < 0) |
||||
return EINA_TRUE; |
||||
|
||||
if (v < 1) |
||||
return EINA_TRUE; |
||||
|
||||
if(evt.window.type & DWET_POSITION) |
||||
INF("position"); |
||||
|
||||
if(evt.window.type & DWET_SIZE) |
||||
INF("size"); |
||||
|
||||
if(evt.window.type & DWET_CLOSE) |
||||
INF("close"); |
||||
|
||||
if(evt.window.type & DWET_DESTROYED) |
||||
INF("destroyed"); |
||||
|
||||
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 EINA_TRUE; |
||||
} |
||||
|
||||
/* api functions */ |
||||
/*****************/ |
||||
|
||||
EAPI IDirectFB * |
||||
ecore_directfb_interface_get(void) |
||||
{ |
||||
return _dfb; |
||||
} |
||||
|
||||
EAPI 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; |
||||
} |
||||
|
||||
EAPI void |
||||
ecore_directfb_window_free(Ecore_DirectFB_Window *ecore_window) |
||||
{ |
||||
DFBCHECK(ecore_window->surface->Release(ecore_window->surface)); |
||||
DFBCHECK(ecore_window->window->Release(ecore_window->window)); |
||||
free(ecore_window); |
||||
} |
||||
|
||||
EAPI void |
||||
ecore_directfb_window_move(Ecore_DirectFB_Window *ecore_window, int x, int y) |
||||
{ |
||||
DFBCHECK(ecore_window->window->MoveTo(ecore_window->window, x, y)); |
||||
} |
||||
|
||||
EAPI void |
||||
ecore_directfb_window_resize(Ecore_DirectFB_Window *ecore_window, int w, int h) |
||||
{ |
||||
DFBCHECK(ecore_window->window->Resize(ecore_window->window, w, h)); |
||||
} |
||||
|
||||
EAPI void |
||||
ecore_directfb_window_focus(Ecore_DirectFB_Window *ecore_window) |
||||
{ |
||||
DFBCHECK(ecore_window->window->RequestFocus(ecore_window->window)); |
||||
} |
||||
|
||||
EAPI void |
||||
ecore_directfb_window_hide(Ecore_DirectFB_Window *ecore_window) |
||||
{ |
||||
DFBCHECK(ecore_window->window->SetOpacity(ecore_window->window, 0)); |
||||
} |
||||
|
||||
EAPI void |
||||
ecore_directfb_window_show(Ecore_DirectFB_Window *ecore_window) |
||||
{ |
||||
DFBCHECK(ecore_window->window->SetOpacity(ecore_window->window, 0xFF)); |
||||
} |
||||
|
||||
EAPI void |
||||
ecore_directfb_window_shaped_set(Ecore_DirectFB_Window *ecore_window, Eina_Bool 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)); |
||||
} |
||||
} |
||||
|
||||
EAPI void |
||||
ecore_directfb_window_cursor_show(Ecore_DirectFB_Window *ecore_window, Eina_Bool 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)); |
||||
} |
||||
} |
||||
} |
||||
|
||||
EAPI 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)); |
||||
} |
||||
} |
||||
|
||||
EAPI void |
||||
ecore_directfb_window_fullscreen_set(Ecore_DirectFB_Window *ecore_window, Eina_Bool 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 |
||||
{ |
||||
ecore_main_fd_handler_del(_input_event_fd_handler_handle); |
||||
DFBCHECK(_input_event->Release(_input_event)); |
||||
DFBCHECK(_layer->SetCooperativeLevel(_layer,DLSCL_SHARED)); |
||||
DFBCHECK(ecore_window->window->GetSurface(ecore_window->window, &ecore_window->surface)); |
||||
_ecore_directfb_fullscreen_window_id = 0; |
||||
} |
||||
} |
||||
|
||||
EAPI 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; |
||||
} |
||||
|
||||
EAPI int |
||||
ecore_directfb_init(const char *name EINA_UNUSED) |
||||
{ |
||||
int i = 0; |
||||
|
||||
if (++_ecore_directfb_init_count != 1) |
||||
return _ecore_directfb_init_count; |
||||
|
||||
_ecore_directfb_log_dom = eina_log_domain_register |
||||
("ecore_directfb", ECORE_DIRECTFB_DEFAULT_LOG_COLOR); |
||||
if(_ecore_directfb_log_dom < 0) |
||||
{ |
||||
EINA_LOG_ERR("Impossible to create a log domain for the Ecore directFB module."); |
||||
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 = eina_hash_int32_new(free); |
||||
for(i = 0; i < _ecore_directfb_key_symbols_count; i++) |
||||
{ |
||||
struct keymap *k; |
||||
k = malloc(sizeof(struct keymap)); |
||||
k->name = _ecore_directfb_key_symbols[i].name; |
||||
k->string = _ecore_directfb_key_symbols[i].string; |
||||
eina_hash_add(_ecore_directfb_key_symbols_hash, &_ecore_directfb_key_symbols[i].id, k); |
||||
} |
||||
/* create the hash for the windows(key = windowid, val = Ecore_DirectFB_Window struct) */ |
||||
return _ecore_directfb_init_count; |
||||
} |
||||
|
||||
EAPI int |
||||
ecore_directfb_shutdown(void) |
||||
{ |
||||
if (--_ecore_directfb_init_count != 0) |
||||
return _ecore_directfb_init_count; |
||||
|
||||
ecore_main_fd_handler_del(_window_event_fd_handler_handle); |
||||
eina_hash_free(_ecore_directfb_key_symbols_hash); |
||||
|
||||
if |