-#include "PUI.h"
#include "PUI_internal.h"
#include "PUI_backend.h"
+#include "PUI.h"
+
+#include <wayland-tbm-client.h>
+#include <tbm_surface_internal.h>
+#include <stdio.h>
+#include <dlfcn.h>
#ifndef PUI_MODULE_DIR
#define PUI_MODULE_DIR "/usr/lib"
#endif
-#define pui_err(msg, ...) \
- do { \
- fprintf(stderr, "[ERROR][%s] " msg, __FUNCTION__, ##__VA_ARGS__); \
- } while(0)
-
-#define pui_warn(msg, ...) \
- do { \
- fprintf(stderr, "[WARNING][%s] " msg, __FUNCTION__, ##__VA_ARGS__); \
- } while(0)
-
-#define pui_info(msg, ...) \
- do { \
- fprintf(stdout, "[INFO][%s] " msg, __FUNCTION__, ##__VA_ARGS__); \
- } while(0)
-
static int _pui_init_count = 0;
-static pui_module_data *pui_module = NUJLL;
+static pui_module_data *pui_module = NULL;
-EAPI int PUI_EVENT_ANI_STARTED = 0;
-EAPI int PUI_EVENT_ANI_STOPPED = 0;
-EAPI int PUI_EVENT_ANI_PAUSED = 0;
-EAPI int PUI_EVENT_ANI_READY_TO_START = 0;
-EAPI int PUI_EVENT_ANI_READY_TO_RESUME = 0;
-EAPI int PUI_EVENT_ANI_FRAME_DONE = 0;
-EAPI int PUI_EVENT_ANI_BUFFER_RELEASED = 0;
+int PUI_EVENT_ANI_STARTED = 0;
+int PUI_EVENT_ANI_STOPPED = 0;
+int PUI_EVENT_ANI_PAUSED = 0;
+int PUI_EVENT_ANI_READY_TO_START = 0;
+int PUI_EVENT_ANI_READY_TO_RESUME = 0;
+int PUI_EVENT_ANI_FRAME_DONE = 0;
+int PUI_EVENT_ANI_BUFFER_RELEASED = 0;
-const pui_error_string
+pui_error_string
pui_error_to_string(pui_error e)
{
- const pui_error_string str = NULL;
+ pui_error_string str = NULL;
switch (e)
{
str = "PUI_Invalid_Animation_Command";
break;
- case PUI_ERROR_INVALID_ANI_OPT:
- str = "PUI_Invalid_Animation_Option";
- break;
-
case PUI_ERROR_INTERNAL:
str = "PUI_Internal_Error";
break;
return str;
}
-static void
-_pui_cb_frame(Ecore_Wl2_Window *win, uint32_t timestamp EINA_UNUSED, void *data)
-{
- pui_h handle = (pui_h) data;
-
- TRACE("Frame done ! (window=%p)\n", win);
-
- // TODO
-
- return;
-}
-
pui_h
pui_create(Ecore_Wl2_Window *win)
{
pui_h handle = NULL;
- Ecore_Wl2_display *ewd = ecore_wl2_window_display_get(win);
+ Ecore_Wl2_Display *ewd = ecore_wl2_window_display_get(win);
struct wayland_tbm_client *wl_tbm_client = NULL;
- Ecore_Wl2_Frame_Cb_Handle *frame_cb = NULL;
if (!win || !ewd)
{
- pui_err("Invalid window or display !");
+ pui_err("Invalid window or display !\n");
return NULL;
}
if (!wl_tbm_client)
{
- pui_err("Failed to init wayland_tbm_client !");
+ pui_err("Failed to init wayland_tbm_client !\n");
return NULL;
}
void
pui_destroy(pui_h handle)
{
- pui_ani_h *ani_h = NULL;
+ pui_ani_h ani_h = NULL;
if (!handle)
return;
if (handle->tbm_queue)
{
tbm_surface_queue_destroy(handle->tbm_queue);
- handle->tbm_queue = NULL;
}
if (handle->wl_tbm_client)
free(handle);
}
-#define PREFIX_LIB "libpui_"
+#define PREFIX_LIB "libpui-"
#define SUFFIX_LIB ".so"
-#define DEFAULT_LIB PREFIX_LIB"default"SUFFIX_LIB
+#define DEFAULT_LIB PREFIX_LIB"default-backend"SUFFIX_LIB
static void
_pui_load_backend_module(void)
backend_module_minor = PUI_BACKEND_GET_ABI_MINOR(backend_module_info->abi_version);
if (backend_module_major > pui_backend_major) {
- TBM_ERR("PUI backend module ABI major ver(%d) is newer than the PUI's ver(%d)\n",
+ pui_err("PUI backend module ABI major ver(%d) is newer than the PUI's ver(%d)\n",
backend_module_major, pui_backend_major);
goto err;
} else if (backend_module_minor > pui_backend_minor) {
- TBM_ERR("PUI backend module ABI minor ver(%d) is newer than the PUI's ver(%d)\n",
+ pui_err("PUI backend module ABI minor ver(%d) is newer than the PUI's ver(%d)\n",
backend_module_minor, pui_backend_minor);
goto err;
}
return;
err:
- if (backend_module_info)
- backend_module_info->backend_deinit
+ if (backend_module_info && backend_module_info->backend_init)
+ backend_module_info->backend_deinit(backend_module_data);
if (module_info)
dlclose(module_info);
}
static void
+_pui_load_backend_collect_animations(void)
+{
+ pui_int_error ret;
+
+ if (!pui_module || !pui_module->backend_module_data) {
+ pui_err("pui module data is not loaded\n");
+ return;
+ }
+
+ ret = pui_module->backend_module_data->create_ani_collection();
+ if (ret != PUI_INT_ERROR_NONE) {
+ pui_err("Failed to collect animations data (%s)\n",
+ pui_error_to_string(ret));
+ }
+}
+
+static void
_pui_load(void)
{
_pui_load_backend_module();
+ _pui_load_backend_collect_animations();
}
static void