Compare commits

..

1 Commits

Author SHA1 Message Date
Marcel Hollerbach 83821cd4e5 WIP 2017-11-01 15:23:09 +01:00
22 changed files with 495 additions and 1338 deletions

1
.gitignore vendored
View File

@ -11,6 +11,7 @@ Makefile.in
.*.sw[po]
*.gcov
*.gcno
/README
/aclocal.m4
/autom4te.cache/
/config.cache

View File

@ -18,7 +18,7 @@ find_package(Elementary REQUIRED)
find_package(Ecore REQUIRED)
find_package(Evas REQUIRED)
find_package(Ffi REQUIRED)
find_package(efl_profiler QUIET)
find_package(efl_profiler)
add_subdirectory(src/bin)
add_subdirectory(src/lib)

28
README
View File

@ -1,28 +0,0 @@
Clouseau
Clouseau is a UI inspection tool aimed to debug EFL applications.
Requirements:
efl (1.20 +)
Compiling:
1. mkdir build
2. cd build
3. cmake -DCMAKE_INSTALL_PREFIX=/your_install_path ..
4. make
5. (sudo) make install
How to use it?
1. Run efl_debugd on the machine where the program to debug has to run
2. Run your program
3. Run clouseau_client -l / -r [port]
4. Choose the extension you want to use
5. Choose your application
clouseau_client can run in three modes:
- locally: it connects to the local daemon (efl_debugd)
- remotely: you have to establish a connection (SSH...) and to supply the port to use to Clouseau
- offline: this is for the case you want to visualize a snapshot saved earlier

View File

@ -24,6 +24,7 @@ add_executable(clouseau_client ${SOURCES})
target_link_libraries(clouseau_client
pthread
clouseau_debug
${EFL_LIBRARIES}
${ELEMENTARY_LIBRARIES}
${EINA_LIBRARIES}
@ -36,4 +37,3 @@ target_link_libraries(clouseau_client
)
install(TARGETS clouseau_client DESTINATION bin)
install(PROGRAMS clouseau DESTINATION bin)

View File

@ -1,11 +0,0 @@
#!/bin/sh
if [ $# -lt 1 ]
then
echo "Usage: clouseau <executable> [executable parameters]"
else
# Start the local daemon. In case it is already running, it exits directly.
efl_debugd &
# Start the application
$@ &
clouseau_client -l -p $!
fi

View File

@ -10,11 +10,9 @@
#include <getopt.h>
#include <Efreet.h>
#include <Efl_Ui.h>
#include <Elementary.h>
#include <Evas.h>
#include <Ecore_File.h>
#include <Eo.h>
#include "gui.h"
#include "Clouseau.h"
@ -89,8 +87,7 @@ struct _Extension_Config
typedef struct
{
Eina_List *import_extensions_cfgs;
Eina_List *extensions_cfgs; /* Imported + auto-loaded*/
Eina_List *extensions_cfgs;
const char *last_extension_name;
} Config;
@ -119,7 +116,6 @@ static Config *_config = NULL;
static Eina_List *_extensions = NULL;
static int _selected_port = -1;
static int _arg_pid = -1;
static Eina_Bool _clients_info_added_cb(Eina_Debug_Session *, int, void *, int);
static Eina_Bool _clients_info_deleted_cb(Eina_Debug_Session *, int, void *, int);
@ -127,8 +123,6 @@ static Eina_Bool _clients_info_deleted_cb(Eina_Debug_Session *, int, void *, int
static void _extension_view(void *, Evas_Object *, void *);
static void _fs_extension_import_show(void *, Evas_Object *, void *);
static void _connection_type_change(Connection_Type);
EINA_DEBUG_OPCODES_ARRAY_DEFINE(_ops,
{"Daemon/Client/register_observer", &_cl_stat_reg_op, NULL},
{"Daemon/Client/added", NULL, _clients_info_added_cb},
@ -165,7 +159,7 @@ _config_eet_load()
EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Config);
_config_edd = eet_data_descriptor_stream_new(&eddc);
EET_DATA_DESCRIPTOR_ADD_LIST(_config_edd, Config, "import_extensions_cfgs", import_extensions_cfgs, ext_edd);
EET_DATA_DESCRIPTOR_ADD_LIST(_config_edd, Config, "extensions_cfgs", extensions_cfgs, ext_edd);
EET_DATA_DESCRIPTOR_ADD_BASIC(_config_edd, Config, "last_extension_name",
last_extension_name, EET_T_STRING);
}
@ -211,8 +205,8 @@ static void
_ui_freeze(Clouseau_Extension *ext EINA_UNUSED, Eina_Bool on)
{
elm_progressbar_pulse(_main_widgets->freeze_pulse, on);
efl_gfx_entity_visible_set(_main_widgets->freeze_pulse, on);
efl_gfx_entity_visible_set(_main_widgets->freeze_inwin, on);
efl_gfx_visible_set(_main_widgets->freeze_pulse, on);
efl_gfx_visible_set(_main_widgets->freeze_inwin, on);
}
static Extension_Config *
@ -282,32 +276,15 @@ _extension_configs_validate()
if (ext_cfg->menu_item || !ext_cfg->name) continue;
ext_cfg->menu_item = elm_menu_item_add(_main_widgets->ext_selector_menu,
NULL, NULL, ext_cfg->name, _extension_view, ext_cfg);
elm_object_item_tooltip_text_set(ext_cfg->menu_item, ext_cfg->lib_path);
efl_wref_add(ext_cfg->menu_item, &ext_cfg->menu_item);
if (!ext_cfg->ready) elm_object_item_disabled_set(ext_cfg->menu_item, EINA_TRUE);
}
}
static void
_ext_cfg_load(const char *name, const char *path, void *data EINA_UNUSED)
{
if (strncmp(name, "libclouseau_", 12)) return;
if (!eina_str_has_suffix(name, ".so")) return;
if (!_ext_cfg_find_by_path(path))
{
Extension_Config *ext_cfg;
char fname[1024];
sprintf(fname, "%s/%s", path, name);
ext_cfg = calloc(1, sizeof(*ext_cfg));
ext_cfg->lib_path = eina_stringshare_add(fname);
_config->extensions_cfgs = eina_list_append(_config->extensions_cfgs, ext_cfg);
}
}
static void
_configs_load()
{
Extension_Config *ext_cfg;
char path[1024];
sprintf(path, "%s/clouseau", efreet_config_home_get());
@ -326,8 +303,26 @@ _configs_load()
eet_close(file);
}
_config->extensions_cfgs = eina_list_clone(_config->import_extensions_cfgs);
eina_file_dir_list(INSTALL_PREFIX"/lib", EINA_TRUE, _ext_cfg_load, NULL);
if (!_ext_cfg_find_by_path(INSTALL_PREFIX"/lib/libclouseau_objects_introspection.so"))
{
ext_cfg = calloc(1, sizeof(*ext_cfg));
ext_cfg->lib_path = eina_stringshare_add(INSTALL_PREFIX"/lib/libclouseau_objects_introspection.so");
_config->extensions_cfgs = eina_list_append(_config->extensions_cfgs, ext_cfg);
}
if (!_ext_cfg_find_by_path(INSTALL_PREFIX"/lib/libclouseau_evlog.so"))
{
ext_cfg = calloc(1, sizeof(*ext_cfg));
ext_cfg->lib_path = eina_stringshare_add(INSTALL_PREFIX"/lib/libclouseau_evlog.so");
_config->extensions_cfgs = eina_list_append(_config->extensions_cfgs, ext_cfg);
}
if (!_ext_cfg_find_by_path(INSTALL_PREFIX"/lib/libclouseau_profiling_viewer.so"))
{
ext_cfg = calloc(1, sizeof(*ext_cfg));
ext_cfg->lib_path = eina_stringshare_add(INSTALL_PREFIX"/lib/libclouseau_profiling_viewer.so");
_config->extensions_cfgs = eina_list_append(_config->extensions_cfgs, ext_cfg);
}
_config_save();
}
@ -432,10 +427,6 @@ _clients_info_added_cb(Eina_Debug_Session *session EINA_UNUSED, int src EINA_UNU
NULL, "home", name, _menu_selected_app, ai);
efl_wref_add(ai->menu_item, &ai->menu_item);
}
if (_arg_pid == pid)
{
_menu_selected_app(ai, _main_widgets->apps_selector_menu, ai->menu_item);
}
}
len = strlen(buf) + 1;
buf += len;
@ -505,8 +496,8 @@ _session_populate()
case OFFLINE:
{
if (ext->session_changed_cb) ext->session_changed_cb(ext);
break;
}
break;
case LOCAL_CONNECTION:
{
ext->session = eina_debug_local_connect(EINA_TRUE);
@ -526,89 +517,6 @@ _session_populate()
}
}
static void
_dialog_cancel(void *data, const Efl_Event *ev EINA_UNUSED)
{
Eo *win = data;
efl_del(win);
}
static void
_dialog_box_create(const char *title, const char *content, const char *but1_str, const char *but2_str,
Efl_Event_Cb cb1, Efl_Event_Cb cb2)
{
Eo *win, *bx, *lb;
win = efl_add(EFL_UI_WIN_CLASS, _main_widgets->main_win,
efl_ui_win_type_set(efl_added, ELM_WIN_DIALOG_BASIC),
efl_ui_win_autodel_set(efl_added, EINA_TRUE),
efl_text_set(efl_added, title),
efl_gfx_entity_visible_set(efl_added, EINA_TRUE));
bx = efl_add(EFL_UI_BOX_CLASS, win,
efl_ui_layout_orientation_set(efl_added, EFL_UI_LAYOUT_ORIENTATION_VERTICAL),
efl_gfx_hint_weight_set(efl_added, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND),
efl_gfx_hint_align_set(efl_added, EVAS_HINT_FILL, EVAS_HINT_FILL),
efl_gfx_entity_visible_set(efl_added, EINA_TRUE));
efl_content_set(win, bx);
lb = efl_add(EFL_UI_TEXTBOX_CLASS, bx,
efl_text_multiline_set(efl_added, EINA_TRUE),
efl_text_interactive_editable_set(efl_added, EINA_FALSE),
efl_text_horizontal_align_set(efl_added, 0.5),
efl_text_set(efl_added, content),
efl_gfx_hint_weight_set(efl_added, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND),
efl_gfx_hint_align_set(efl_added, EVAS_HINT_FILL, EVAS_HINT_FILL),
efl_gfx_entity_visible_set(efl_added, EINA_TRUE));
efl_pack(bx, lb);
if (but1_str || but2_str)
{
Eo *bx2;
bx2 = efl_add(EFL_UI_BOX_CLASS, win,
efl_ui_layout_orientation_set(efl_added, EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL),
efl_gfx_hint_weight_set(efl_added, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND),
efl_gfx_hint_align_set(efl_added, EVAS_HINT_FILL, EVAS_HINT_FILL),
efl_gfx_entity_visible_set(efl_added, EINA_TRUE));
efl_pack(bx, bx2);
if (but1_str)
{
Eo *bt1 = efl_add(EFL_UI_BUTTON_CLASS, bx2,
efl_text_set(efl_added, but1_str),
efl_gfx_hint_weight_set(efl_added, 0, 0),
efl_gfx_entity_visible_set(efl_added, EINA_TRUE));
if (cb1) efl_event_callback_add(bt1, EFL_INPUT_EVENT_CLICKED, cb1, win);
efl_pack(bx2, bt1);
}
if (but2_str)
{
Eo *bt2 = efl_add(EFL_UI_BUTTON_CLASS, bx2,
efl_text_set(efl_added, but2_str),
efl_gfx_hint_weight_set(efl_added, 0, 0),
efl_gfx_entity_visible_set(efl_added, EINA_TRUE));
if (cb2) efl_event_callback_add(bt2, EFL_INPUT_EVENT_CLICKED, cb2, win);
efl_pack(bx2, bt2);
}
}
}
static Eina_Bool
_local_reconnect(void *data EINA_UNUSED)
{
_connection_type_change(LOCAL_CONNECTION);
return ECORE_CALLBACK_CANCEL;
}
static void
_daemon_launch(void *data, const Efl_Event *ev EINA_UNUSED)
{
Eo *win = data;
ecore_exe_pipe_run("efl_debugd", ECORE_EXE_NONE, NULL);
ecore_timer_add(1.0, _local_reconnect, NULL);
efl_del(win);
}
static void
_connection_type_change(Connection_Type conn_type)
{
@ -636,40 +544,16 @@ _connection_type_change(Connection_Type conn_type)
case LOCAL_CONNECTION:
{
_selected_port = -1;
elm_object_item_disabled_set(_main_widgets->apps_selector, EINA_FALSE);
_session = eina_debug_local_connect(EINA_TRUE);
if (!_session)
{
_dialog_box_create("Can't connect",
"Clouseau cannot connect to the local daemon.\nDo you want Clouseau to launch it?",
"Launch", "Don't launch and stay offline",
_daemon_launch, _dialog_cancel);
_connection_type_change(OFFLINE);
return;
}
else
{
elm_object_item_disabled_set(_main_widgets->apps_selector, EINA_FALSE);
eina_debug_session_dispatch_override(_session, _disp_cb);
}
eina_debug_session_dispatch_override(_session, _disp_cb);
break;
}
case REMOTE_CONNECTION:
{
elm_object_item_disabled_set(_main_widgets->apps_selector, EINA_FALSE);
_session = eina_debug_remote_connect(_selected_port);
if (!_session)
{
_dialog_box_create("Can't connect",
"Clouseau cannot connect to the remote daemon.\nCheck it is running on the remote device and\nthat the port forwarding (e.g SSH) has been set.",
"Ok", NULL,
_dialog_cancel, NULL);
_connection_type_change(OFFLINE);
return;
}
else
{
eina_debug_session_dispatch_override(_session, _disp_cb);
}
eina_debug_session_dispatch_override(_session, _disp_cb);
break;
}
default: return;
@ -693,10 +577,10 @@ _connection_type_change(Connection_Type conn_type)
}
void
remote_port_entry_changed(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
remote_port_entry_changed(void *data, const Efl_Event *event)
{
Eo *inwin = data;
const char *ptr = elm_entry_entry_get(obj);
const char *ptr = elm_entry_entry_get(event->object);
_selected_port = atoi(ptr);
_connection_type_change(REMOTE_CONNECTION);
efl_del(inwin);
@ -788,7 +672,6 @@ _fs_extension_import(void *data, Evas_Object *fs EINA_UNUSED, void *ev)
{
Extension_Config *ext_cfg = calloc(1, sizeof(*ext_cfg));
ext_cfg->lib_path = eina_stringshare_add(filename);
_config->import_extensions_cfgs = eina_list_append(_config->import_extensions_cfgs, ext_cfg);
_config->extensions_cfgs = eina_list_append(_config->extensions_cfgs, ext_cfg);
_config_save();
_extension_configs_validate();
@ -895,13 +778,13 @@ _extensions_cfgs_inwin_create(const char *filename)
Eo *box = elm_box_add(inwin);
evas_object_size_hint_weight_set(box, 1, 1);
evas_object_size_hint_align_set(box, -1, -1);
efl_gfx_entity_visible_set(box, EINA_TRUE);
efl_gfx_visible_set(box, EINA_TRUE);
Eo *label = elm_label_add(box);
Eo *label = efl_add(ELM_LABEL_CLASS, box);
elm_object_text_set(label, "Choose an extension to open the file with:");
evas_object_size_hint_align_set(label, 0, -1);
evas_object_size_hint_weight_set(label, 1, 1);
efl_gfx_entity_visible_set(label, EINA_TRUE);
efl_gfx_visible_set(label, EINA_TRUE);
elm_box_pack_end(box, label);
Eo *list = elm_list_add(inwin);
@ -1051,14 +934,6 @@ save_load_perform(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *ev
else _fs_activate(EINA_FALSE);
}
static void
_main_window_del(void *data EINA_UNUSED,
Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
_all_extensions_delete();
}
EAPI_MAIN int
elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
{
@ -1078,13 +953,12 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
{"help", no_argument, 0, 'h'},
{"local", no_argument, 0, 'l'},
{"remote", required_argument, 0, 'r'},
{"pid", required_argument, 0, 'p'},
{"file", required_argument, 0, 'f'},
{0, 0, 0, 0}
};
while ((opt = getopt_long(argc, argv,"hlr:p:f:", long_options, &long_index )) != -1)
while ((opt = getopt_long(argc, argv,"hlr:f:", long_options, &long_index )) != -1)
{
if (opt != 'p' && (conn_type != OFFLINE || offline_filename))
if (conn_type != OFFLINE || offline_filename)
{
printf("You cannot use more than one option at a time\n");
help = EINA_TRUE;
@ -1108,11 +982,6 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
offline_filename = eina_stringshare_add(optarg);
break;
}
case 'p':
{
_arg_pid = atoi(optarg);
break;
}
case 'h': help = EINA_TRUE; break;
default: help = EINA_TRUE;
}
@ -1123,15 +992,12 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
printf(" --help/-h Print that help\n");
printf(" --local/-l Create a local connection\n");
printf(" --remote/-r Create a remote connection by using the given port\n");
printf(" --pid/-p PID of the program to connect to\n");
printf(" --file/-f Run in offline mode and load the given file\n");
return 0;
}
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
_main_widgets = gui_main_win_create(NULL);
evas_object_smart_callback_add(_main_widgets->main_win, "delete,request",
_main_window_del, NULL);
for (i = 0; i < LAST_CONNECTION; i++)
{

View File

@ -8,6 +8,9 @@
#define ELM_INTERNAL_API_ARGESFSDFEFC
#endif
#include <Elementary.h>
#include "elm_widget_container.h"
#include "elm_interface_scrollable.h"
#include "elm_interface_fileselector.h"
#include "gui.h"
extern void
@ -15,7 +18,7 @@ conn_menu_show(void *data, Evas_Object *obj, void *event_info);
extern void
save_load_perform(void *data, Evas_Object *obj, void *event_info);
extern void
remote_port_entry_changed(void *data, Evas_Object *obj, void *event_info);
remote_port_entry_changed(void *data, const Efl_Event *event);
static void
_pubs_free_cb(void *data, const Efl_Event *event EINA_UNUSED)
@ -40,17 +43,17 @@ gui_main_win_create(Eo *__main_parent)
pub_widgets->main_win = main_win;
elm_win_autodel_set(main_win, EINA_TRUE);
elm_win_title_set(main_win, "Clouseau");
efl_gfx_entity_size_set(main_win, EINA_SIZE2D(478, 484));
efl_gfx_size_set(main_win, EINA_SIZE2D(478, 484));
bg = elm_bg_add(main_win);
evas_object_size_hint_weight_set(bg, 1.000000, 1.000000);
efl_gfx_entity_visible_set(bg, EINA_TRUE);
efl_gfx_entity_position_set(bg, EINA_POSITION2D(0, 0));
efl_gfx_visible_set(bg, EINA_TRUE);
efl_gfx_position_set(bg, EINA_POSITION2D(0, 0));
elm_win_resize_object_add(main_win, bg);
main_box = elm_box_add(main_win);
evas_object_size_hint_weight_set(main_box, 1.000000, 1.000000);
efl_gfx_entity_visible_set(main_box, EINA_TRUE);
efl_gfx_visible_set(main_box, EINA_TRUE);
elm_win_resize_object_add(main_win, main_box);
tb = elm_toolbar_add(main_win);
@ -82,7 +85,7 @@ gui_main_win_create(Eo *__main_parent)
*/
elm_box_pack_end(main_box, tb);
efl_gfx_entity_visible_set(tb, EINA_TRUE);
efl_gfx_visible_set(tb, EINA_TRUE);
freeze_pulse = elm_progressbar_add(main_win);
pub_widgets->freeze_pulse = freeze_pulse;
@ -98,14 +101,14 @@ gui_main_win_create(Eo *__main_parent)
pub_widgets->ext_box = ext_box;
evas_object_size_hint_weight_set(ext_box, 1.000000, 1.000000);
evas_object_size_hint_align_set(ext_box, -1.000000, -1.000000);
efl_gfx_entity_visible_set(ext_box, EINA_TRUE);
efl_gfx_visible_set(ext_box, EINA_TRUE);
elm_box_pack_end(main_box, ext_box);
freeze_inwin = elm_win_inwin_add(main_win);
pub_widgets->freeze_inwin = freeze_inwin;
elm_object_style_set(freeze_inwin, "minimal");
efl_gfx_entity_visible_set(main_win, EINA_TRUE);
efl_gfx_visible_set(main_win, EINA_TRUE);
efl_event_callback_add(main_win, EFL_EVENT_DEL, _pubs_free_cb, pub_widgets);
return pub_widgets;
@ -126,7 +129,7 @@ gui_remote_port_win_create(Eo *__main_parent)
elm_entry_scrollable_set(entry, EINA_TRUE);
elm_entry_single_line_set(entry, EINA_TRUE);
elm_object_part_text_set(entry, "guide", "Port to connect to remote device");
evas_object_smart_callback_add(entry, "activated", remote_port_entry_changed, inwin);
efl_event_callback_add(entry, ELM_ENTRY_EVENT_ACTIVATED, remote_port_entry_changed, inwin);
evas_object_show(entry);
elm_win_inwin_content_set(inwin, entry);

View File

@ -16,8 +16,6 @@ target_link_libraries(clouseau_debug
${EINA_LIBRARIES}
${EO_LIBRARIES}
${EOLIAN_LIBRARIES}
${EVAS_LIBRARIES}
${ELEMENTARY_LIBRARIES}
${FFI_LIBRARIES}
)

View File

@ -51,14 +51,16 @@ typedef enum
EOLIAN_DEBUG_UINT,
EOLIAN_DEBUG_LIST,
EOLIAN_DEBUG_OBJECT,
EOLIAN_DEBUG_VOID,
EOLIAN_DEBUG_STRUCT
EOLIAN_DEBUG_VOID
} Eolian_Debug_Basic_Type;
typedef struct
{
Eolian_Debug_Basic_Type type;
uint64_t value;
union
{
uint64_t value;
} value;
Eina_List *complex_type_values;
} Eolian_Debug_Value;
@ -119,14 +121,6 @@ typedef struct {
Evas_Object *vis;
} Clouseau_Focus_Relation;
typedef struct {
uintptr_t ptr;
const char *helper_name;
} Clouseau_Focus_List_Item;
typedef struct {
Eina_List *managers;
} Clouseau_Focus_Managers;
EAPI void *eo_debug_eoids_request_prepare(int *size, ...);

View File

@ -9,6 +9,7 @@
#include <Evas.h>
#include <Elementary.h>
#define ELM_INTERNAL_API_ARGESFSDFEFC
#include <elm_widget.h>
#include "Clouseau_Debug.h"
@ -73,9 +74,7 @@ static int _win_screenshot_op = EINA_DEBUG_OPCODE_INVALID;
static int _focus_manager_list_op = EINA_DEBUG_OPCODE_INVALID;
static int _focus_manager_detail_op = EINA_DEBUG_OPCODE_INVALID;
static Eolian_State *eos = NULL;
static Eet_Data_Descriptor *manager_details = NULL, *manager_list = NULL;
static Eet_Data_Descriptor *managers = NULL, *manager_details = NULL;
#include "clouseau_focus_serialization.x"
enum {
@ -132,8 +131,6 @@ const Debug_Param_Info debug_types[] =
{EOLIAN_DEBUG_UINT, "%u", &ffi_type_uint, 4},
{EOLIAN_DEBUG_LIST, "%p", &ffi_type_pointer, 8},
{EOLIAN_DEBUG_OBJECT, "%p", &ffi_type_pointer, 8},
{EOLIAN_DEBUG_VOID, "%p", &ffi_type_pointer, 8},
{EOLIAN_DEBUG_STRUCT, "%p", &ffi_type_pointer, 8},
{0, NULL, 0, 0}
};
@ -143,8 +140,10 @@ typedef struct
const Eolian_Class *kl;
} Eolian_Info;
static Eina_Hash *_eolian_kls_hash = NULL;
static Eolian_Debug_Basic_Type
_eolian_type_resolve(const Eolian_Type *eo_type)
_eolian_type_resolve(const Eolian_Unit *unit, const Eolian_Type *eo_type)
{
Eolian_Type_Type type = eolian_type_type_get(eo_type);
Eolian_Type_Type type_base = type;
@ -153,14 +152,13 @@ _eolian_type_resolve(const Eolian_Type *eo_type)
if (type_base == EOLIAN_TYPE_REGULAR)
{
const Eolian_Typedecl *tdecl;
const char *full_name = eolian_type_name_get(eo_type);
const Eolian_Typedecl *alias = eolian_state_alias_by_name_get(eos, full_name);
const char *full_name = eolian_type_full_name_get(eo_type);
const Eolian_Typedecl *alias = eolian_typedecl_alias_get_by_name(unit, full_name);
if (alias)
{
eo_type = eolian_typedecl_base_type_get(alias);
type_base = eolian_type_type_get(eo_type);
full_name = eolian_type_name_get(eo_type);
full_name = eolian_type_full_name_get(eo_type);
}
if (full_name)
@ -170,67 +168,61 @@ _eolian_type_resolve(const Eolian_Type *eo_type)
if (!strcmp(full_name, eolian_types[i].name) &&
eolian_types[i].etype == type) return i;
}
tdecl = eolian_type_typedecl_get(eo_type);
if (tdecl && eolian_typedecl_type_get(tdecl) == EOLIAN_TYPEDECL_STRUCT)
return EOLIAN_DEBUG_STRUCT;
}
return EOLIAN_DEBUG_INVALID_TYPE;
}
static ffi_type *
_ffi_type_struct_get(const Eolian_Type *eo_type)
static const Eolian_Class *
_class_find_by_name(const char *eo_klname, const Eolian_Unit **unit)
{
const Eolian_Struct_Type_Field *f;
const Eolian_Typedecl *tdecl;
Eina_Iterator *iter;
int i = 0, count = 0;
ffi_type **types;
ffi_type *s_type = calloc(1, sizeof(*s_type));
const Eolian_Class *kl = NULL;
if (!eo_klname) return NULL;
s_type->type = FFI_TYPE_STRUCT;
tdecl = eolian_type_typedecl_get(eo_type);
iter = eolian_typedecl_struct_fields_get(tdecl);
EINA_ITERATOR_FOREACH(iter, f) count++;
eina_iterator_free(iter);
types = calloc(1, count * sizeof(ffi_type *));
s_type->elements = types;
iter = eolian_typedecl_struct_fields_get(tdecl);
EINA_ITERATOR_FOREACH(iter, f)
Eolian_Info *info = eina_hash_find(_eolian_kls_hash, eo_klname);
if (info)
{
const Eolian_Type *feo_type = eolian_typedecl_struct_field_type_get(f);
Eolian_Debug_Basic_Type ftype = _eolian_type_resolve(feo_type);
types[i++] = debug_types[ftype].ffi_type_p;
*unit = info->unit;
return info->kl;
}
types[i] = NULL;
eina_iterator_free(iter);
return s_type;
}
unsigned int
_struct_mem_len_get(const Eolian_Type *eo_type)
{
const Eolian_Struct_Type_Field *f;
const Eolian_Typedecl *tdecl;
Eina_Iterator *iter;
unsigned int len = 0;
char *klname = strdup(eo_klname);
tdecl = eolian_type_typedecl_get(eo_type);
iter = eolian_typedecl_struct_fields_get(tdecl);
EINA_ITERATOR_FOREACH(iter, f)
Eina_Strbuf *buf = eina_strbuf_new();
eina_strbuf_append(buf, eo_klname);
eina_strbuf_replace_all(buf, ".", "_");
eina_strbuf_append(buf, ".eo");
char *tmp = eina_strbuf_string_steal(buf);
eina_strbuf_free(buf);
eina_str_tolower(&tmp);
*unit = eolian_file_parse(tmp);
free(tmp);
tmp = klname;
do
{
const Eolian_Type *feo_type = eolian_typedecl_struct_field_type_get(f);
Eolian_Debug_Basic_Type ftype = _eolian_type_resolve(feo_type);
len += debug_types[ftype].size;
kl = eolian_class_get_by_name(*unit, klname);
if (kl) goto end;
while (*tmp && *tmp != '_') tmp++;
if (*tmp) *tmp = '.';
}
eina_iterator_free(iter);
return len;
while (*tmp);
printf("Class %s not found.\n", klname);
end:
if(kl)
{
info = calloc(1, sizeof(*info));
info->unit = *unit;
info->kl = kl;
eina_hash_set(_eolian_kls_hash, eo_klname, info);
}
free(klname);
return kl;
}
static int
_function_invoke(Eo *ptr, const Eolian_Function *foo, Eolian_Function_Type foo_type,
_function_invoke(Eo *ptr, const Eolian_Unit *unit, const Eolian_Function *foo, Eolian_Function_Type foo_type,
Eolian_Debug_Parameter *params, Eolian_Debug_Return *ret)
{
/* The params table contains the keys and the values.
@ -238,9 +230,7 @@ _function_invoke(Eo *ptr, const Eolian_Function *foo, Eolian_Function_Type foo_t
ffi_type *types[EOLIAN_DEBUG_MAXARGS]; /* FFI types */
void *values[EOLIAN_DEBUG_MAXARGS]; /* FFI Values */
void *pointers[EOLIAN_DEBUG_MAXARGS]; /* Used as values for out params, as we have to give a pointer to a pointer */
void *result = NULL;
Eolian_Function_Parameter *eo_param;
const Eolian_Type *eo_type;
Eina_Iterator *itr;
Eolian_Debug_Basic_Type ed_type;
int argc, ffi_argc = 0;
@ -258,12 +248,11 @@ _function_invoke(Eo *ptr, const Eolian_Function *foo, Eolian_Function_Type foo_t
EINA_ITERATOR_FOREACH(itr, eo_param)
{
/* Not verified */
eo_type = eolian_parameter_type_get(eo_param);
ed_type = _eolian_type_resolve(eo_type);
ed_type = _eolian_type_resolve(unit, eolian_parameter_type_get(eo_param));
if (!ed_type) goto error;
types[ffi_argc] = debug_types[ed_type].ffi_type_p;
values[ffi_argc] = &(params[argc].value.value);
values[ffi_argc] = &(params[argc].value.value.value);
params[argc].eparam = eo_param;
ffi_argc++;
argc++;
@ -273,90 +262,70 @@ _function_invoke(Eo *ptr, const Eolian_Function *foo, Eolian_Function_Type foo_t
eolian_property_values_get(foo, foo_type);
EINA_ITERATOR_FOREACH(itr, eo_param)
{
eo_type = eolian_parameter_type_get(eo_param);
ed_type = _eolian_type_resolve(eo_type);
ed_type = _eolian_type_resolve(unit, eolian_parameter_type_get(eo_param));
if (!ed_type) goto error;
params[argc].eparam = eo_param;
if (foo_type == EOLIAN_PROP_GET ||
(foo_type == EOLIAN_METHOD && eolian_parameter_direction_get(eo_param) == EOLIAN_PARAMETER_OUT))
(foo_type == EOLIAN_METHOD && eolian_parameter_direction_get(eo_param) == EOLIAN_OUT_PARAM))
{
/* Out parameter */
if (ed_type == EOLIAN_DEBUG_STRUCT)
{
params[argc].value.value = (uint64_t) calloc(_struct_mem_len_get(eo_type), 1);
pointers[ffi_argc] = (char *)params[argc].value.value;
}
else
{
params[argc].value.value = 0;
pointers[ffi_argc] = &(params[argc].value.value);
}
params[argc].value.value.value = 0;
params[argc].value.type = ed_type;
types[ffi_argc] = &ffi_type_pointer;
pointers[ffi_argc] = &(params[argc].value.value.value);
values[ffi_argc] = &pointers[ffi_argc];
}
else
{
/* In parameter */
types[ffi_argc] = debug_types[ed_type].ffi_type_p;
values[ffi_argc] = &(params[argc].value.value);
values[ffi_argc] = &(params[argc].value.value.value);
}
ffi_argc++;
argc++;
}
eo_type = eolian_function_return_type_get(foo, foo_type);
Eina_Bool param_as_ret = EINA_FALSE;
const Eolian_Type *eo_type = eolian_function_return_type_get(foo, foo_type);
ffi_type *ffi_ret_type = &ffi_type_void;
if (eo_type)
{
ed_type = _eolian_type_resolve(eo_type);
ed_type = _eolian_type_resolve(unit, eo_type);
if (!ed_type) goto error;
ffi_ret_type = debug_types[ed_type].ffi_type_p;
}
else if (argc == 1 && foo_type == EOLIAN_PROP_GET)
{
param_as_ret = EINA_TRUE;
eo_type = eolian_parameter_type_get(params[0].eparam);
ed_type = _eolian_type_resolve(eo_type);
if (ed_type == EOLIAN_DEBUG_STRUCT)
{
ffi_ret_type = _ffi_type_struct_get(eo_type);
}
else
{
ffi_ret_type = debug_types[params[0].value.type].ffi_type_p;
}
result = (char *)params[0].value.value;
/* If there is no return type but only one value is present, the value will
* be returned by the function.
* So we need FFI to not take it into account when invoking the function.
*/
ffi_ret_type = debug_types[params[0].value.type].ffi_type_p;
ffi_argc--;
}
const char *full_func_name = eolian_function_full_c_name_get(foo, EOLIAN_PROP_GET);
const char *full_func_name = eolian_function_full_c_name_get(foo, EOLIAN_PROP_GET, EINA_FALSE);
void *eo_func = dlsym(RTLD_DEFAULT, full_func_name);
if (!eo_func) goto error;
ffi_cif cif;
if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, ffi_argc,
ffi_ret_type, types) == FFI_OK)
{
ffi_call(&cif, eo_func, result?result:&result, values);
ret->value.type = EOLIAN_DEBUG_VOID;
void *result;
ffi_call(&cif, eo_func, &result, values);
if (ret) ret->value.type = EOLIAN_DEBUG_VOID;
if (eo_type)
{
if (!param_as_ret)
if (ret)
{
ret->value.value = (uint64_t) result;
ret->value.value.value = (uint64_t) result;
ret->value.type = ed_type;
ret->etype = eo_type;
}
else
params[0].value.value = (uint64_t) result;
}
else if (argc == 1 && foo_type == EOLIAN_PROP_GET)
params[0].value.value.value = (uint64_t) result;
goto success;
}
@ -454,7 +423,7 @@ _param_buffer_fill(char *buf, uint64_t v, int size)
}
static int
_complex_buffer_fill(char *buf, const Eolian_Type *eo_type, uint64_t value)
_complex_buffer_fill(const Eolian_Unit *unit, char *buf, const Eolian_Type *eo_type, uint64_t value)
{
Eina_List *l = NULL;
const char *eo_tname = eolian_type_name_get(eo_type);
@ -484,7 +453,7 @@ _complex_buffer_fill(char *buf, const Eolian_Type *eo_type, uint64_t value)
}
}
type = _eolian_type_resolve(eolian_type_base_type_get(eo_type));
type = _eolian_type_resolve(unit, eolian_type_base_type_get(eo_type));
if (type != EOLIAN_DEBUG_INVALID_TYPE) count = SWAP_32(eina_list_count(l));
@ -499,42 +468,25 @@ _complex_buffer_fill(char *buf, const Eolian_Type *eo_type, uint64_t value)
return size;
}
static int
_struct_buffer_fill(char *buf, const Eolian_Type *eo_type, char *str_buf)
{
int size = 0;
const Eolian_Struct_Type_Field *f;
const Eolian_Typedecl *tdecl = eolian_type_typedecl_get(eo_type);
Eina_Iterator *iter = eolian_typedecl_struct_fields_get(tdecl);
EINA_ITERATOR_FOREACH(iter, f)
{
const Eolian_Type *feo_type = eolian_typedecl_struct_field_type_get(f);
Eolian_Debug_Basic_Type ftype = _eolian_type_resolve(feo_type);
size += _param_buffer_fill(buf+size, *((uint64_t *)str_buf), debug_types[ftype].size);
str_buf += debug_types[ftype].size;
}
eina_iterator_free(iter);
return size;
}
static Eina_Bool
_api_resolvable(Eo *obj, const Eolian_Function *function)
{
Efl_Object_Op_Call_Data call_data = {};
Efl_Object_Op op;
Efl_Object_Call_Cache call_cache = {};
const char *func_c_name;
void *func_api;
func_c_name = eolian_function_full_c_name_get(function, EOLIAN_PROP_GET);
func_c_name = eolian_function_full_c_name_get(function, EOLIAN_PROP_GET, EINA_FALSE);
func_api = dlsym(RTLD_DEFAULT, func_c_name);
op = _efl_object_op_api_id_get(func_api, obj, func_c_name, __FILE__, __LINE__);
_efl_object_call_resolve(obj, func_c_name, &call_data, op, __FILE__, __LINE__);
call_cache.op = _efl_object_op_api_id_get(func_api, obj, func_c_name, __FILE__, __LINE__);
call_cache.generation = _efl_object_init_generation;
_efl_object_call_resolve(obj, func_c_name, &call_data, &call_cache, __FILE__, __LINE__);
return !!call_data.func;
}
static unsigned int
_class_buffer_fill(Eo *obj, const Eolian_Class *ekl, char *buf)
_class_buffer_fill(Eo *obj, const Eolian_Unit *unit, const Eolian_Class *ekl, char *buf)
{
unsigned int size = 0;
Eina_Iterator *funcs = eolian_class_functions_get(ekl, EOLIAN_PROPERTY);
@ -552,14 +504,14 @@ _class_buffer_fill(Eo *obj, const Eolian_Class *ekl, char *buf)
Eolian_Debug_Parameter params[EOLIAN_DEBUG_MAXARGS];
Eolian_Debug_Return ret;
int argnum = _function_invoke(obj, func, EOLIAN_PROP_GET, params, &ret);
int argnum = _function_invoke(obj, unit, func, EOLIAN_PROP_GET, params, &ret);
if (argnum == -1) continue;
int len, i;
if (!size) // only if its the first func to succeed
{
const char *class_name = eolian_class_name_get(ekl);
const char *class_name = eolian_class_full_name_get(ekl);
len = strlen(class_name) + 1;
memcpy(buf, class_name, len);
size += len;
@ -579,26 +531,21 @@ _class_buffer_fill(Eo *obj, const Eolian_Class *ekl, char *buf)
// if its a string we wont copy the pointer but the value
if (params[i].value.type == EOLIAN_DEBUG_STRING)
{
if((char *)params[i].value.value == NULL)
params[i].value.value = (uint64_t)"";
len = strlen((char *)params[i].value.value) + 1;
memcpy(buf + size, (char *)params[i].value.value, len);
if((char *)params[i].value.value.value == NULL)
params[i].value.value.value = (uint64_t)"";
len = strlen((char *)params[i].value.value.value) + 1;
memcpy(buf + size, (char *)params[i].value.value.value, len);
size += len;
}
else if (params[i].value.type == EOLIAN_DEBUG_STRUCT)
{
const Eolian_Type *eo_type = eolian_parameter_type_get(params[i].eparam);
size += _struct_buffer_fill(buf+size, eo_type, (char *)params[i].value.value);
}
else
{
const Eolian_Type *eo_type = eolian_parameter_type_get(params[i].eparam);
size += _param_buffer_fill(buf+size, params[i].value.value,
size += _param_buffer_fill(buf+size, params[i].value.value.value,
debug_types[params[i].value.type].size);
if (params[i].value.type == EOLIAN_DEBUG_LIST)
{
size += _complex_buffer_fill(buf+size, eo_type,
params[i].value.value);
size += _complex_buffer_fill(unit, buf+size, eo_type,
params[i].value.value.value);
}
}
}
@ -614,20 +561,20 @@ _class_buffer_fill(Eo *obj, const Eolian_Class *ekl, char *buf)
//if its a string we wont copy the pointer but the values
if (ret.value.type == EOLIAN_DEBUG_STRING)
{
if((char *)ret.value.value == NULL)
ret.value.value = (uint64_t)"";
len = strlen((char *)ret.value.value) + 1;
memcpy(buf + size, (char *)ret.value.value, len);
if((char *)ret.value.value.value == NULL)
ret.value.value.value = (uint64_t)"";
len = strlen((char *)ret.value.value.value) + 1;
memcpy(buf + size, (char *)ret.value.value.value, len);
size += len;
}
else
{
size += _param_buffer_fill(buf+size, ret.value.value,
size += _param_buffer_fill(buf+size, ret.value.value.value,
debug_types[ret.value.type].size);
if (ret.value.type == EOLIAN_DEBUG_LIST)
{
size += _complex_buffer_fill(buf+size,
ret.etype, ret.value.value);
size += _complex_buffer_fill(unit, buf+size,
ret.etype, ret.value.value.value);
}
}
}
@ -637,128 +584,18 @@ _class_buffer_fill(Eo *obj, const Eolian_Class *ekl, char *buf)
return size;
}
/* Mapping from legacy classes to installed class files*/
static const char *legacy_installed_map[][2] =
{
{ "Efl.Ui.Bg_Widget_Legacy", "Efl.Ui.Bg_Widget" },
{ "Efl.Ui.Button_Legacy", "Efl.Ui.Button" },
{ "Efl.Ui.Check_Legacy", "Efl.Ui.Check" },
{ "Efl.Ui.Clock_Legacy", "Efl.Ui.Clock" },
{ "Efl.Ui.Flip_Legacy", "Efl.Ui.Flip" },
{ "Efl.Ui.Frame_Legacy", "Efl.Ui.Flip" },
{ "Efl.Ui.Image_Legacy", "Efl.Ui.Image" },
{ "Efl.Ui.Image_Zoomable_Legacy", "Efl.Ui.Image_Zoomable" },
{ "Efl.Ui.Layout_Legacy", "Efl.Ui.Layout.Object" },
{ "Efl.Ui.Multibuttonentry_Legacy", "Efl.Ui.Multibuttonentry" },
{ "Efl.Ui.Panes_Legacy", "Efl.Ui.Panes" },
{ "Efl.Ui.Progressbar_Legacy", "Efl.Ui.Progressbar" },
{ "Efl.Ui.Radio_Legacy", "Efl.Ui.Radio" },
{ "Efl.Ui.Slider_Legacy", "Efl.Ui.Slider" },
{ "Efl.Ui.Video_Legacy", "Efl.Ui.Video" },
{ "Efl.Ui.Win_Legacy", "Efl.Ui.Win" },
{ "Elm.Code_Widget_Legacy", "Elm.Code_Widget" },
{ "Elm.Ctxpopup", "Efl.Ui.Layout.Object" },
{ "Elm.Entry", "Efl.Ui.Layout.Object" },
{ "Elm.Colorselector", "Efl.Ui.Layout.Object" },
{ "Elm.List", "Efl.Ui.Layout.Object" },
{ "Elm.Photo", "Efl.Ui.Widget" },
{ "Elm.Actionslider", "Efl.Ui.Layout.Object" },
{ "Elm.Box", "Efl.Ui.Widget" },
{ "Elm.Table", "Efl.Ui.Widget" },
{ "Elm.Thumb", "Efl.Ui.Layout.Object" },
{ "Elm.Menu", "Efl.Ui.Widget" },
{ "Elm.Icon", "Efl.Ui.Image" },
{ "Elm.Prefs", "Efl.Ui.Widget" },
{ "Elm.Map", "Efl.Ui.Widget" },
{ "Elm.Glview", "Efl.Ui.Widget" },
{ "Elm.Web", "Efl.Ui.Widget" },
{ "Elm.Toolbar", "Efl.Ui.Widget" },
{ "Elm.Grid", "Efl.Ui.Widget" },
{ "Elm.Diskselector", "Efl.Ui.Widget" },
{ "Elm.Notify", "Efl.Ui.Widget" },
{ "Elm.Mapbuf", "Efl.Ui.Widget" },
{ "Elm.Separator", "Efl.Ui.Layout.Object" },
{ "Elm.Calendar", "Efl.Ui.Layout.Object" },
{ "Elm.Inwin", "Efl.Ui.Layout.Object" },
{ "Elm.Gengrid", "Efl.Ui.Layout.Object" },
{ "Elm.Scroller", "Efl.Ui.Layout.Object" },
{ "Elm.Player", "Efl.Ui.Layout.Object" },
{ "Elm.Segment_Control", "Efl.Ui.Layout.Object" },
{ "Elm.Fileselector", "Efl.Ui.Layout.Object" },
{ "Elm.Fileselector_Button", "Efl.Ui.Button" },
{ "Elm.Fileselector_Entry", "Efl.Ui.Layout.Object" },
{ "Elm.Flipselector", "Efl.Ui.Layout.Object" },
{ "Elm.Hoversel", "Efl.Ui.Button" },
{ "Elm.Naviframe", "Efl.Ui.Layout.Object" },
{ "Elm.Popup", "Efl.Ui.Layout.Object" },
{ "Elm.Bubble", "Efl.Ui.Layout.Object" },
{ "Elm.Clock", "Efl.Ui.Layout.Object" },
{ "Elm.Conformant", "Efl.Ui.Layout.Object" },
{ "Elm.Dayselector", "Efl.Ui.Layout.Object" },
{ "Elm.Genlist", "Efl.Ui.Layout.Object" },
{ "Elm.Hover", "Efl.Ui.Layout.Object" },
{ "Elm.Index", "Efl.Ui.Layout.Object" },
{ "Elm.Label", "Efl.Ui.Layout.Object" },
{ "Elm.Panel", "Efl.Ui.Layout.Object" },
{ "Elm.Slideshow", "Efl.Ui.Layout.Object" },
{ "Elm.Spinner", "Efl.Ui.Layout.Object" },
{ "Elm.Plug", "Efl.Ui.Widget" },
{ "Elm.Web.None", "Efl.Ui.Widget" },
{ NULL, NULL }
};
static Eina_Bool
_obj_info_req_cb(Eina_Debug_Session *session, int srcid, void *buffer, int size EINA_UNUSED)
{
static Eina_Hash *_parsed_kls = NULL;
uint64_t ptr64;
memcpy(&ptr64, buffer, sizeof(ptr64));
Eo *obj = (Eo *)SWAP_64(ptr64);
const char *class_name = NULL;
const Eolian_Class *kl, *okl;
Eolian_State *s;
unsigned int size_curr = 0;
const char *class_name = efl_class_name_get(obj);
const Eolian_Unit *unit = NULL;
const Eolian_Class *okl = _class_find_by_name(class_name, &unit), *kl;
char *buf;
if (!obj) return EINA_FALSE;
class_name = efl_class_name_get(obj);
if (efl_isa(obj, EFL_UI_LEGACY_INTERFACE))
{
for (int i = 0; legacy_installed_map[i][0]; ++i)
{
if (!strcmp(legacy_installed_map[i][0], class_name))
{
class_name = legacy_installed_map[i][1];
break;
}
}
}
if (!_parsed_kls) _parsed_kls = eina_hash_string_superfast_new(NULL);
s = eina_hash_find(_parsed_kls, class_name);
if (!s)
{
const char *fname;
Eina_Strbuf *sb = eina_strbuf_new();
s = eos = eolian_state_new();
eina_strbuf_append(sb, class_name);
eina_strbuf_replace_all(sb, ".", "_");
eina_strbuf_tolower(sb);
eina_strbuf_append(sb, ".eo");
fname = eina_strbuf_string_get(sb);
eolian_state_system_directory_add(s);
if (!eolian_state_file_parse(s, fname))
{
printf("File %s cannot be parsed.\n", fname);
goto end;
}
eina_strbuf_free(sb);
eina_hash_add(_parsed_kls, class_name, s);
}
okl = eolian_state_class_by_name_get(s, class_name);
unsigned int size_curr = 0;
if (!okl)
{
printf("Class %s not found.\n", class_name);
@ -772,20 +609,16 @@ _obj_info_req_cb(Eina_Debug_Session *session, int srcid, void *buffer, int size
Eina_List *list = eina_list_append(NULL, okl);
EINA_LIST_FOREACH(list, itr, kl)
{
const Eolian_Class *inherit, *parent;
Eina_Iterator *inherits_itr;
const char *inherit_name;
Eina_Iterator *inherits_itr = eolian_class_inherits_get(kl);
parent = eolian_class_parent_get(kl);
if (parent && !eina_list_data_find(list, parent))
list2 = eina_list_append(list, parent);
inherits_itr = eolian_class_extensions_get(kl);
size_curr += _class_buffer_fill(obj, kl, buf + size_curr);
EINA_ITERATOR_FOREACH(inherits_itr, inherit)
size_curr += _class_buffer_fill(obj, unit, kl, buf + size_curr);
EINA_ITERATOR_FOREACH(inherits_itr, inherit_name)
{
const Eolian_Class *inherit = eolian_class_get_by_name(unit, inherit_name);
if (!inherit) printf("class not found for name: \"%s\"", inherit_name);
/* Avoid duplicates in MRO list. */
if (inherit && !eina_list_data_find(list, inherit))
if (!eina_list_data_find(list, inherit))
list2 = eina_list_append(list, inherit);
}
eina_iterator_free(inherits_itr);
@ -864,8 +697,6 @@ _main_loop_snapshot_start_cb(Eina_Debug_Session *session, int srcid, void *buffe
Eina_List *kls_strs = NULL;
int nb_kls = 0;
eina_debug_session_send(session, srcid, _snapshot_start_op, NULL, 0);
tmp = buffer;
while (size > 0)
{
@ -969,14 +800,14 @@ _main_loop_obj_highlight_cb(Eina_Debug_Session *session EINA_UNUSED, int srcid E
if (size != sizeof(uint64_t)) return;
memcpy(&ptr64, buffer, sizeof(ptr64));
Eo *obj = (Eo *)SWAP_64(ptr64);
if (!efl_isa(obj, EFL_GFX_ENTITY_INTERFACE) && !efl_isa(obj, EFL_CANVAS_SCENE_INTERFACE)) return;
if (!efl_isa(obj, EFL_GFX_INTERFACE) && !efl_isa(obj, EVAS_CANVAS_CLASS)) return;
Evas *e = evas_object_evas_get(obj);
Eo *rect = evas_object_polygon_add(e);
evas_object_move(rect, 0, 0);
if (efl_isa(obj, EFL_GFX_ENTITY_INTERFACE))
if (efl_isa(obj, EFL_GFX_INTERFACE))
{
Eina_Rect obj_geom = {.x = 0, .y = 0, .w = 0, .h = 0};
obj_geom = efl_gfx_entity_geometry_get(obj);
obj_geom = efl_gfx_geometry_get(obj);
if (efl_isa(obj, EFL_UI_WIN_CLASS)) obj_geom.x = obj_geom.y = 0;
evas_object_polygon_point_add(rect, obj_geom.x, obj_geom.y);
@ -1068,9 +899,8 @@ _main_loop_win_screenshot_cb(Eina_Debug_Session *session, int srcid, void *buffe
if (size != sizeof(uint64_t)) return;
memcpy(&ptr64, buffer, sizeof(ptr64));
Eo *obj = (Eo *)SWAP_64(ptr64);
Eo *e = evas_object_evas_get(obj);
if (!e) return;
Eo *e = (Eo *)SWAP_64(ptr64);
if (!efl_isa(e, EVAS_CANVAS_CLASS)) return;
snapshot = evas_object_image_filled_add(e);
if (!snapshot) return;
@ -1084,12 +914,39 @@ _main_loop_win_screenshot_cb(Eina_Debug_Session *session, int srcid, void *buffe
evas_output_size_get(e, &w, &h);
evas_object_geometry_set(snapshot, 0, 0, w, h);
efl_gfx_entity_visible_set(snapshot, EINA_TRUE);
efl_gfx_visible_set(snapshot, EINA_TRUE);
evas_event_callback_add(e, EVAS_CALLBACK_RENDER_POST, _screenshot_pixels_cb, info);
}
WRAPPER_TO_XFER_MAIN_LOOP(_win_screenshot_cb)
static Eina_Bool
_only_manager(const void *container, void *data, void *fdata)
{
return efl_isa(data, EFL_UI_FOCUS_MANAGER_INTERFACE);
}
static void
_main_loop_focus_manager_list_cb(Eina_Debug_Session *session, int srcid, void *buffer, int size)
{
Eina_Iterator *obj_iterator, *manager_iterator;
Eina_Array *array;
Eo *obj;
array = eina_array_new(10);
obj_iterator = eo_objects_iterator_new();
manager_iterator = eina_iterator_filter_new(obj_iterator, _only_manager, NULL, NULL);
EINA_ITERATOR_FOREACH(manager_iterator, obj)
{
eina_array_push(array, obj);
}
eina_debug_session_send(session, srcid, _focus_manager_list_op, array->data, array->count * sizeof(void*));
}
WRAPPER_TO_XFER_MAIN_LOOP(_focus_manager_list_cb)
EAPI Efl_Dbg_Info*
clouseau_eo_info_find(Efl_Dbg_Info *root, const char *name)
{
@ -1111,55 +968,6 @@ clouseau_eo_info_find(Efl_Dbg_Info *root, const char *name)
return NULL;
}
static Eina_Bool
_only_manager(const void *container EINA_UNUSED, void *data, void *fdata EINA_UNUSED)
{
Efl_Dbg_Info *manager_data, *root;
if (!efl_isa(data, EFL_UI_FOCUS_MANAGER_INTERFACE)) return EINA_FALSE;
//check for debug information
root = EFL_DBG_INFO_LIST_APPEND(NULL, "Root");
efl_dbg_info_get(data, root);
manager_data = clouseau_eo_info_find(root, "Efl.Ui.Focus.Manager");
if (!manager_data) return EINA_FALSE;
return EINA_TRUE;
}
static void
_main_loop_focus_manager_list_cb(Eina_Debug_Session *session, int srcid, void *buffer EINA_UNUSED, int size EINA_UNUSED)
{
Eina_Iterator *obj_iterator, *manager_iterator;
Clouseau_Focus_Managers *managers;
Eo *obj;
if (!manager_list) _init_data_descriptors();
managers = alloca(sizeof(Clouseau_Focus_Managers));
managers->managers = NULL;
obj_iterator = eo_objects_iterator_new();
manager_iterator = eina_iterator_filter_new(obj_iterator, _only_manager, NULL, NULL);
EINA_ITERATOR_FOREACH(manager_iterator, obj)
{
Clouseau_Focus_List_Item *item = alloca(sizeof(Clouseau_Focus_List_Item));
item->ptr = (uintptr_t)(void*)obj;
item->helper_name = efl_class_name_get(efl_ui_focus_manager_root_get(obj));
managers->managers = eina_list_append(managers->managers, item);
}
int blob_size;
void *blob = eet_data_descriptor_encode(manager_list, managers, &blob_size);
eina_debug_session_send(session, srcid, _focus_manager_list_op, blob, blob_size);
managers->managers = eina_list_free(managers->managers);
}
WRAPPER_TO_XFER_MAIN_LOOP(_focus_manager_list_cb)
static Eina_List*
_fetch_children(Efl_Ui_Focus_Manager *m)
{
@ -1199,7 +1007,7 @@ _fetch_children(Efl_Ui_Focus_Manager *m)
}
static Eina_Bool
_main_loop_focus_manager_detail_cb(Eina_Debug_Session *session, int srcid, void *buffer, int size EINA_UNUSED)
_main_loop_focus_manager_detail_cb(Eina_Debug_Session *session, int srcid, void *buffer, int size)
{
Clouseau_Focus_Manager_Data *res;
uint64_t ptr64;
@ -1225,20 +1033,22 @@ _main_loop_focus_manager_detail_cb(Eina_Debug_Session *session, int srcid, void
Efl_Ui_Focus_Relations *rel;
rel = efl_ui_focus_manager_fetch(manager, elem);
if (rel)
{
memcpy(&crel->relation, rel, sizeof(Efl_Ui_Focus_Relations));
crel->class_name = efl_class_name_get(elem);
memcpy(&crel->relation, rel, sizeof(Efl_Ui_Focus_Relations));
res->relations = eina_list_append(res->relations, crel);
crel->class_name = efl_class_name_get(elem);
free(rel);
}
res->relations = eina_list_append(res->relations, crel);
free(rel);
}
int blob_size;
void *blob = eet_data_descriptor_encode(manager_details, res, &blob_size);
Clouseau_Focus_Manager_Data *aaah = eet_data_descriptor_decode(manager_details, blob, blob_size);
if (eina_list_count(aaah->relations) != eina_list_count(res->relations)) abort();
eina_debug_session_send(session, srcid, _focus_manager_detail_op, blob, blob_size);
return EINA_TRUE;
@ -1266,6 +1076,10 @@ clouseau_debug_init(void)
eolian_init();
evas_init();
_eolian_kls_hash = eina_hash_string_superfast_new(NULL);
eolian_system_directory_scan();
eina_debug_opcodes_register(NULL, _debug_ops(), NULL, NULL);
printf("%s - In\n", __FUNCTION__);
@ -1357,7 +1171,7 @@ eolian_debug_object_information_free(Eolian_Debug_Object_Information *main)
EINA_LIST_FREE(func->params, param)
{
if (param->value.type == EOLIAN_DEBUG_STRING)
eina_stringshare_del((char *)param->value.value);
eina_stringshare_del((char *)param->value.value.value);
free(param);
}
free(func);
@ -1368,7 +1182,7 @@ eolian_debug_object_information_free(Eolian_Debug_Object_Information *main)
}
static int
_complex_buffer_decode(char *buffer, const Eolian_Type *eo_type,
_complex_buffer_decode(const Eolian_Unit *unit, char *buffer, const Eolian_Type *eo_type,
Eolian_Debug_Value *v)
{
Eina_List *l = NULL;
@ -1381,7 +1195,7 @@ _complex_buffer_decode(char *buffer, const Eolian_Type *eo_type,
buffer += 4;
size += 4;
if (count > 0) type = _eolian_type_resolve(eolian_type_base_type_get(eo_type));
if (count > 0) type = _eolian_type_resolve(unit, eolian_type_base_type_get(eo_type));
while (count > 0)
{
@ -1397,61 +1211,6 @@ _complex_buffer_decode(char *buffer, const Eolian_Type *eo_type,
return size;
}
static Eina_Bool
_value_decode(char **buffer, unsigned int *size, const Eolian_Type *eo_type, Eolian_Debug_Value *v)
{
int len;
Eolian_Debug_Basic_Type type = _eolian_type_resolve(eo_type);
v->type = type;
if (type)
{
v->type = type;
if (type == EOLIAN_DEBUG_STRING)
{
len = strlen(*buffer) + 1;
v->value = (uint64_t) eina_stringshare_add(*buffer);
*buffer += len;
*size -= len;
}
else if (type == EOLIAN_DEBUG_STRUCT)
{
const Eolian_Struct_Type_Field *f;
Eina_List *list = NULL;
const Eolian_Typedecl *tdecl = eolian_type_typedecl_get(eo_type);
Eina_Iterator *iter = eolian_typedecl_struct_fields_get(tdecl);
EINA_ITERATOR_FOREACH(iter, f)
{
const Eolian_Type *feo_type = eolian_typedecl_struct_field_type_get(f);
Eolian_Debug_Value *v2 = calloc(1, sizeof(*v2));
_value_decode(buffer, size, feo_type, v2);
list = eina_list_append(list, v2);
}
eina_iterator_free(iter);
v->complex_type_values = list;
}
else
{
uint64_t value = 0;;
EXTRACT(*buffer, &value, debug_types[type].size);
v->value = SWAP_64(value);
*size -= debug_types[type].size;
if (type == EOLIAN_DEBUG_LIST)
{
len = _complex_buffer_decode(*buffer, eo_type, v);
*buffer += len;
*size -= len;
}
}
}
else
{
printf("Unknown parameter type %s\n", eolian_type_name_get(eo_type));
return EINA_FALSE;
}
return EINA_TRUE;
}
/*
* receive buffer of the following format:
* Eo *pointer (uint64_t)
@ -1461,7 +1220,6 @@ _value_decode(char **buffer, unsigned int *size, const Eolian_Type *eo_type, Eol
EAPI Eolian_Debug_Object_Information *
eolian_debug_object_information_decode(char *buffer, unsigned int size)
{
static Eina_Hash *_parsed_kls = NULL;
if (size < sizeof(uint64_t)) return NULL;
Eolian_Debug_Object_Information *ret = calloc(1, sizeof(*ret));
Eolian_Debug_Class *kl = NULL;
@ -1480,31 +1238,8 @@ eolian_debug_object_information_decode(char *buffer, unsigned int size)
int len = strlen(buffer) + 1;
if (len > 1) // if class_name is not NULL, we begin a new class
{
Eolian_State *s;
if (!_parsed_kls) _parsed_kls = eina_hash_string_superfast_new(NULL);
s = eina_hash_find(_parsed_kls, buffer);
if (!s)
{
const char *fname;
Eina_Strbuf *sb = eina_strbuf_new();
s = eos = eolian_state_new();
eina_strbuf_append(sb, buffer);
eina_strbuf_replace_all(sb, ".", "_");
eina_strbuf_tolower(sb);
eina_strbuf_append(sb, ".eo");
fname = eina_strbuf_string_get(sb);
eolian_state_system_directory_add(s);
if (!eolian_state_file_parse(s, fname))
{
printf("File %s cannot be parsed.\n", fname);
goto error;
}
eina_strbuf_free(sb);
eina_hash_add(_parsed_kls, buffer, s);
}
kl = calloc(1, sizeof(*kl));
kl->ekl = eolian_state_class_by_name_get(s, buffer);
kl->ekl = _class_find_by_name(buffer, &(kl->unit));
ret->classes = eina_list_append(ret->classes, kl);
}
if (!kl)
@ -1518,7 +1253,7 @@ eolian_debug_object_information_decode(char *buffer, unsigned int size)
func = calloc(1, sizeof(*func));
// printf("Class name = %s function = %s\n", eolian_class_name_get(kl->ekl), buffer);
kl->functions = eina_list_append(kl->functions, func);
func->efunc = eolian_class_function_by_name_get(kl->ekl, buffer, EOLIAN_PROP_GET);
func->efunc = eolian_class_function_get_by_name(kl->ekl, buffer, EOLIAN_PROP_GET);
if(!func->efunc)
{
printf("Function %s not found!\n", buffer);
@ -1532,20 +1267,77 @@ eolian_debug_object_information_decode(char *buffer, unsigned int size)
itr = eolian_property_values_get(func->efunc, EOLIAN_PROP_GET);
EINA_ITERATOR_FOREACH(itr, eo_param)
{
Eolian_Debug_Parameter *p = calloc(1, sizeof(*p));
p->eparam = eo_param;
eo_type = eolian_parameter_type_get(eo_param);
if (!_value_decode(&buffer, &size, eo_type, &(p->value)))
goto error;
func->params = eina_list_append(func->params, p);
Eolian_Debug_Basic_Type type = _eolian_type_resolve(kl->unit, eo_type);
if (type)
{
Eolian_Debug_Parameter *p = calloc(1, sizeof(*p));
p->eparam = eo_param;
p->value.type = type;
if (type == EOLIAN_DEBUG_STRING)
{
len = strlen(buffer) + 1;
p->value.value.value = (uint64_t) eina_stringshare_add(buffer);
buffer += len;
size -= len;
}
else
{
uint64_t value = 0;;
EXTRACT(buffer, &value, debug_types[type].size);
p->value.value.value = SWAP_64(value);
size -= debug_types[type].size;
if (type == EOLIAN_DEBUG_LIST)
{
len = _complex_buffer_decode(kl->unit, buffer, eo_type, &(p->value));
buffer += len;
size -= len;
}
}
func->params = eina_list_append(func->params, p);
}
else
{
printf("Unknown parameter type %s\n", eolian_type_full_name_get(eo_type));
goto error;
}
}
func->ret.etype = eo_type = eolian_function_return_type_get(
func->efunc, EOLIAN_PROP_GET);
func->ret.value.type = EOLIAN_DEBUG_VOID;
if(eo_type)
{
if (!_value_decode(&buffer, &size, eo_type, &(func->ret.value)))
goto error;
Eolian_Debug_Basic_Type type = _eolian_type_resolve(kl->unit, eo_type);
if (type)
{
func->ret.value.type = type;
if (type == EOLIAN_DEBUG_STRING)
{
len = strlen(buffer) + 1;
func->ret.value.value.value = (uint64_t) eina_stringshare_add(buffer);
buffer += len;
size -= len;
}
else
{
uint64_t value;
EXTRACT(buffer, &value, debug_types[type].size);
func->ret.value.value.value = SWAP_64(value);
size -= debug_types[type].size;
if (type == EOLIAN_DEBUG_LIST)
{
len = _complex_buffer_decode(kl->unit, buffer, eo_type, &(func->ret.value));
buffer += len;
size -= len;
}
}
}
else
{
printf("Unknown parameter type %s\n", eolian_type_full_name_get(eo_type));
goto error;
}
}
eina_iterator_free(itr);
}

View File

@ -1,6 +1,6 @@
static void
_init_manager_details_descriptors(void)
_init_data_descriptors(void)
{
Eet_Data_Descriptor_Class klass;
Eet_Data_Descriptor *relations_eed;
@ -10,12 +10,12 @@ _init_manager_details_descriptors(void)
#define BASIC(field, type) EET_DATA_DESCRIPTOR_ADD_BASIC(relations_eed, Clouseau_Focus_Relation, #field , field, type)
BASIC(class_name, EET_T_STRING);
BASIC(relation.next, EET_T_LONG_LONG);
BASIC(relation.prev, EET_T_LONG_LONG);
BASIC(relation.next, EET_T_UINT);
BASIC(relation.prev, EET_T_UINT);
BASIC(relation.logical, EET_T_CHAR);
BASIC(relation.parent, EET_T_LONG_LONG);
BASIC(relation.redirect, EET_T_LONG_LONG);
BASIC(relation.node, EET_T_LONG_LONG);
BASIC(relation.parent, EET_T_UINT);
BASIC(relation.redirect, EET_T_UINT);
BASIC(relation.node, EET_T_UINT);
BASIC(relation.position_in_history, EET_T_INT);
#undef BASIC
@ -31,39 +31,8 @@ _init_manager_details_descriptors(void)
EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&klass, Clouseau_Focus_Manager_Data);
manager_details = eet_data_descriptor_file_new(&klass);
EET_DATA_DESCRIPTOR_ADD_BASIC(manager_details, Clouseau_Focus_Manager_Data, "redirect_manager", redirect_manager, EET_T_LONG_LONG);
EET_DATA_DESCRIPTOR_ADD_BASIC(manager_details, Clouseau_Focus_Manager_Data, "focused", focused, EET_T_LONG_LONG);
EET_DATA_DESCRIPTOR_ADD_BASIC(manager_details, Clouseau_Focus_Manager_Data, "redirect_manager", redirect_manager, EET_T_UINT);
EET_DATA_DESCRIPTOR_ADD_BASIC(manager_details, Clouseau_Focus_Manager_Data, "focused", focused, EET_T_UINT);
EET_DATA_DESCRIPTOR_ADD_BASIC(manager_details, Clouseau_Focus_Manager_Data, "class_name", class_name, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_LIST(manager_details, Clouseau_Focus_Manager_Data, "relations", relations, relations_eed);
}
static void
_init_manager_list_descriptors(void)
{
Eet_Data_Descriptor_Class klass;
Eet_Data_Descriptor *detail_eed;
EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&klass, Clouseau_Focus_List_Item);
detail_eed = eet_data_descriptor_file_new(&klass);
#define BASIC(field, type) EET_DATA_DESCRIPTOR_ADD_BASIC(detail_eed, Clouseau_Focus_List_Item, #field , field, type)
BASIC(helper_name, EET_T_STRING);
BASIC(ptr, EET_T_LONG_LONG);
#undef BASIC
EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&klass, Clouseau_Focus_Managers);
manager_list = eet_data_descriptor_file_new(&klass);
EET_DATA_DESCRIPTOR_ADD_LIST(manager_list, Clouseau_Focus_Managers, "managers", managers, detail_eed);
}
static void
_init_data_descriptors(void)
{
_init_manager_list_descriptors();
_init_manager_details_descriptors();
}

View File

@ -1501,7 +1501,7 @@ _ui_get(Clouseau_Extension *ext, Eo *parent)
o2 = elm_button_add(bar_box);
elm_object_part_content_set(o2, "icon", o);
elm_box_pack_end(bar_box, o2);
efl_gfx_entity_visible_set(o2, EINA_TRUE);
efl_gfx_visible_set(o2, EINA_TRUE);
evas_object_smart_callback_add(o2, "clicked", _evlog_clear, ext);
inf->record_icon = o = elm_icon_add(bar_box);
@ -1511,23 +1511,23 @@ _ui_get(Clouseau_Extension *ext, Eo *parent)
inf->record_button = o = elm_button_add(bar_box);
elm_object_part_content_set(o, "icon", inf->record_icon);
elm_box_pack_end(bar_box, o);
efl_gfx_entity_visible_set(o, EINA_TRUE);
efl_gfx_visible_set(o, EINA_TRUE);
evas_object_smart_callback_add(o, "clicked", _process_recording, ext);
o = elm_separator_add(bar_box);
elm_box_pack_end(bar_box, o);
efl_gfx_entity_visible_set(o, EINA_TRUE);
efl_gfx_visible_set(o, EINA_TRUE);
o = elm_label_add(bar_box);
elm_object_text_set(o, "Refresh interval (in seconds):");
elm_box_pack_end(bar_box, o);
efl_gfx_entity_visible_set(o, EINA_TRUE);
efl_gfx_visible_set(o, EINA_TRUE);
inf->refresh_interval_entry = o = elm_entry_add(bar_box);
elm_entry_single_line_set(o, EINA_TRUE);
elm_object_text_set(o, "0.2");
elm_box_pack_end(bar_box, o);
efl_gfx_entity_visible_set(o, EINA_TRUE);
efl_gfx_visible_set(o, EINA_TRUE);
inf->zoom_slider = o = elm_slider_add(inf->main);
evas_object_data_set(o, "inf", inf);

View File

@ -1,10 +1,14 @@
set(CMAKE_BUILD_TYPE Debug)
STRING(REGEX REPLACE "\n" "" EOLIAN_EO_DIR ${EOLIAN_EO_DIR})
STRING(REGEX REPLACE " " "" EOLIAN_EO_DIR ${EOLIAN_EO_DIR})
add_definitions(${CLI_COMMON_DEFINITIONS} -DEFL_EO_API_SUPPORT
-DFOCUS_EDJ="${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME_LOWER}/clouseau_focus_inspector.edj")
-DEOLIAN_EO_DIR="${EOLIAN_EO_DIR}" -DFOCUS_EDJ="${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME_LOWER}/clouseau_focus_inspector.edj")
add_definitions(-DEFL_EO_API_SUPPORT -DGUI_IMAGES_PATH="${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME_LOWER}")
set(EOLIAN_INCLUDE_FLAG -I \"${EOLIAN_EO_DIR}/eo-1\" -I${CMAKE_CURRENT_SOURCE_DIR})
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${ELEMENTARY_INCLUDE_DIRS}
@ -17,9 +21,9 @@ include_directories(
link_directories (${PC_LIBELEMENTARY_LIBRARY_DIRS})
add_library(clouseau_focus_inspector SHARED main.c gui.c tree_view.c)
add_library(focus_inspector SHARED main.c gui.c tree_view.c)
target_link_libraries(clouseau_focus_inspector
target_link_libraries(focus_inspector
${ELEMENTARY_LIBRARIES}
${EVAS_LIBRARIES}
${EO_LIBRARIES}
@ -29,6 +33,6 @@ target_link_libraries(clouseau_focus_inspector
clouseau_debug
)
add_dependencies(clouseau_focus_inspector focus_inspector_theme)
add_dependencies(focus_inspector focus_inspector_theme)
INSTALL(TARGETS clouseau_focus_inspector LIBRARY DESTINATION lib)
INSTALL(TARGETS focus_inspector LIBRARY DESTINATION lib)

View File

@ -4,139 +4,74 @@
static Evas_Object *table, *managers, *redirect, *history, *scroller;
static Elm_Genlist_Item_Class *itc;
static Clouseau_Focus_List_Item *selected_manager = NULL;
static char*
_text_get(void *data, Elm_Genlist *list EINA_UNUSED, const char *part EINA_UNUSED)
_text_get(void *data, Elm_Genlist *list, const char *part)
{
Clouseau_Focus_List_Item *it = data;
Efl_Ui_Focus_Manager *manager = data;
Eina_Strbuf *res = eina_strbuf_new();
eina_strbuf_append_printf(res, "%s - %p", it->helper_name, (void*)it->ptr);
eina_strbuf_append_printf(res, "%p", manager);
return eina_strbuf_release(res);
}
static void
_sel_relation_func(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
{
Instance *inst = evas_object_data_get(obj, "__instance");
tree_view_relation_display(inst, elm_radio_state_value_get(obj));
elm_radio_value_set(obj, elm_radio_state_value_get(obj));
}
static void
_reload(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
if (selected_manager)
com_defailt_manager(data, (void*)selected_manager->ptr);
}
EAPI Evas_Object*
ui_create(Instance *inst, Evas_Object *obj)
{
Evas_Object *o, *ic, *table2, *group = NULL;
Evas_Object *o;
o = table = elm_table_add(obj);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(o);
ic = elm_icon_add(obj);
elm_icon_standard_set(ic, "edit-redo");
evas_object_show(ic);
o = elm_button_add(obj);
elm_object_part_content_set(o, "icon", ic);
evas_object_show(o);
elm_table_pack(table, o, 0, 0, 1, 1);
evas_object_smart_callback_add(o, "clicked", _reload, inst);
o = managers = elm_combobox_add(obj);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_part_text_set(o, "guide", "Manager to inspect");
evas_object_show(o);
elm_table_pack(table, o, 1, 0, 1, 1);
elm_table_pack(table, o, 0, 0, 1, 1);
itc = elm_genlist_item_class_new();
itc->func.text_get = _text_get;
o = elm_label_add(obj);
elm_object_text_set(o, "Redirect:");
evas_object_show(o);
elm_table_pack(table, o, 2, 0, 1, 1);
elm_table_pack(table, o, 1, 0, 1, 1);
o = redirect = elm_label_add(obj);
evas_object_show(o);
elm_table_pack(table, o, 3, 0, 1, 1);
elm_table_pack(table, o, 2, 0, 1, 1);
o = history = elm_hoversel_add(obj);
elm_object_text_set(o, "History");
evas_object_show(o);
elm_table_pack(table, o, 4, 0, 1, 1);
elm_table_pack(table, o, 3, 0, 1, 1);
o = scroller = elm_scroller_add(table);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(o);
elm_table_pack(table, o, 0, 1, 5, 1);
o = table2 = elm_table_add(obj);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(o);
char *text[] = {"Tree","Next","Prev","None"};
for (int i = 0; i <= RELATION_NONE; ++i)
{
o = elm_radio_add(table);
evas_object_data_set(o, "__instance", inst);
evas_object_smart_callback_add(o, "changed", _sel_relation_func, NULL);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_text_set(o, text[i]);
evas_object_show(o);
elm_table_pack(table2, o, i % 5, i/5, 1, 1);
if (!group)
group = o;
else
elm_radio_group_add(o, group);
elm_radio_state_value_set(o, i);
}
elm_radio_value_set(group, RELATION_NONE);
elm_table_pack(table, table2, 0, 2, 5, 1);
elm_table_pack(table, o, 0, 1, 4, 1);
return table;
}
static void
_sel(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
_sel(void *data, Evas_Object *obj, void *event_info)
{
Clouseau_Focus_List_Item *it = elm_object_item_data_get(event_info);
com_defailt_manager(data, (void*)it->ptr);
selected_manager = it;
com_defailt_manager(data, elm_object_item_data_get(event_info));
}
EAPI void
ui_managers_add(Instance *inst, Clouseau_Focus_Managers *clouseau_managers)
ui_managers_add(Instance *inst, Efl_Ui_Focus_Manager **manager, int size)
{
Clouseau_Focus_List_Item *it;
Eina_List *n;
elm_genlist_clear(managers);
selected_manager = NULL;
if (!clouseau_managers) return;
EINA_LIST_FOREACH(clouseau_managers->managers, n, it)
for (int i = 0; i < size; ++i)
{
elm_genlist_item_append(managers, itc, it, NULL, 0, _sel, inst);
elm_genlist_item_append(managers, itc, manager[i], NULL, 0, _sel, inst);
}
free(clouseau_managers);
}
static int
@ -157,7 +92,7 @@ EAPI void
ui_manager_data_arrived(Instance *inst, Clouseau_Focus_Manager_Data *data)
{
Clouseau_Focus_Relation *rel;
Evas_Object *o;
Evas_Object *box, *o;
Eina_List *n, *sorted = NULL;
EINA_LIST_FREE(inst->realized.objects, o)
@ -165,15 +100,10 @@ ui_manager_data_arrived(Instance *inst, Clouseau_Focus_Manager_Data *data)
inst->realized.focusable_to_cfr = eina_hash_pointer_new(NULL);
if (inst->realized.data)
free(inst->realized.data);
inst->realized.data = data;
elm_hoversel_clear(history);
if (!inst->realized.data) return;
EINA_LIST_FOREACH(data->relations, n, rel)
{
if (rel->relation.position_in_history != -1)

View File

@ -8,7 +8,7 @@ typedef struct {
Clouseau_Extension *ext;
struct {
Eina_Hash *focusable_to_cfr;
Eina_List *objects, *relation_objects;
Eina_List *objects;
Clouseau_Focus_Manager_Data *data;
} realized;
} Instance;
@ -17,15 +17,18 @@ typedef enum {
RELATION_TREE = 0,
RELATION_NEXT = 1,
RELATION_PREV = 2,
RELATION_NONE = 3
/* RELATION_RIGHT = 3,
RELATION_LEFT = 4,
RELATION_TOP = 5,
RELATION_DOWN = 6*/
} Relations;
#define PUSH_CLEANUP(inst, o) inst->realized.objects = eina_list_append(inst->realized.objects, o)
#define PUSH_RELAION_CLEANUP(inst, o) inst->realized.relation_objects = eina_list_append(inst->realized.relation_objects, o)
EAPI void tree_view_update(Instance *inst, Evas_Object *scroller);
EAPI void tree_view_relation_display(Instance *inst, Relations rel);
EAPI void ui_managers_add(Instance *inst, Clouseau_Focus_Managers *clouseau_managers);
EAPI void ui_managers_add(Instance *inst, Efl_Ui_Focus_Manager **manager, int size);
EAPI void ui_manager_data_arrived(Instance *inst, Clouseau_Focus_Manager_Data *data);
EAPI Evas_Object* ui_create(Instance *inst, Evas_Object *obj);

View File

@ -9,19 +9,19 @@ static Instance inst;
static int _focus_manager_list_op = EINA_DEBUG_OPCODE_INVALID;
static int _focus_manager_detail_op = EINA_DEBUG_OPCODE_INVALID;
static Eet_Data_Descriptor *manager_details = NULL, *manager_list = NULL;
static Eet_Data_Descriptor *managers = NULL, *manager_details = NULL;
#include "../../clouseau_focus_serialization.x"
static Eina_Bool
_main_loop_focus_manager_list_cb(Eina_Debug_Session *session, int src EINA_UNUSED, void *buffer, int size)
_main_loop_focus_manager_list_cb(Eina_Debug_Session *session, int src, void *buffer, int size)
{
int managers = size / sizeof(Efl_Ui_Focus_Manager*);
Efl_Ui_Focus_Manager *manager_arr[managers];
Clouseau_Extension *ext = eina_debug_session_data_get(session);
Clouseau_Focus_Managers *managers;
if (!manager_list) _init_manager_list_descriptors();
managers = eet_data_descriptor_decode(manager_list, buffer, size);
memcpy(manager_arr, buffer, size);
ui_managers_add(ext->data, managers);
ui_managers_add(ext->data, manager_arr, managers);
return EINA_TRUE;
}
@ -29,7 +29,7 @@ _main_loop_focus_manager_list_cb(Eina_Debug_Session *session, int src EINA_UNUSE
WRAPPER_TO_XFER_MAIN_LOOP(_focus_manager_list_cb)
static Eina_Bool
_main_loop_focus_manager_detail_cb(Eina_Debug_Session *session, int src EINA_UNUSED, void *buffer, int size)
_main_loop_focus_manager_detail_cb(Eina_Debug_Session *session, int src, void *buffer, int size)
{
Clouseau_Extension *ext = eina_debug_session_data_get(session);
Clouseau_Focus_Manager_Data *pd;
@ -53,6 +53,7 @@ static void
_session_changed(Clouseau_Extension *ext)
{
int i = 0;
Instance *inst = ext->data;
Eina_Debug_Opcode *ops = _ops();
while (ops[i].opcode_name)
@ -65,34 +66,26 @@ _session_changed(Clouseau_Extension *ext)
eina_debug_session_data_set(ext->session, ext);
eina_debug_opcodes_register(ext->session, ops, NULL, ext);
}
ui_managers_add(ext->data, NULL);
ui_manager_data_arrived(ext->data, NULL);
}
static void
_app_changed(Clouseau_Extension *ext)
{
ui_managers_add(ext->data, NULL);
ui_manager_data_arrived(ext->data, NULL);
com_refresh_managers(ext->data);
}
EAPI void
com_refresh_managers(Instance *ext_inst)
com_refresh_managers(Instance *inst)
{
eina_debug_session_send(ext_inst->ext->session, ext_inst->ext->app_id, _focus_manager_list_op, NULL, 0);
int i = eina_debug_session_send(inst->ext->session, inst->ext->app_id, _focus_manager_list_op, NULL, 0);
}
EAPI void
com_defailt_manager(Instance *ext_inst, Efl_Ui_Focus_Manager *manager)
com_defailt_manager(Instance *inst, Efl_Ui_Focus_Manager *manager)
{
void *tmp[1];
tmp[0] = manager;
eina_debug_session_send(ext_inst->ext->session, ext_inst->ext->app_id, _focus_manager_detail_op, tmp, sizeof(void*));
int i = eina_debug_session_send(inst->ext->session, inst->ext->app_id, _focus_manager_detail_op, tmp, sizeof(void*));
}
EAPI const char *

View File

@ -5,7 +5,7 @@
static void
find(Instance *pd, void *parent, void (*found)(void *data, Instance *pd, Clouseau_Focus_Relation *relation), void *data)
{
for (unsigned int i = 0; pd->realized.data->relations && i < eina_list_count(pd->realized.data->relations); ++i)
for (int i = 0; pd->realized.data->relations && i < eina_list_count(pd->realized.data->relations); ++i)
{
Clouseau_Focus_Relation *rel;
rel = eina_list_nth(pd->realized.data->relations, i);
@ -91,120 +91,14 @@ tree_view_update(Instance *inst, Evas_Object *scroller)
elm_object_content_set(scroller, box);
tree_view_relation_display(inst, RELATION_NONE);
}
static Evas_Object*
_create_arrow(Evas *e)
{
Evas_Object *vg;
Efl_VG *cont, *tail, *front;
vg = evas_object_vg_add(e);
cont = evas_vg_container_add(vg);
tail = evas_vg_shape_add(cont);
evas_vg_node_color_set(tail, 0, 0, 0, 255);
evas_vg_shape_stroke_color_set(tail, 128, 10,10, 128);
evas_vg_shape_stroke_width_set(tail, 2.0);
evas_vg_shape_stroke_join_set(tail, EFL_GFX_JOIN_MITER);
evas_vg_shape_append_move_to(tail, 0, 0);
evas_vg_shape_append_line_to(tail, -100, 0);
efl_name_set(tail, "tail");
front = evas_vg_shape_add(cont);
evas_vg_node_color_set(front, 0, 0, 0, 255);
evas_vg_shape_stroke_color_set(front, 128, 10,10, 128);
evas_vg_shape_stroke_width_set(front, 2.0);
evas_vg_shape_stroke_join_set(front, EFL_GFX_JOIN_MITER);
evas_vg_shape_append_move_to(front, -6, -6);
evas_vg_shape_append_line_to(front, 0, 0);
evas_vg_shape_append_line_to(front, -6, 6);
evas_vg_shape_append_line_to(front, -6, -6);
efl_name_set(front, "front");
evas_object_vg_root_node_set(vg, cont);
return vg;
tree_view_relation_display(inst, RELATION_NEXT);
}
static void
_arrow_from_to(Evas_Object *vg, Eina_Position2D from, Eina_Position2D to)
{
Eina_Rect pos;
Eina_Matrix3 tmp, root_m;
Efl_VG *shape;
double distance, deg;
shape = evas_object_vg_root_node_get(vg);
EINA_SAFETY_ON_NULL_RETURN(shape);
pos.x = MIN(from.x, to.x);
pos.y = MIN(from.y, to.y);
pos.w = MAX(from.x, to.x) - pos.x;
pos.h = MAX(from.y, to.y) - pos.y;
distance = sqrt(pow(pos.w, 2)+pow(pos.h, 2));
eina_matrix3_identity(&tmp);
eina_matrix3_scale(&tmp, distance/100, 1.0);
evas_vg_node_transformation_set(evas_vg_container_child_get(shape, "tail"), &tmp);
Eina_Size2D size = EINA_SIZE2D((from.x - to.x), (from.y - to.y));
if (from.y - to.y == 0)
{
deg = 0;
}
else if (from.x - to.x == 0)
{
if (from.y > to.y)
deg = M_PI_2;
else
deg = M_PI + M_PI_2;
}
else
{
double di = ((double)(double)from.y - to.y) / ((double)from.x - to.x);
deg = atan(di);
}
if (from.x >= to.x)
{
size.w = 0;
deg += M_PI;
}
if (to.y <= from.y)
{
size.h = 0;
}
size.h = MAX(abs(size.h), 0) + 10;
size.w = MAX(abs(size.w), 0) + 10;
eina_matrix3_identity(&root_m);
eina_matrix3_identity(&tmp);
eina_matrix3_translate(&tmp, size.w, size.h);
eina_matrix3_multiply_copy(&root_m, &root_m, &tmp);
eina_matrix3_identity(&tmp);
eina_matrix3_rotate(&tmp, deg);
eina_matrix3_multiply_copy(&root_m, &root_m, &tmp);
evas_vg_node_transformation_set(shape, &root_m);
evas_object_geometry_set(vg, pos.x - 10, pos.y - 10, pos.w + 20, pos.h + 20);
}
static void
_geom_change(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
_geom_change(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Eina_Rectangle pos1, pos2;
Eina_Position2D from, to;
Eina_Position2D calc_from, calc_to, from, to;
Evas_Object *line, *vis1, *vis2;
line = data;
@ -219,95 +113,63 @@ _geom_change(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
to.x = pos2.x + pos2.w / 2;
to.y = pos2.y + pos2.h / 2;
_arrow_from_to(line, from, to);
evas_object_line_xy_set(line, from.x, from.y, to.x, to.y);
}
static void
_relation_display(Instance *inst, Evas_Object *vis1, Evas_Object *vis2)
{
Evas_Object *line;
Evas_Object *smart;
line = _create_arrow(evas_object_evas_get(vis1));
//evas_object_anti_alias_set(line, EINA_FALSE);
line = evas_object_line_add(evas_object_evas_get(vis1));
evas_object_anti_alias_set(line, EINA_FALSE);
evas_object_geometry_set(line, 0, 0, 1000, 1000);
evas_object_pass_events_set(line, EINA_TRUE);
evas_object_data_set(line, "__from", vis1);
evas_object_data_set(line, "__to", vis2);
evas_object_show(line);
smart = evas_object_smart_parent_get(vis1);
evas_object_smart_member_add(line, smart);
_geom_change(line, evas_object_evas_get(vis1), vis1, NULL);
PUSH_RELAION_CLEANUP(inst, line);
PUSH_CLEANUP(inst, line);
evas_object_event_callback_add(vis1, EVAS_CALLBACK_MOVE, _geom_change, line);
evas_object_event_callback_add(vis1, EVAS_CALLBACK_RESIZE, _geom_change, line);
evas_object_event_callback_add(vis2, EVAS_CALLBACK_MOVE, _geom_change, line);
evas_object_event_callback_add(vis2, EVAS_CALLBACK_RESIZE, _geom_change, line);
}
EAPI void
tree_view_relation_display(Instance *inst, Relations rel_type)
{
Evas_Object *o;
EINA_LIST_FREE(inst->realized.relation_objects, o)
if (rel_type == RELATION_TREE || rel_type == RELATION_NEXT || rel_type == RELATION_PREV)
{
Evas_Object *vis1, *vis2;
vis1 = evas_object_data_get(o, "__from");
vis2 = evas_object_data_get(o, "__to");
Clouseau_Focus_Relation *rel;
Eina_List *n;
evas_object_event_callback_del_full(vis1, EVAS_CALLBACK_MOVE, _geom_change, o);
evas_object_event_callback_del_full(vis1, EVAS_CALLBACK_RESIZE, _geom_change, o);
evas_object_event_callback_del_full(vis2, EVAS_CALLBACK_MOVE, _geom_change, o);
evas_object_event_callback_del_full(vis2, EVAS_CALLBACK_RESIZE, _geom_change, o);
EINA_LIST_FOREACH(inst->realized.data->relations, n, rel)
{
Eo *relation_partner;
evas_object_del(o);
if (rel_type == RELATION_TREE)
{
relation_partner = rel->relation.parent;
if (!rel->relation.parent) continue;
}
else if (rel_type == RELATION_NEXT)
{
relation_partner = rel->relation.next;
}
else if (rel_type == RELATION_PREV)
{
relation_partner = rel->relation.prev;
}
Clouseau_Focus_Relation *c = eina_hash_find(inst->realized.focusable_to_cfr, &relation_partner);
EINA_SAFETY_ON_NULL_GOTO(c, next);
_relation_display(inst, c->vis, rel->vis);
next:
n = n;
}
}
if (rel_type == RELATION_NONE) return;
if (!inst->realized.data) return;
Clouseau_Focus_Relation *rel;
Eina_List *n;
EINA_LIST_FOREACH(inst->realized.data->relations, n, rel)
{
Eo *from;
Eo *to;
if (rel_type == RELATION_TREE)
{
if (!rel->relation.parent) continue;
from = rel->relation.parent;
to = rel->relation.node;
}
else if (rel_type == RELATION_NEXT)
{
if (!rel->relation.next) continue;
to = rel->relation.next;
from = rel->relation.node;
}
else if (rel_type == RELATION_PREV)
{
if (!rel->relation.prev) continue;
to = rel->relation.prev;
from = rel->relation.node;
}
Clouseau_Focus_Relation *c_from, *c_to;
c_from = eina_hash_find(inst->realized.focusable_to_cfr, &from);
c_to = eina_hash_find(inst->realized.focusable_to_cfr, &to);
EINA_SAFETY_ON_NULL_GOTO(c_from, next);
EINA_SAFETY_ON_NULL_GOTO(c_to, next);
_relation_display(inst, c_from->vis, c_to->vis);
next:
(void) n;
}
}

View File

@ -1,9 +1,14 @@
set(CMAKE_BUILD_TYPE Debug)
add_definitions(${CLI_COMMON_DEFINITIONS} -DEFL_EO_API_SUPPORT)
STRING(REGEX REPLACE "\n" "" EOLIAN_EO_DIR ${EOLIAN_EO_DIR})
STRING(REGEX REPLACE " " "" EOLIAN_EO_DIR ${EOLIAN_EO_DIR})
add_definitions(${CLI_COMMON_DEFINITIONS} -DEFL_EO_API_SUPPORT
-DEOLIAN_EO_DIR="${EOLIAN_EO_DIR}")
add_definitions(-DEFL_EO_API_SUPPORT -DGUI_IMAGES_PATH="${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME_LOWER}")
set(EOLIAN_INCLUDE_FLAG -I \"${EOLIAN_EO_DIR}/eo-1\" -I${CMAKE_CURRENT_SOURCE_DIR})
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${ELEMENTARY_INCLUDE_DIRS}

View File

@ -7,8 +7,10 @@
#ifndef ELM_INTERNAL_API_ARGESFSDFEFC
#define ELM_INTERNAL_API_ARGESFSDFEFC
#endif
#include <Efl_Ui.h>
#include <Elementary.h>
#include "elm_widget_container.h"
#include "elm_interface_scrollable.h"
#include "elm_interface_fileselector.h"
#include "gui.h"
static const char* objs_types_strings[] =
@ -62,7 +64,7 @@ gui_win_create(Eo *__main_parent)
pub_widgets->main = box;
evas_object_size_hint_weight_set(box, 1, 1);
evas_object_size_hint_align_set(box, -1, -1);
efl_gfx_entity_visible_set(box, EINA_TRUE);
efl_gfx_visible_set(box, EINA_TRUE);
efl_event_callback_add(box, EFL_EVENT_DEL, _pubs_free_cb, pub_widgets);
tb = elm_toolbar_add(__main_parent);
@ -71,7 +73,7 @@ gui_win_create(Eo *__main_parent)
elm_toolbar_menu_parent_set(tb, __main_parent);
evas_object_size_hint_weight_set(tb, 0, 0);
evas_object_size_hint_align_set(tb, -1, 0);
efl_gfx_entity_visible_set(tb, EINA_TRUE);
efl_gfx_visible_set(tb, EINA_TRUE);
pub_widgets->reload_button = elm_toolbar_item_append(tb, "view-refresh", "Reload", reload_perform, NULL);
@ -107,8 +109,8 @@ gui_win_create(Eo *__main_parent)
panes = efl_add(EFL_UI_PANES_CLASS, box);
elm_panes_content_right_size_set(panes, 0.600000);
evas_object_size_hint_weight_set(panes, 1.000000, 1.000000);
efl_gfx_entity_size_set(panes, EINA_SIZE2D(75, 75));
efl_gfx_entity_visible_set(panes, EINA_TRUE);
efl_gfx_size_set(panes, EINA_SIZE2D(75, 75));
efl_gfx_visible_set(panes, EINA_TRUE);
evas_object_size_hint_weight_set(panes, 1.000000, 1.000000);
evas_object_size_hint_align_set(panes, -1.000000, -1.000000);
elm_box_pack_end(box, tb);
@ -116,11 +118,11 @@ gui_win_create(Eo *__main_parent)
object_infos_list = elm_genlist_add(panes);
pub_widgets->object_infos_list = object_infos_list;
evas_object_size_hint_weight_set(object_infos_list, 1.000000, 1.000000);
efl_gfx_entity_visible_set(object_infos_list, EINA_TRUE);
objects_list = elm_genlist_add(panes);
efl_gfx_visible_set(object_infos_list, EINA_TRUE);
objects_list = efl_add(ELM_GENLIST_CLASS, panes);
pub_widgets->objects_list = objects_list;
evas_object_size_hint_weight_set(objects_list, 1.000000, 1.000000);
efl_gfx_entity_visible_set(objects_list, EINA_TRUE);
efl_gfx_visible_set(objects_list, EINA_TRUE);
elm_object_part_content_set(panes, "left", objects_list);
elm_object_part_content_set(panes, "right", object_infos_list);
@ -135,16 +137,16 @@ gui_take_screenshot_button_create(Eo *__main_parent)
Eo *bt;
Eo *elm_icon1;
bt = elm_button_add(__main_parent);
bt = efl_add(EFL_UI_BUTTON_CLASS, __main_parent);
pub_widgets->bt = bt;
evas_object_size_hint_weight_set(bt, 1.000000, 1.000000);
evas_object_show(bt);
efl_event_callback_add(bt, EFL_INPUT_EVENT_CLICKED, take_screenshot_button_clicked, NULL);
efl_gfx_visible_set(bt, EINA_TRUE);
efl_event_callback_add(bt, EFL_UI_EVENT_CLICKED, take_screenshot_button_clicked, NULL);
elm_icon1 = elm_icon_add(bt);
evas_object_size_hint_weight_set(elm_icon1, 1.000000, 1.000000);
efl_gfx_entity_visible_set(elm_icon1, EINA_TRUE);
efl_file_set(elm_icon1, TAKE_SCREENSHOT_ICON);
efl_gfx_visible_set(elm_icon1, EINA_TRUE);
efl_file_set(elm_icon1, TAKE_SCREENSHOT_ICON, NULL);
elm_object_part_content_set(bt, "icon", elm_icon1);
efl_event_callback_add(bt, EFL_EVENT_DEL, _pubs_free_cb, pub_widgets);
@ -159,18 +161,18 @@ gui_show_screenshot_button_create(Eo *__main_parent)
Eo *bt;
Eo *elm_icon1;
bt = elm_button_add(__main_parent);
bt = efl_add(EFL_UI_BUTTON_CLASS, __main_parent);
pub_widgets->bt = bt;
evas_object_size_hint_weight_set(bt, 1.000000, 1.000000);
evas_object_show(bt);
evas_object_resize(bt, 73, 30);
efl_event_callback_add(bt, EFL_INPUT_EVENT_CLICKED, show_screenshot_button_clicked, NULL);
efl_gfx_visible_set(bt, EINA_TRUE);
efl_gfx_size_set(bt, EINA_SIZE2D(73, 30));
efl_event_callback_add(bt, EFL_UI_EVENT_CLICKED, show_screenshot_button_clicked, NULL);
elm_icon1 = elm_icon_add(bt);
evas_object_size_hint_weight_set(elm_icon1, 1.000000, 1.000000);
efl_gfx_entity_visible_set(elm_icon1, EINA_TRUE);
efl_gfx_entity_size_set(elm_icon1, EINA_SIZE2D(40, 40));
efl_file_set(elm_icon1, SHOW_SCREENSHOT_ICON);
efl_gfx_visible_set(elm_icon1, EINA_TRUE);
efl_gfx_size_set(elm_icon1, EINA_SIZE2D(40, 40));
efl_file_set(elm_icon1, SHOW_SCREENSHOT_ICON, NULL);
elm_object_part_content_set(bt, "icon", elm_icon1);
efl_event_callback_add(bt, EFL_EVENT_DEL, _pubs_free_cb, pub_widgets);
@ -188,15 +190,15 @@ gui_show_screenshot_win_create(Eo *__main_parent)
win = elm_win_add(__main_parent, "Screenshot", ELM_WIN_BASIC);
pub_widgets->win = win;
elm_win_autodel_set(win, EINA_TRUE);
efl_gfx_entity_size_set(win, EINA_SIZE2D(300, 300));
efl_gfx_size_set(win, EINA_SIZE2D(300, 300));
evas_object_size_hint_weight_set(win, 1.000000, 1.000000);
elm_win_title_set(win, "Screenshot");
bg = elm_bg_add(win);
pub_widgets->bg = bg;
evas_object_size_hint_weight_set(bg, 1.000000, 1.000000);
efl_gfx_entity_visible_set(bg, EINA_TRUE);
efl_gfx_visible_set(bg, EINA_TRUE);
elm_win_resize_object_add(win, bg);
efl_gfx_entity_visible_set(win, EINA_TRUE);
efl_gfx_visible_set(win, EINA_TRUE);
efl_event_callback_add(win, EFL_EVENT_DEL, _pubs_free_cb, pub_widgets);
return pub_widgets;

View File

@ -99,7 +99,6 @@ static Evas_Object * _obj_info_tootip(void *, Evas_Object *, Evas_Object *, void
static Eina_Bool _eoids_get(Eina_Debug_Session *, int, void *, int);
static Eina_Bool _klids_get(Eina_Debug_Session *, int, void *, int);
static Eina_Bool _obj_info_get(Eina_Debug_Session *, int, void *, int);
static Eina_Bool _snapshot_started_cb(Eina_Debug_Session *, int, void *, int);
static Eina_Bool _snapshot_done_cb(Eina_Debug_Session *, int, void *, int);
static Eina_Bool _win_screenshot_get(Eina_Debug_Session *, int, void *, int);
@ -109,7 +108,7 @@ EINA_DEBUG_OPCODES_ARRAY_DEFINE(_ops,
{"Clouseau/Evas/object/highlight", &_obj_highlight_op, NULL},
{"Clouseau/Evas/window/screenshot", &_win_screenshot_op, &_win_screenshot_get},
{"Clouseau/Eolian/object/info_get", &_obj_info_op, &_obj_info_get},
{"Clouseau/Object_Introspection/snapshot_start",&_snapshot_do_op, &_snapshot_started_cb},
{"Clouseau/Object_Introspection/snapshot_start",&_snapshot_do_op, NULL},
{"Clouseau/Object_Introspection/snapshot_done", &_snapshot_done_op, &_snapshot_done_cb},
{NULL, NULL, NULL}
);
@ -198,11 +197,12 @@ _obj_highlight(Clouseau_Extension *ext, uint64_t obj)
static void
_app_snapshot_request(Clouseau_Extension *ext)
{
const char *obj_kl_name = _config->wdgs_show_type == 0 ? "Efl.Canvas.Object" : "Efl.Ui.Widget";
const char *obj_kl_name = _config->wdgs_show_type == 0 ? "Efl.Canvas.Object" : "Elm.Widget";
const char *canvas_kl_name = "Efl.Canvas";
int size = strlen(obj_kl_name) + 1 + strlen(canvas_kl_name) + 1;
char *buf = alloca(size);
ext->ui_freeze_cb(ext, EINA_TRUE);
memcpy(buf, obj_kl_name, strlen(obj_kl_name) + 1);
memcpy(buf + strlen(obj_kl_name) + 1, canvas_kl_name, strlen(canvas_kl_name) + 1);
eina_debug_session_send(ext->session, ext->app_id, _snapshot_do_op, buf, size);
@ -348,16 +348,16 @@ _snapshot_load(Clouseau_Extension *ext, void *buffer, int size, int version EINA
}
static void
_obj_info_expand_request_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
_obj_info_expand_request_cb(void *data EINA_UNUSED, const Efl_Event *event)
{
Elm_Object_Item *glit = event_info;
Elm_Object_Item *glit = event->info;
elm_genlist_item_expanded_set(glit, EINA_TRUE);
}
static void
_obj_info_contract_request_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
_obj_info_contract_request_cb(void *data EINA_UNUSED, const Efl_Event *event)
{
Elm_Object_Item *glit = event_info;
Elm_Object_Item *glit = event->info;
elm_genlist_item_expanded_set(glit, EINA_FALSE);
}
@ -368,7 +368,7 @@ _ptr_highlight(Clouseau_Extension *ext, Eolian_Debug_Value *v)
{
case EOLIAN_DEBUG_POINTER:
{
_obj_highlight(ext, v->value);
_obj_highlight(ext, v->value.value);
break;
}
case EOLIAN_DEBUG_LIST:
@ -376,7 +376,7 @@ _ptr_highlight(Clouseau_Extension *ext, Eolian_Debug_Value *v)
Eina_List *itr;
EINA_LIST_FOREACH(v->complex_type_values, itr, v)
{
_obj_highlight(ext, v->value);
_obj_highlight(ext, v->value.value);
}
break;
}
@ -401,9 +401,9 @@ _obj_info_gl_selected(void *data EINA_UNUSED, Evas_Object *pobj,
}
static void
_obj_info_expanded_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info)
_obj_info_expanded_cb(void *data EINA_UNUSED, const Efl_Event *event)
{
Elm_Object_Item *glit = event_info;
Elm_Object_Item *glit = event->info;
const Elm_Genlist_Item_Class *itc = elm_genlist_item_item_class_get(glit);
if (itc == _obj_kl_info_itc)
{
@ -413,7 +413,7 @@ _obj_info_expanded_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info
EINA_LIST_FOREACH(kl->functions, itr, func)
{
Elm_Genlist_Item *glist = elm_genlist_item_append(
obj, _obj_func_info_itc, func, glit,
event->object, _obj_func_info_itc, func, glit,
ELM_GENLIST_ITEM_NONE, _obj_info_gl_selected, NULL);
elm_genlist_item_tooltip_content_cb_set(glist, _obj_info_tootip, func, NULL);
}
@ -421,9 +421,9 @@ _obj_info_expanded_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info
}
static void
_obj_info_contracted_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
_obj_info_contracted_cb(void *data EINA_UNUSED, const Efl_Event *event)
{
Elm_Object_Item *glit = event_info;
Elm_Object_Item *glit = event->info;
elm_genlist_item_subitems_clear(glit);
}
@ -435,7 +435,7 @@ _eolian_type_to_string(const Eolian_Type *param_eolian_type, Eina_Strbuf *buf)
if ((type == EOLIAN_TYPE_REGULAR || type == EOLIAN_TYPE_CLASS) &&
!eolian_type_base_type_get(param_eolian_type))
{
eina_strbuf_append_printf(buf, "%s", eolian_type_name_get(param_eolian_type));
eina_strbuf_append_printf(buf, "%s", eolian_type_full_name_get(param_eolian_type));
}
else
{
@ -443,7 +443,7 @@ _eolian_type_to_string(const Eolian_Type *param_eolian_type, Eina_Strbuf *buf)
if ((eolian_type_type_get(base) == EOLIAN_TYPE_REGULAR) ||
(eolian_type_type_get(base) == EOLIAN_TYPE_CLASS))
{
eina_strbuf_append_printf(buf, "%s *", eolian_type_name_get(base));
eina_strbuf_append_printf(buf, "%s *", eolian_type_full_name_get(base));
}
else if (eolian_type_type_get(base) == EOLIAN_TYPE_VOID)
{
@ -464,81 +464,71 @@ _eolian_value_to_string(Eolian_Debug_Value *value, Eina_Strbuf *buf)
case EOLIAN_DEBUG_STRING:
{
eina_strbuf_append_printf(buf, "\"%s\" ",
(char *)value->value);
(char *)value->value.value);
break;
}
case EOLIAN_DEBUG_POINTER:
{
eina_strbuf_append_printf(buf, "%p ",
(void *)value->value);
(void *)value->value.value);
break;
}
case EOLIAN_DEBUG_CHAR:
{
eina_strbuf_append_printf(buf, "%c ",
(char)value->value);
(char)value->value.value);
break;
}
case EOLIAN_DEBUG_INT:
{
eina_strbuf_append_printf(buf, "%d ",
(int)value->value);
(int)value->value.value);
break;
}
case EOLIAN_DEBUG_SHORT:
{
eina_strbuf_append_printf(buf, "%u ",
(unsigned int)value->value);
(unsigned int)value->value.value);
break;
}
case EOLIAN_DEBUG_DOUBLE:
{
eina_strbuf_append_printf(buf, "%f ",
(double)value->value);
(double)value->value.value);
break;
}
case EOLIAN_DEBUG_BOOLEAN:
{
eina_strbuf_append_printf(buf, "%s ",
(value->value ? "true" : "false"));
(value->value.value ? "true" : "false"));
break;
}
case EOLIAN_DEBUG_LONG:
{
eina_strbuf_append_printf(buf, "%ld ",
(long)value->value);
(long)value->value.value);
break;
}
case EOLIAN_DEBUG_UINT:
{
eina_strbuf_append_printf(buf, "%u ",
(unsigned int)value->value);
(unsigned int)value->value.value);
break;
}
case EOLIAN_DEBUG_LIST:
{
Eina_List *l = value->complex_type_values, *itr;
eina_strbuf_append_printf(buf, "%lX [", value->value);
eina_strbuf_append_printf(buf, "%lX [", value->value.value);
EINA_LIST_FOREACH(l, itr, value)
{
eina_strbuf_append_printf(buf, "%s%lX",
l != itr ? ", " : "",
value->value);
value->value.value);
}
eina_strbuf_append(buf, "]");
break;
}
case EOLIAN_DEBUG_STRUCT:
{
Eina_List *l = value->complex_type_values, *itr;
EINA_LIST_FOREACH(l, itr, value)
{
if (l != itr) eina_strbuf_append(buf, ", ");
_eolian_value_to_string(value, buf);
}
break;
}
default: eina_strbuf_append_printf(buf, "%lX ", value->value);
default: eina_strbuf_append_printf(buf, "%lX ", value->value.value);
}
}
@ -594,7 +584,7 @@ _obj_kl_info_item_label_get(void *data, Evas_Object *obj EINA_UNUSED,
const char *part EINA_UNUSED)
{
Eolian_Debug_Class *kl = data;
return strdup(eolian_class_name_get(kl->ekl));
return strdup(eolian_class_full_name_get(kl->ekl));
}
static char *
@ -661,16 +651,16 @@ _obj_info_get(Eina_Debug_Session *session, int src, void *buffer, int size)
}
static void
_objs_expand_request_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
_objs_expand_request_cb(void *data EINA_UNUSED, const Efl_Event *event)
{
Elm_Object_Item *glit = event_info;
Elm_Object_Item *glit = event->info;
elm_genlist_item_expanded_set(glit, EINA_TRUE);
}
static void
_objs_contract_request_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
_objs_contract_request_cb(void *data EINA_UNUSED, const Efl_Event *event)
{
Elm_Object_Item *glit = event_info;
Elm_Object_Item *glit = event->info;
elm_genlist_item_expanded_set(glit, EINA_FALSE);
}
@ -692,16 +682,16 @@ _objs_sel_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info)
}
static void
_objs_expanded_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info)
_objs_expanded_cb(void *data EINA_UNUSED, const Efl_Event *event)
{
Eina_List *itr;
Clouseau_Extension *ext = _ext_get(obj);
Elm_Object_Item *glit = event_info;
Clouseau_Extension *ext = _ext_get(event->object);
Elm_Object_Item *glit = event->info;
Obj_Info *info = elm_object_item_data_get(glit), *it_data;
if (!ext) return;
EINA_LIST_FOREACH(info->children, itr, it_data)
{
it_data->glitem = elm_genlist_item_append(obj, _objs_itc,
it_data->glitem = elm_genlist_item_append(event->object, _objs_itc,
it_data, glit,
it_data->children ? ELM_GENLIST_ITEM_TREE : ELM_GENLIST_ITEM_NONE,
_objs_sel_cb, ext);
@ -711,9 +701,9 @@ _objs_expanded_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info)
}
static void
_objs_contracted_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
_objs_contracted_cb(void *data EINA_UNUSED, const Efl_Event *event)
{
Elm_Object_Item *glit = event_info;
Elm_Object_Item *glit = event->info;
elm_genlist_item_subitems_clear(glit);
}
@ -821,10 +811,10 @@ show_screenshot_button_clicked(void *data EINA_UNUSED, const Efl_Event *event)
info->screenshots_menu = elm_menu_add(inst->wdgs->main);
efl_wref_add(info->screenshots_menu, &info->screenshots_menu);
bt_pos = efl_gfx_entity_position_get(bt);
bt_size = efl_gfx_entity_size_get(bt);
bt_pos = efl_gfx_position_get(bt);
bt_size = efl_gfx_size_get(bt);
elm_menu_move(info->screenshots_menu, bt_pos.x, bt_pos.y + bt_size.w);
efl_gfx_entity_visible_set(info->screenshots_menu, EINA_TRUE);
efl_gfx_visible_set(info->screenshots_menu, EINA_TRUE);
EINA_LIST_FOREACH(info->screenshots, itr, s)
{
char str[200];
@ -836,15 +826,6 @@ show_screenshot_button_clicked(void *data EINA_UNUSED, const Efl_Event *event)
}
}
static Eina_Bool
_snapshot_started_cb(Eina_Debug_Session *session, int src EINA_UNUSED,
void *buffer EINA_UNUSED, int size EINA_UNUSED)
{
Clouseau_Extension *ext = eina_debug_session_data_get(session);
ext->ui_freeze_cb(ext, EINA_TRUE);
return EINA_TRUE;
}
static Eina_Bool
_snapshot_done_cb(Eina_Debug_Session *session, int src EINA_UNUSED,
void *buffer EINA_UNUSED, int size EINA_UNUSED)
@ -910,7 +891,7 @@ _objs_item_content_get(void *data, Evas_Object *obj, const char *part)
Instance *inst = ext->data;
if (!canvas_id)
{
Class_Info *kl_info = eina_hash_find(inst->classes_hash_by_name, "Efl.Ui.Win_Legacy");
Class_Info *kl_info = eina_hash_find(inst->classes_hash_by_name, "Evas.Canvas");
if (kl_info) canvas_id = kl_info->id;
}
if (info->kl_id == canvas_id && !strcmp(part, "elm.swallow.end"))
@ -918,7 +899,7 @@ _objs_item_content_get(void *data, Evas_Object *obj, const char *part)
Eo *box = elm_box_add(obj);
evas_object_size_hint_weight_set(box, 1.000000, 1.000000);
elm_box_horizontal_set(box, EINA_TRUE);
efl_gfx_entity_visible_set(box, EINA_TRUE);
efl_gfx_visible_set(box, EINA_TRUE);
if (info->screenshots)
{
@ -1061,9 +1042,9 @@ _item_realize(Instance *inst, Obj_Info *info)
}
static void
_jump_entry_changed(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
_jump_entry_changed(void *data, const Efl_Event *event)
{
Eo *en = obj;
Eo *en = event->object;
Eo *inwin = data;
const char *ptr = elm_entry_entry_get(en);
Clouseau_Extension *ext = efl_key_data_get(en, "__extension");
@ -1102,7 +1083,7 @@ jump_to_ptr_inwin_show(void *data EINA_UNUSED, Evas_Object *obj, void *event_inf
elm_entry_scrollable_set(entry, EINA_TRUE);
elm_entry_single_line_set(entry, EINA_TRUE);
elm_object_part_text_set(entry, "guide", "Jump To Pointer");
evas_object_smart_callback_add(entry, "activated", _jump_entry_changed, inwin);
efl_event_callback_add(entry, ELM_ENTRY_EVENT_ACTIVATED, _jump_entry_changed, inwin);
efl_key_data_set(entry, "__extension", ext);
evas_object_show(entry);
elm_win_inwin_content_set(inwin, entry);
@ -1141,10 +1122,10 @@ _ui_get(Clouseau_Extension *ext, Eo *parent)
_objs_itc->func.text_get = _objs_item_label_get;
_objs_itc->func.content_get = _objs_item_content_get;
}
evas_object_smart_callback_add(inst->wdgs->objects_list, "expand,request", _objs_expand_request_cb, NULL);
evas_object_smart_callback_add(inst->wdgs->objects_list, "contract,request", _objs_contract_request_cb, NULL);
evas_object_smart_callback_add(inst->wdgs->objects_list, "expanded", _objs_expanded_cb, NULL);
evas_object_smart_callback_add(inst->wdgs->objects_list, "contracted", _objs_contracted_cb, NULL);
efl_event_callback_add(inst->wdgs->objects_list, ELM_GENLIST_EVENT_EXPAND_REQUEST, _objs_expand_request_cb, NULL);
efl_event_callback_add(inst->wdgs->objects_list, ELM_GENLIST_EVENT_CONTRACT_REQUEST, _objs_contract_request_cb, NULL);
efl_event_callback_add(inst->wdgs->objects_list, ELM_GENLIST_EVENT_EXPANDED, _objs_expanded_cb, NULL);
efl_event_callback_add(inst->wdgs->objects_list, ELM_GENLIST_EVENT_CONTRACTED, _objs_contracted_cb, NULL);
//Init object class info itc
if (!_obj_kl_info_itc)
@ -1160,10 +1141,10 @@ _ui_get(Clouseau_Extension *ext, Eo *parent)
_obj_func_info_itc->item_style = "default";
_obj_func_info_itc->func.text_get = _obj_func_info_item_label_get;
}
evas_object_smart_callback_add(inst->wdgs->object_infos_list, "expand,request", _obj_info_expand_request_cb, NULL);
evas_object_smart_callback_add(inst->wdgs->object_infos_list, "contract,request", _obj_info_contract_request_cb, NULL);
evas_object_smart_callback_add(inst->wdgs->object_infos_list, "expanded", _obj_info_expanded_cb, NULL);
evas_object_smart_callback_add(inst->wdgs->object_infos_list, "contracted", _obj_info_contracted_cb, NULL);
efl_event_callback_add(inst->wdgs->object_infos_list, ELM_GENLIST_EVENT_EXPAND_REQUEST, _obj_info_expand_request_cb, NULL);
efl_event_callback_add(inst->wdgs->object_infos_list, ELM_GENLIST_EVENT_CONTRACT_REQUEST, _obj_info_contract_request_cb, NULL);
efl_event_callback_add(inst->wdgs->object_infos_list, ELM_GENLIST_EVENT_EXPANDED, _obj_info_expanded_cb, NULL);
efl_event_callback_add(inst->wdgs->object_infos_list, ELM_GENLIST_EVENT_CONTRACTED, _obj_info_contracted_cb, NULL);
return inst->wdgs->main;
}
@ -1194,6 +1175,8 @@ extension_start(Clouseau_Extension *ext, Eo *parent)
memset(&(inst->snapshot), 0, sizeof(inst->snapshot));
eolian_directory_scan(EOLIAN_EO_DIR);
_config_load(ext);
ext->ui_object = _ui_get(ext, parent);

View File

@ -2,8 +2,8 @@ set(CMAKE_BUILD_TYPE Debug)
STRING(REGEX REPLACE "\n" "" EOLIAN_EO_DIR "${EOLIAN_EO_DIR}")
STRING(REGEX REPLACE " " "" EOLIAN_EO_DIR "${EOLIAN_EO_DIR}")
STRING(REGEX REPLACE "\n" "" EOLIAN_EO_DIR ${EOLIAN_EO_DIR})
STRING(REGEX REPLACE " " "" EOLIAN_EO_DIR ${EOLIAN_EO_DIR})
add_definitions(${CLI_COMMON_DEFINITIONS} -DEFL_EO_API_SUPPORT
-DEOLIAN_EO_DIR="${EOLIAN_EO_DIR}")

View File

@ -8,25 +8,17 @@
typedef enum {
STREAM_PAUSED = 0,
STREAM_PROCESSING
STREAM_STOPPED = 0,
STREAM_PROCESSING,
STREAM_PAUSED
} CLOUSEAU_PROFILER_STATUS;
typedef struct {
Evas_Object *profiler;
Ecore_Timer *record_get_timer;
CLOUSEAU_PROFILER_STATUS status; /*<< 0 - stopped, 1 - processing, 2 - paused */
struct {
Evas_Object *obj;
Evas_Object *status_btn;
Evas_Object *follow_btn;
Evas_Object *filters_btn;
Evas_Object *find_btn;
Evas_Object *time_range_btn;
Evas_Object *setting_btn;
} toolbar;
Eina_Bool follow;
Eina_Bool block_processed;
CLOUSEAU_PROFILER_STATUS status; /*<< 0 - stopped, 1 - processing, 2 - paused */
} stream;
} Inf;
static int _clouseau_profiling_extension_log_dom = 0;
@ -36,7 +28,6 @@ static int _record_off_op = EINA_DEBUG_OPCODE_INVALID;
static int _record_get_op = EINA_DEBUG_OPCODE_INVALID;
static Eina_Bool _record_get_cb(Eina_Debug_Session *, int, void *, int);
static void _follow_interval_status_change_cb(void *data, Evas_Object *obj, void *event_info);
EINA_DEBUG_OPCODES_ARRAY_DEFINE(_ops,
{"CPU/Freq/on", &_record_on_op, NULL},
@ -45,6 +36,7 @@ EINA_DEBUG_OPCODES_ARRAY_DEFINE(_ops,
{NULL, NULL, NULL}
);
EAPI const char *
extension_name_get()
{
@ -59,6 +51,18 @@ _record_request_cb(void *data)
return EINA_TRUE;
}
static void
_stream_processing_pause_cb(void *data,
Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
Clouseau_Extension *ext = data;
Inf *inf = ext->data;
eina_debug_session_send(ext->session, ext->app_id, _record_off_op, NULL, 0);
ecore_timer_del(inf->record_get_timer);
}
static void
_stream_processing_resume_cb(void *data,
Evas_Object *obj EINA_UNUSED,
@ -75,10 +79,21 @@ _stream_processing_resume_cb(void *data,
static void
_session_changed(Clouseau_Extension *ext)
{
Inf *inf = ext->data;
int i = 0;
Eina_Debug_Opcode *ops = _ops();
Inf *inf = ext->data;
switch (inf->stream.status)
{
case STREAM_PROCESSING:
evas_object_smart_callback_call(inf->profiler, "stream,processing,pause", NULL);
break;
case STREAM_PAUSED:
case STREAM_STOPPED:
default:
evas_object_smart_callback_call(inf->profiler, "stream,processing,resume", NULL);
}
EINA_LOG_DOM_DBG(_clouseau_profiling_extension_log_dom, "Session changed");
while (ops[i].opcode_name)
@ -86,24 +101,12 @@ _session_changed(Clouseau_Extension *ext)
if (ops[i].opcode_id) *(ops[i].opcode_id) = EINA_DEBUG_OPCODE_INVALID;
i++;
}
if (ext->session)
{
eina_debug_session_data_set(ext->session, ext);
eina_debug_opcodes_register(ext->session, ops, NULL, NULL);
}
/*disable controls on toolbar */
elm_object_disabled_set(inf->toolbar.status_btn, EINA_TRUE);
elm_object_disabled_set(inf->toolbar.follow_btn, EINA_TRUE);
if (!inf->block_processed)
{
elm_object_disabled_set(inf->toolbar.filters_btn, EINA_TRUE);
elm_object_disabled_set(inf->toolbar.time_range_btn, EINA_TRUE);
elm_object_disabled_set(inf->toolbar.find_btn, EINA_TRUE);
}
return;
}
@ -111,19 +114,8 @@ static void
_app_changed(Clouseau_Extension *ext)
{
Inf *inf = ext->data;
evas_object_smart_callback_call(inf->profiler, "stream,app,changed", &ext->app_id);
evas_object_smart_callback_call(inf->profiler, "stream,processing,stop", &ext->app_id);
EINA_LOG_DOM_DBG(_clouseau_profiling_extension_log_dom, "Application changed");
/*enable controls on toolbar */
elm_object_disabled_set(inf->toolbar.status_btn, EINA_FALSE);
elm_object_disabled_set(inf->toolbar.follow_btn, EINA_FALSE);
elm_object_disabled_set(inf->toolbar.filters_btn, EINA_TRUE);
elm_object_disabled_set(inf->toolbar.time_range_btn, EINA_TRUE);
elm_object_disabled_set(inf->toolbar.find_btn, EINA_TRUE);
_follow_interval_status_change_cb(ext, inf->toolbar.follow_btn, NULL);
inf->block_processed = EINA_FALSE;
return;
}
@ -138,15 +130,7 @@ _profiling_import(Clouseau_Extension *ext,
Stream_Block_Data block_data = { .size = size, .data = buffer };
evas_object_smart_callback_call(inf->profiler, "stream,block,process", &block_data);
inf->block_processed = EINA_TRUE;
_stream_processing_resume_cb(ext,NULL, NULL);
if (inf->block_processed)
{
elm_object_disabled_set(inf->toolbar.filters_btn, EINA_FALSE);
elm_object_disabled_set(inf->toolbar.time_range_btn, EINA_FALSE);
elm_object_disabled_set(inf->toolbar.find_btn, EINA_FALSE);
}
return;
}
@ -157,212 +141,20 @@ _record_get_cb(Eina_Debug_Session *session, int cid EINA_UNUSED, void *buffer, i
_profiling_import(ext, buffer, size, -1);
return EINA_TRUE;
}
static void
_find_dialog_show_cb(void *data,
Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
Clouseau_Extension *ext = (Clouseau_Extension *)data;
Inf *inf = ext->data;
evas_object_smart_callback_call(inf->profiler, "find,show", NULL);
}
static void
_time_range_dialog_show_cb(void *data,
Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
Clouseau_Extension *ext = (Clouseau_Extension *)data;
Inf *inf = ext->data;
evas_object_smart_callback_call(inf->profiler, "time,interval,win", NULL);
}
static void
_filters_dialog_show_cb(void *data,
Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
Clouseau_Extension *ext = (Clouseau_Extension *)data;
Inf *inf = ext->data;
evas_object_smart_callback_call(inf->profiler, "filters,show", NULL);
}
static void
_unfollow_interval_cb(void *data,
Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
Clouseau_Extension *ext = (Clouseau_Extension *)data;
Inf *inf = ext->data;
Evas_Object *icon = NULL;
evas_object_smart_callback_call(inf->profiler, "unfollow,processed,data", NULL);
inf->follow = EINA_FALSE;
icon = elm_object_part_content_get(inf->toolbar.follow_btn, "icon");
elm_icon_standard_set(icon, "go-last");
}
static void
_follow_interval_status_change_cb(void *data,
Evas_Object *obj,
void *event_info EINA_UNUSED)
{
Clouseau_Extension *ext = (Clouseau_Extension *)data;
Inf *inf = ext->data;
char *icon_name = NULL;
Evas_Object *icon = NULL;
if (inf->follow)
{
evas_object_smart_callback_call(inf->profiler, "unfollow,processed,data", NULL);
inf->follow = EINA_FALSE;
icon_name = "go-last";
}
else
{
evas_object_smart_callback_call(inf->profiler, "follow,processed,data", NULL);
inf->follow = EINA_TRUE;
icon_name = "go-bottom";
}
icon = elm_object_part_content_get(obj, "icon");
elm_icon_standard_set(icon, icon_name);
}
static void
_profiling_status_change_cb(void *data,
Evas_Object *obj,
void *event_info EINA_UNUSED)
{
Clouseau_Extension *ext = (Clouseau_Extension *)data;
Inf *inf = ext->data;
char *icon_name = NULL;
Evas_Object *icon = NULL;
switch (inf->status)
{
case STREAM_PROCESSING:
{
eina_debug_session_send(ext->session, ext->app_id, _record_off_op, NULL, 0);
ecore_timer_del(inf->record_get_timer);
inf->status = STREAM_PAUSED;
icon_name = "media-playback-start";
break;
}
case STREAM_PAUSED:
{
eina_debug_session_send(ext->session, ext->app_id, _record_on_op, NULL, 0);
inf->record_get_timer = NULL;
_stream_processing_resume_cb(ext,NULL, NULL);
inf->status = STREAM_PROCESSING;
icon_name = "media-playback-pause";
break;
}
}
icon = elm_object_part_content_get(obj, "icon");
elm_icon_standard_set(icon, icon_name);
}
static Eo *
_ui_get(Clouseau_Extension *ext, Eo *parent)
{
Inf *inf = ext->data;
Evas_Object *toolbar = NULL;
Evas_Object *box = NULL;
Evas_Object *button = NULL, *icon = NULL;
Elm_Object_Item *item = NULL;
box = elm_box_add(parent);
evas_object_size_hint_weight_set(box, 1, 1);
evas_object_size_hint_align_set(box, -1, -1);
evas_object_show(box);
toolbar = elm_toolbar_add(parent);
inf->toolbar.obj = toolbar;
elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_SCROLL);
elm_toolbar_select_mode_set(toolbar, ELM_OBJECT_SELECT_MODE_NONE);
elm_toolbar_homogeneous_set(toolbar, EINA_TRUE);
elm_object_style_set(toolbar, "transparent");
elm_toolbar_menu_parent_set(toolbar, parent);
evas_object_size_hint_weight_set(toolbar, 0, 0);
evas_object_size_hint_align_set(toolbar, -1, 0);
evas_object_show(toolbar);
item = elm_toolbar_item_append(toolbar, NULL, NULL, NULL, NULL);
button = elm_button_add(toolbar);
elm_object_item_part_content_set(item, "object", button);
evas_object_smart_callback_add(button, "clicked", _profiling_status_change_cb, ext);
icon = elm_icon_add(button);
elm_image_resizable_set(icon, EINA_FALSE, EINA_FALSE);
elm_icon_standard_set(icon, "media-playback-start");
elm_object_part_content_set(button, "icon", icon);
inf->toolbar.status_btn = button;
evas_object_show(button);
elm_object_disabled_set(button, EINA_TRUE);
item = elm_toolbar_item_append(toolbar, NULL, NULL, NULL, NULL);
button = elm_button_add(toolbar);
elm_object_item_part_content_set(item, "object", button);
evas_object_smart_callback_add(button, "clicked", _follow_interval_status_change_cb, ext);
icon = elm_icon_add(button);
elm_icon_standard_set(icon, "go-last");
elm_object_part_content_set(button, "icon", icon);
evas_object_show(button);
inf->toolbar.follow_btn = button;
elm_object_disabled_set(button, EINA_TRUE);
item = elm_toolbar_item_append(toolbar, NULL, NULL, NULL, NULL);
button = elm_button_add(toolbar);
elm_object_item_part_content_set(item, "object", button);
evas_object_smart_callback_add(button, "clicked", _filters_dialog_show_cb, ext);
icon = elm_icon_add(button);
elm_icon_standard_set(icon, "view-list-details");
elm_object_part_content_set(button, "icon", icon);
evas_object_show(button);
inf->toolbar.filters_btn = button;
elm_object_disabled_set(button, EINA_TRUE);
item = elm_toolbar_item_append(toolbar, NULL, NULL, NULL, NULL);
button = elm_button_add(toolbar);
elm_object_item_part_content_set(item, "object", button);
evas_object_smart_callback_add(button, "clicked", _find_dialog_show_cb, ext);
icon = elm_icon_add(button);
elm_icon_standard_set(icon, "system-search");
elm_object_part_content_set(button, "icon", icon);
evas_object_show(button);
inf->toolbar.find_btn = button;
item = elm_toolbar_item_append(toolbar, NULL, NULL, NULL, NULL);
button = elm_button_add(toolbar);
elm_object_item_part_content_set(item, "object", button);
evas_object_smart_callback_add(button, "clicked", _time_range_dialog_show_cb, ext);
icon = elm_icon_add(button);
elm_icon_standard_set(icon, "clock");
elm_object_part_content_set(button, "icon", icon);
evas_object_show(button);
inf->toolbar.time_range_btn = button;
elm_object_disabled_set(button, EINA_TRUE);
item = elm_toolbar_item_append(toolbar, NULL, NULL, NULL, NULL);
button = elm_button_add(toolbar);
elm_object_item_part_content_set(item, "object", button);
icon = elm_icon_add(button);
elm_icon_standard_set(icon, "preferences-other");
elm_object_part_content_set(button, "icon", icon);
evas_object_show(button);
inf->toolbar.setting_btn= button;
elm_object_disabled_set(button, EINA_TRUE);
inf->profiler = efl_profiling_viewer_init(parent);
inf->profiler = efl_profiling_viewer_init(parent);
evas_object_size_hint_weight_set(inf->profiler, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(inf->profiler, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_smart_callback_add(inf->profiler, "unfollow", _unfollow_interval_cb, ext);
elm_box_pack_end(box, toolbar);
elm_box_pack_end(box, inf->profiler);
evas_object_smart_callback_add(inf->profiler, "stream,processing,pause",
_stream_processing_pause_cb, ext);
evas_object_smart_callback_add(inf->profiler, "stream,processing,resume",
_stream_processing_resume_cb, ext);
return box;
return inf->profiler;
}
EAPI Eina_Bool
@ -397,11 +189,10 @@ extension_stop(Clouseau_Extension *ext)
Inf *inf = ext->data;
evas_object_smart_callback_call(inf->profiler, "log,close", NULL);
efl_profiling_viewer_shutdown(inf->profiler);
free(inf);
efl_del(ext->ui_object);
free(inf);
EINA_LOG_DOM_DBG(_clouseau_profiling_extension_log_dom, "Extension stopped");
eina_log_domain_unregister(_clouseau_profiling_extension_log_dom);
eina_shutdown();