#include <wayland-client.h>
#include <wayland-tbm-client.h>
#include <tizen-extension-client-protocol.h>
-#include <screenshooter-client-protocol.h>
#include <efl_util_screenshot_extension.h>
struct
{
struct wl_event_queue *queue;
- struct screenshooter *screenshooter;
struct tizen_screenshooter *tz_screenshooter;
struct wayland_tbm_client *tbm_client;
Eina_List *output_list;
EINA_FALSE,
NULL, NULL, NULL,
{ 0, NULL, NULL, NULL }, /* tizen_policy protocol */
- { NULL, NULL, NULL, NULL, NULL, 0 }, /* screenshooter protocol */
+ { NULL, NULL, NULL, NULL, 0 }, /* screenshooter protocol */
{ NULL, -1, NULL, NULL, NULL, 0, 0 }, /* tizen_input_device_manager protocol */
NULL, /* wl_seat protocol */
{ 0, NULL, NULL } /* display_policy protocol */
};
static void
-_cb_wl_screenshot_done(void *data, struct screenshooter *screenshooter)
+_cb_tz_screenshot_format(void *data, struct tizen_screenshooter *tz_screenshooter, uint32_t format)
{
- Eina_Bool *shot_done = (Eina_Bool*)data;
- if (shot_done)
- *shot_done = EINA_TRUE;
}
-static const struct screenshooter_listener screenshooter_listener =
-{
- _cb_wl_screenshot_done
-};
-
static void
-_cb_tz_screenshot_format(void *data, struct tizen_screenshooter *tz_screenshooter, uint32_t format)
+_cb_tz_screenshot_noti(void *data, struct tizen_screenshooter *tz_screenshooter, uint32_t noti)
{
+ _eflutil.wl.shot.noti = noti;
}
static void
-_cb_tz_screenshot_noti(void *data, struct tizen_screenshooter *tz_screenshooter, uint32_t noti)
+_cb_tz_screenshot_done(void *data, struct tizen_screenshooter *tz_screenshooter)
{
- _eflutil.wl.shot.noti = noti;
+ Eina_Bool *shot_done = (Eina_Bool*)data;
+ if (shot_done)
+ *shot_done = EINA_TRUE;
}
static const struct tizen_screenshooter_listener tz_screenshooter_listener =
{
_cb_tz_screenshot_format,
- _cb_tz_screenshot_noti
+ _cb_tz_screenshot_noti,
+ _cb_tz_screenshot_done,
};
static void
const char *interface,
unsigned int version)
{
- if (strcmp(interface, "screenshooter") == 0)
- {
- _eflutil.wl.shot.screenshooter = wl_registry_bind(reg, name, &screenshooter_interface, version);
- screenshooter_add_listener(_eflutil.wl.shot.screenshooter, &screenshooter_listener, NULL);
- }
- else if (strcmp(interface, "tizen_screenshooter") == 0)
+ if (strcmp(interface, "tizen_screenshooter") == 0)
{
_eflutil.wl.shot.tz_screenshooter = wl_registry_bind(reg, name, &tizen_screenshooter_interface, version);
tizen_screenshooter_add_listener(_eflutil.wl.shot.tz_screenshooter, &tz_screenshooter_listener, NULL);
EINA_SAFETY_ON_NULL_GOTO(screenshot, fail_memory);
}
- if (!_eflutil.wl.shot.screenshooter)
+ if (!_eflutil.wl.shot.tz_screenshooter)
{
ret = _wl_init();
if (ret == (int)EINA_FALSE)
ret = wl_display_roundtrip_queue(_eflutil.wl.dpy, _eflutil.wl.shot.queue);
EINA_SAFETY_ON_TRUE_GOTO(ret == -1, fail_init);
- EINA_SAFETY_ON_NULL_GOTO(_eflutil.wl.shot.screenshooter, fail_init);
EINA_SAFETY_ON_NULL_GOTO(_eflutil.wl.shot.tz_screenshooter, fail_init);
_eflutil.wl.shot.tbm_client = wayland_tbm_client_init(_eflutil.wl.dpy);
g_screenshot = screenshot;
set_last_result(EFL_UTIL_ERROR_NONE);
- screenshooter_set_user_data(_eflutil.wl.shot.screenshooter, &screenshot->shot_done);
+ tizen_screenshooter_set_user_data(_eflutil.wl.shot.tz_screenshooter, &screenshot->shot_done);
_screenshot_mutex_unlock();
_eflutil.wl.shot.tbm_client = NULL;
}
- if (_eflutil.wl.shot.screenshooter)
- {
- screenshooter_destroy(_eflutil.wl.shot.screenshooter);
- _eflutil.wl.shot.screenshooter = NULL;
- }
if (_eflutil.wl.shot.tz_screenshooter)
{
tizen_screenshooter_destroy(_eflutil.wl.shot.tz_screenshooter);
goto fail;
}
- screenshooter_shoot(_eflutil.wl.shot.screenshooter, output->output, buffer);
+ tizen_screenshooter_shoot(_eflutil.wl.shot.tz_screenshooter, output->output, buffer);
screenshot->shot_done = EINA_FALSE;
+
while (!screenshot->shot_done && ret != -1)
ret = wl_display_roundtrip_queue(_eflutil.wl.dpy, _eflutil.wl.shot.queue);
if (ret == -1)
{
- fprintf(stderr, "[screenshot] fail: screenshooter_shoot\n"); /* LCOV_EXCL_LINE */
+ fprintf(stderr, "[screenshot] fail: tizen_screenshooter_shoot\n"); /* LCOV_EXCL_LINE */
goto fail;
}