Adding screenshot support
This commit is contained in:
parent
eb055acb19
commit
a517c9a522
|
@ -19,6 +19,8 @@ include_directories(
|
||||||
${ECORE_INCLUDE_DIRS}
|
${ECORE_INCLUDE_DIRS}
|
||||||
${EVAS_INCLUDE_DIRS}
|
${EVAS_INCLUDE_DIRS}
|
||||||
${EDEBUG_INCLUDE_DIRS}
|
${EDEBUG_INCLUDE_DIRS}
|
||||||
|
${EVAS_DEBUG_INCLUDE_DIRS}
|
||||||
|
${EOLIAN_DEBUG_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
set(EOLIAN_INCLUDE_FLAG -I \"${EOLIAN_EO_DIR}/eo-1\" -I${CMAKE_CURRENT_SOURCE_DIR})
|
set(EOLIAN_INCLUDE_FLAG -I \"${EOLIAN_EO_DIR}/eo-1\" -I${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
@ -37,6 +39,8 @@ target_link_libraries(clouseau_client
|
||||||
${ECORE_LIBRARIES}
|
${ECORE_LIBRARIES}
|
||||||
${EVAS_LIBRARIES}
|
${EVAS_LIBRARIES}
|
||||||
${EDEBUG_LIBRARIES}
|
${EDEBUG_LIBRARIES}
|
||||||
|
eolian_debug
|
||||||
|
evas_debug
|
||||||
ecore_file
|
ecore_file
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
|
|
||||||
#include <Eolian_Debug.h>
|
#include <Eolian_Debug.h>
|
||||||
|
#include <Evas_Debug.h>
|
||||||
|
|
||||||
#define SHOW_SCREENSHOT "/images/show-screenshot.png"
|
#define SHOW_SCREENSHOT "/images/show-screenshot.png"
|
||||||
|
|
||||||
|
@ -39,6 +40,7 @@ static uint32_t _evlog_off_opcode = EINA_DEBUG_OPCODE_INVALID;
|
||||||
static uint32_t _elm_list_opcode = EINA_DEBUG_OPCODE_INVALID;
|
static uint32_t _elm_list_opcode = EINA_DEBUG_OPCODE_INVALID;
|
||||||
static uint32_t _obj_info_opcode = EINA_DEBUG_OPCODE_INVALID;
|
static uint32_t _obj_info_opcode = EINA_DEBUG_OPCODE_INVALID;
|
||||||
static uint32_t _obj_highlight_opcode = EINA_DEBUG_OPCODE_INVALID;
|
static uint32_t _obj_highlight_opcode = EINA_DEBUG_OPCODE_INVALID;
|
||||||
|
static uint32_t _obj_screenshot_opcode = EINA_DEBUG_OPCODE_INVALID;
|
||||||
|
|
||||||
static Gui_Main_Win_Widgets *_main_widgets = NULL;
|
static Gui_Main_Win_Widgets *_main_widgets = NULL;
|
||||||
static Gui_Profiles_Win_Widgets *_profiles_wdgs = NULL;
|
static Gui_Profiles_Win_Widgets *_profiles_wdgs = NULL;
|
||||||
|
@ -454,6 +456,38 @@ _objs_item_label_get(void *data, Evas_Object *obj EINA_UNUSED,
|
||||||
return strdup(buf);
|
return strdup(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_open_app_window(bmp_info_st *st)
|
||||||
|
{
|
||||||
|
Gui_Screenshot_Win_Widgets *s_widgets = gui_screenshot_win_create(NULL);
|
||||||
|
|
||||||
|
Evas_Object *o;
|
||||||
|
eo_do(s_widgets->img, o = elm_obj_image_object_get());
|
||||||
|
evas_object_image_colorspace_set(o, EVAS_COLORSPACE_ARGB8888);
|
||||||
|
evas_object_image_alpha_set(o, EINA_FALSE);
|
||||||
|
evas_object_image_size_set(o, st->w, st->h);
|
||||||
|
evas_object_image_data_copy_set(o, st->bmp);
|
||||||
|
eo_do(s_widgets->screenshot_win, elm_obj_win_resize_object_add(o));
|
||||||
|
evas_object_show(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_debug_screenshot_cb(Eina_Debug_Client *src EINA_UNUSED,
|
||||||
|
void *buffer, int size)
|
||||||
|
{
|
||||||
|
printf("recieved bmp size %d\n", size);
|
||||||
|
bmp_info_st *st = clouseau_screenshot_decode(buffer, size);
|
||||||
|
if(!st)
|
||||||
|
{
|
||||||
|
printf("Error: bad screenshot data\n");
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
_open_app_window(st);
|
||||||
|
free(st->bmp);
|
||||||
|
free(st);
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
Eina_Bool
|
Eina_Bool
|
||||||
screenshot_req_cb(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
|
screenshot_req_cb(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
|
@ -461,6 +495,9 @@ screenshot_req_cb(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *d
|
||||||
eo_do(obj, info_node = eo_key_data_get("__info_node"));
|
eo_do(obj, info_node = eo_key_data_get("__info_node"));
|
||||||
|
|
||||||
printf("show screenshot of obj %s %p\n", info_node->info->kl_name, info_node->info->ptr);
|
printf("show screenshot of obj %s %p\n", info_node->info->kl_name, info_node->info->ptr);
|
||||||
|
uint64_t ptr = (uint64_t)info_node->info->ptr;
|
||||||
|
eina_debug_session_send(_current_client, _obj_screenshot_opcode, &ptr, sizeof(uint64_t));
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -738,6 +775,7 @@ static const Eina_Debug_Opcode ops[] =
|
||||||
{"Elementary/objects_list", &_elm_list_opcode, &_elm_objects_list_cb},
|
{"Elementary/objects_list", &_elm_list_opcode, &_elm_objects_list_cb},
|
||||||
{"Eolian/object/info_get", &_obj_info_opcode, &_debug_obj_info_cb},
|
{"Eolian/object/info_get", &_obj_info_opcode, &_debug_obj_info_cb},
|
||||||
{"Evas/object/highlight", &_obj_highlight_opcode, NULL},
|
{"Evas/object/highlight", &_obj_highlight_opcode, NULL},
|
||||||
|
{"Evas/object/screenshot", &_obj_screenshot_opcode, &_debug_screenshot_cb},
|
||||||
{NULL, NULL, NULL}
|
{NULL, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
49
src/bin/gui
49
src/bin/gui
|
@ -590,6 +590,55 @@
|
||||||
"Efl.Gfx.Base.size":[40, 40],
|
"Efl.Gfx.Base.size":[40, 40],
|
||||||
"Efl.File.file":["SCREENSHOT_ICON", null]
|
"Efl.File.file":["SCREENSHOT_ICON", null]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"screenshot_win":
|
||||||
|
{
|
||||||
|
"Desc":
|
||||||
|
{
|
||||||
|
"parent":null,
|
||||||
|
"class":"Elm.Win",
|
||||||
|
"public":true
|
||||||
|
},
|
||||||
|
"Properties":
|
||||||
|
{
|
||||||
|
"Elm.Win.name":["Win"],
|
||||||
|
"Elm.Win.type":["ELM_WIN_BASIC"],
|
||||||
|
"Elm.Win.autodel":[true],
|
||||||
|
"Efl.Gfx.Base.size":[300, 300],
|
||||||
|
"Elm.Widget.part_text":[null, "Window"],
|
||||||
|
"Evas.Object.size_hint_weight":[1, 1],
|
||||||
|
"Efl.Gfx.Base.visible":[true],
|
||||||
|
"Elm.Win.title":["Screenshot"]
|
||||||
|
},
|
||||||
|
"Contains":["elm_bg3", "img"]
|
||||||
|
},
|
||||||
|
"elm_bg3":
|
||||||
|
{
|
||||||
|
"Desc":
|
||||||
|
{
|
||||||
|
"parent":"screenshot_win",
|
||||||
|
"class":"Elm.Bg"
|
||||||
|
},
|
||||||
|
"Properties":
|
||||||
|
{
|
||||||
|
"Evas.Object.size_hint_weight":[1, 1],
|
||||||
|
"Efl.Gfx.Base.visible":[true]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"img":
|
||||||
|
{
|
||||||
|
"Desc":
|
||||||
|
{
|
||||||
|
"parent":"screenshot_win",
|
||||||
|
"class":"Elm.Image",
|
||||||
|
"public":true
|
||||||
|
},
|
||||||
|
"Properties":
|
||||||
|
{
|
||||||
|
"Evas.Object.size_hint_weight":[1, 1],
|
||||||
|
"Efl.Gfx.Base.visible":[true],
|
||||||
|
"Efl.Gfx.Base.size":[40, 40]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -398,6 +398,40 @@ gui_screenshot_button_create(Eo *__main_parent)
|
||||||
return pub_widgets;
|
return pub_widgets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Gui_Screenshot_Win_Widgets *
|
||||||
|
gui_screenshot_win_create(Eo *__main_parent)
|
||||||
|
{
|
||||||
|
Gui_Screenshot_Win_Widgets *pub_widgets = calloc(1, sizeof(*pub_widgets));
|
||||||
|
|
||||||
|
Eo *screenshot_win;
|
||||||
|
Eo *elm_bg3;
|
||||||
|
Eo *img;
|
||||||
|
|
||||||
|
|
||||||
|
screenshot_win = eo_add(ELM_WIN_CLASS, __main_parent, elm_obj_win_name_set("Win"),
|
||||||
|
elm_obj_win_type_set(ELM_WIN_BASIC));
|
||||||
|
pub_widgets->screenshot_win = screenshot_win;
|
||||||
|
eo_do(screenshot_win, elm_obj_win_autodel_set(EINA_TRUE));
|
||||||
|
eo_do(screenshot_win, efl_gfx_size_set(300, 300));
|
||||||
|
eo_do(screenshot_win, elm_obj_widget_part_text_set(NULL, "Window"));
|
||||||
|
eo_do(screenshot_win, evas_obj_size_hint_weight_set(1.000000, 1.000000));
|
||||||
|
eo_do(screenshot_win, elm_obj_win_title_set("Screenshot"));
|
||||||
|
elm_bg3 = eo_add(ELM_BG_CLASS, screenshot_win);
|
||||||
|
eo_do(elm_bg3, evas_obj_size_hint_weight_set(1.000000, 1.000000));
|
||||||
|
eo_do(elm_bg3, efl_gfx_visible_set(EINA_TRUE));
|
||||||
|
img = eo_add(ELM_IMAGE_CLASS, screenshot_win);
|
||||||
|
pub_widgets->img = img;
|
||||||
|
eo_do(img, evas_obj_size_hint_weight_set(1.000000, 1.000000));
|
||||||
|
eo_do(img, efl_gfx_visible_set(EINA_TRUE));
|
||||||
|
eo_do(img, efl_gfx_size_set(40, 40));
|
||||||
|
eo_do(screenshot_win, elm_obj_win_resize_object_add(elm_bg3));
|
||||||
|
eo_do(screenshot_win, elm_obj_win_resize_object_add(img));
|
||||||
|
eo_do(screenshot_win, efl_gfx_visible_set(EINA_TRUE));
|
||||||
|
eo_do(screenshot_win, eo_event_callback_add(EO_BASE_EVENT_DEL, _pubs_free_cb, pub_widgets));
|
||||||
|
|
||||||
|
return pub_widgets;
|
||||||
|
}
|
||||||
|
|
||||||
Gui_Widgets *gui_gui_get()
|
Gui_Widgets *gui_gui_get()
|
||||||
{
|
{
|
||||||
static Eina_Bool initialized = EINA_FALSE;
|
static Eina_Bool initialized = EINA_FALSE;
|
||||||
|
|
|
@ -40,6 +40,13 @@ typedef struct
|
||||||
} Gui_Screenshot_Button_Widgets;
|
} Gui_Screenshot_Button_Widgets;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
Eo *screenshot_win;
|
||||||
|
Eo *img;
|
||||||
|
} Gui_Screenshot_Win_Widgets;
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Gui_Main_Win_Widgets *main_win;
|
Gui_Main_Win_Widgets *main_win;
|
||||||
} Gui_Widgets;
|
} Gui_Widgets;
|
||||||
|
@ -52,5 +59,7 @@ Gui_New_Profile_Win_Widgets *gui_new_profile_win_create(Eo *parent);
|
||||||
|
|
||||||
Gui_Screenshot_Button_Widgets *gui_screenshot_button_create(Eo *parent);
|
Gui_Screenshot_Button_Widgets *gui_screenshot_button_create(Eo *parent);
|
||||||
|
|
||||||
|
Gui_Screenshot_Win_Widgets *gui_screenshot_win_create(Eo *parent);
|
||||||
|
|
||||||
Gui_Widgets *gui_gui_get();
|
Gui_Widgets *gui_gui_get();
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue