forked from enlightenment/enlightenment
update gadget runner to (stabilized) efl api
efl-wl -> efl-canvas-wl
This commit is contained in:
parent
9764dd76a7
commit
b80ddda9fb
|
@ -305,7 +305,7 @@ if get_option('wl') == true
|
||||||
dir_wayland_protocols = wayland_protocols.get_pkgconfig_variable('pkgdatadir')
|
dir_wayland_protocols = wayland_protocols.get_pkgconfig_variable('pkgdatadir')
|
||||||
wayland_version = '>= 1.11.0'
|
wayland_version = '>= 1.11.0'
|
||||||
dep_wayland = [ dependency('ecore-wl2'),
|
dep_wayland = [ dependency('ecore-wl2'),
|
||||||
dependency('efl-wl'),
|
dependency('efl-canvas-wl'),
|
||||||
dependency('wayland-server' , version: wayland_version),
|
dependency('wayland-server' , version: wayland_version),
|
||||||
dependency('wayland-client' , version: wayland_version),
|
dependency('wayland-client' , version: wayland_version),
|
||||||
wayland_protocols,
|
wayland_protocols,
|
||||||
|
@ -321,7 +321,7 @@ if get_option('wl') == true
|
||||||
endif
|
endif
|
||||||
requires_wayland = ' '.join([ 'wayland-protocols >= 1.12',
|
requires_wayland = ' '.join([ 'wayland-protocols >= 1.12',
|
||||||
'ecore-wl2',
|
'ecore-wl2',
|
||||||
'efl-wl',
|
'efl-canvas-wl',
|
||||||
requires_drm,
|
requires_drm,
|
||||||
' '.join(['wayland-server' , wayland_version]),
|
' '.join(['wayland-server' , wayland_version]),
|
||||||
' '.join(['wayland-client' , wayland_version]),
|
' '.join(['wayland-client' , wayland_version]),
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#ifdef HAVE_WL_DRM
|
#ifdef HAVE_WL_DRM
|
||||||
#include <Ecore_Drm2.h>
|
#include <Ecore_Drm2.h>
|
||||||
#endif
|
#endif
|
||||||
#include <Efl_Wl.h>
|
#include <Efl_Canvas_Wl.h>
|
||||||
|
|
||||||
E_API int E_EVENT_TEXT_INPUT_PANEL_VISIBILITY_CHANGE = -1;
|
E_API int E_EVENT_TEXT_INPUT_PANEL_VISIBILITY_CHANGE = -1;
|
||||||
static xkb_keycode_t (*_xkb_keymap_key_by_name)(void *, const char *);
|
static xkb_keycode_t (*_xkb_keymap_key_by_name)(void *, const char *);
|
||||||
|
@ -429,7 +429,7 @@ nested_keymap_update(void)
|
||||||
Evas_Object *obj;
|
Evas_Object *obj;
|
||||||
|
|
||||||
EINA_LIST_FOREACH(e_comp_wl->efl_wls, l, obj)
|
EINA_LIST_FOREACH(e_comp_wl->efl_wls, l, obj)
|
||||||
efl_wl_seat_keymap_set(obj, NULL, e_comp_wl->xkb.state, e_comp_wl->xkb.map_string, &e_comp_wl->kbd.keys);
|
efl_canvas_wl_seat_keymap_set(obj, NULL, e_comp_wl->xkb.state, e_comp_wl->xkb.map_string, &e_comp_wl->kbd.keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include "e.h"
|
#include "e.h"
|
||||||
#include <Efl_Wl.h>
|
#include <Efl_Canvas_Wl.h>
|
||||||
#include "e-gadget-server-protocol.h"
|
#include "e-gadget-server-protocol.h"
|
||||||
#include "action_route-server-protocol.h"
|
#include "action_route-server-protocol.h"
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
|
@ -38,7 +38,7 @@ typedef struct Instance
|
||||||
E_Gadget_Site_Anchor anchor;
|
E_Gadget_Site_Anchor anchor;
|
||||||
Evas_Object *box;
|
Evas_Object *box;
|
||||||
Evas_Object *obj;
|
Evas_Object *obj;
|
||||||
Ecore_Exe *exe;
|
Efl_Exe *exe;
|
||||||
Config_Item *ci;
|
Config_Item *ci;
|
||||||
Eina_Hash *allowed_pids;
|
Eina_Hash *allowed_pids;
|
||||||
Eina_List *tooltip_surfaces;
|
Eina_List *tooltip_surfaces;
|
||||||
|
@ -80,6 +80,7 @@ typedef struct Wizard_Item
|
||||||
Eina_Bool sandbox E_BITFIELD;
|
Eina_Bool sandbox E_BITFIELD;
|
||||||
} Wizard_Item;
|
} Wizard_Item;
|
||||||
|
|
||||||
|
static void runner_exe_del(void *data, const Efl_Event *ev);
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
sandbox_name(const char *filename)
|
sandbox_name(const char *filename)
|
||||||
|
@ -147,7 +148,8 @@ runner_run(Instance *inst)
|
||||||
|
|
||||||
unshare(CLONE_NEWPID);
|
unshare(CLONE_NEWPID);
|
||||||
|
|
||||||
inst->exe = efl_wl_run(inst->obj, inst->ci->cmd);
|
inst->exe = efl_canvas_wl_run(inst->obj, inst->ci->cmd);
|
||||||
|
efl_event_callback_add(inst->exe, EFL_TASK_EVENT_EXIT, runner_exe_del, inst);
|
||||||
|
|
||||||
setns(ns_fd, CLONE_NEWPID);
|
setns(ns_fd, CLONE_NEWPID);
|
||||||
|
|
||||||
|
@ -157,8 +159,7 @@ runner_run(Instance *inst)
|
||||||
e_util_env_set("LD_PRELOAD", preload);
|
e_util_env_set("LD_PRELOAD", preload);
|
||||||
free(preload);
|
free(preload);
|
||||||
eina_hash_free_buckets(inst->allowed_pids);
|
eina_hash_free_buckets(inst->allowed_pids);
|
||||||
pid = ecore_exe_pid_get(inst->exe);
|
pid = efl_exe_pid_get(inst->exe);
|
||||||
ecore_exe_data_set(inst->exe, inst);
|
|
||||||
eina_hash_add(inst->allowed_pids, &pid, (void*)1);
|
eina_hash_add(inst->allowed_pids, &pid, (void*)1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +183,7 @@ _config_close(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_inf
|
||||||
if (!inst) ci->cmd_changed = 0;
|
if (!inst) ci->cmd_changed = 0;
|
||||||
if (!ci->cmd_changed) return;
|
if (!ci->cmd_changed) return;
|
||||||
ci->cmd_changed = 0;
|
ci->cmd_changed = 0;
|
||||||
if (inst->exe) ecore_exe_quit(inst->exe);
|
if (inst->exe) efl_exe_signal(inst->exe, EFL_EXE_SIGNAL_QUIT);
|
||||||
runner_run(inst);
|
runner_run(inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,7 +220,7 @@ _config_cmd_activate(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
|
||||||
free(cmd);
|
free(cmd);
|
||||||
e_config_save_queue();
|
e_config_save_queue();
|
||||||
if (!inst) return;
|
if (!inst) return;
|
||||||
if (inst->exe) ecore_exe_quit(inst->exe);
|
if (inst->exe) efl_exe_signal(inst->exe, EFL_EXE_SIGNAL_QUIT);
|
||||||
runner_run(inst);
|
runner_run(inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,8 +423,10 @@ runner_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info E
|
||||||
if (inst->ci)
|
if (inst->ci)
|
||||||
inst->ci->inst = NULL;
|
inst->ci->inst = NULL;
|
||||||
else
|
else
|
||||||
ecore_exe_signal(inst->exe, 2);
|
efl_exe_signal(inst->exe, EFL_EXE_SIGNAL_USR2);
|
||||||
E_FREE_FUNC(inst->exe, ecore_exe_terminate);
|
efl_event_callback_del(inst->exe, EFL_TASK_EVENT_EXIT, runner_exe_del, inst);
|
||||||
|
efl_exe_signal(inst->exe, EFL_EXE_SIGNAL_TERM);
|
||||||
|
inst->exe = NULL;
|
||||||
instances = eina_list_remove(instances, inst);
|
instances = eina_list_remove(instances, inst);
|
||||||
eina_hash_free(inst->allowed_pids);
|
eina_hash_free(inst->allowed_pids);
|
||||||
eina_list_free(inst->tooltip_surfaces);
|
eina_list_free(inst->tooltip_surfaces);
|
||||||
|
@ -499,7 +502,7 @@ gadget_bind(struct wl_client *client, void *data, uint32_t version, uint32_t id)
|
||||||
Evas_Object *site;
|
Evas_Object *site;
|
||||||
|
|
||||||
wl_client_get_credentials(client, &pid, NULL, NULL);
|
wl_client_get_credentials(client, &pid, NULL, NULL);
|
||||||
if (pid != ecore_exe_pid_get(inst->exe))
|
if (pid != efl_exe_pid_get(inst->exe))
|
||||||
{
|
{
|
||||||
wl_client_post_no_memory(client);
|
wl_client_post_no_memory(client);
|
||||||
return;
|
return;
|
||||||
|
@ -524,7 +527,7 @@ ar_bind(struct wl_client *client, void *data, uint32_t version, uint32_t id)
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
|
||||||
wl_client_get_credentials(client, &pid, NULL, NULL);
|
wl_client_get_credentials(client, &pid, NULL, NULL);
|
||||||
if (pid != ecore_exe_pid_get(inst->exe))
|
if (pid != efl_exe_pid_get(inst->exe))
|
||||||
{
|
{
|
||||||
wl_client_post_no_memory(client);
|
wl_client_post_no_memory(client);
|
||||||
return;
|
return;
|
||||||
|
@ -561,7 +564,7 @@ child_added(void *data, Evas_Object *obj, void *event_info)
|
||||||
E_Zone *zone = e_comp_object_util_zone_get(obj);
|
E_Zone *zone = e_comp_object_util_zone_get(obj);
|
||||||
Instance *inst = data;
|
Instance *inst = data;
|
||||||
|
|
||||||
if (!efl_wl_surface_extract(event_info)) return;
|
if (!efl_canvas_wl_surface_extract(event_info)) return;
|
||||||
inst->extracted = eina_list_append(inst->extracted, event_info);
|
inst->extracted = eina_list_append(inst->extracted, event_info);
|
||||||
inst->popup.content = event_info;
|
inst->popup.content = event_info;
|
||||||
|
|
||||||
|
@ -714,7 +717,7 @@ popup_added(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
|
||||||
Instance *inst = data;
|
Instance *inst = data;
|
||||||
Evas_Object *bx;
|
Evas_Object *bx;
|
||||||
|
|
||||||
if (!efl_wl_surface_extract(event_info)) return;
|
if (!efl_canvas_wl_surface_extract(event_info)) return;
|
||||||
inst->extracted = eina_list_append(inst->extracted, event_info);
|
inst->extracted = eina_list_append(inst->extracted, event_info);
|
||||||
if (inst->tooltip_surfaces)
|
if (inst->tooltip_surfaces)
|
||||||
{
|
{
|
||||||
|
@ -722,13 +725,13 @@ popup_added(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
|
||||||
struct wl_resource *surface;
|
struct wl_resource *surface;
|
||||||
|
|
||||||
EINA_LIST_FOREACH(inst->tooltip_surfaces, l, surface)
|
EINA_LIST_FOREACH(inst->tooltip_surfaces, l, surface)
|
||||||
if (event_info == efl_wl_extracted_surface_object_find(surface))
|
if (event_info == efl_canvas_wl_extracted_surface_object_find(surface))
|
||||||
{
|
{
|
||||||
Evas_Object *base = efl_wl_extracted_surface_extracted_parent_get(event_info);
|
Evas_Object *base = efl_canvas_wl_surface_parent_surface_get(event_info);
|
||||||
Tooltip *tt = NULL;
|
Tooltip *tt = NULL;
|
||||||
|
|
||||||
//FIXME: if (inst->tooltip_content) error
|
//FIXME: if (inst->tooltip_content) error
|
||||||
if (base)
|
if (base && efl_canvas_wl_surface_extracted_get(base))
|
||||||
{
|
{
|
||||||
if (base == inst->popup.content)
|
if (base == inst->popup.content)
|
||||||
tt = &inst->popup;
|
tt = &inst->popup;
|
||||||
|
@ -786,8 +789,8 @@ popup_added(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
|
||||||
static void
|
static void
|
||||||
seat_added(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
|
seat_added(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
efl_wl_seat_keymap_set(obj, NULL, e_comp_wl->xkb.state, e_comp_wl->xkb.map_string, &e_comp_wl->kbd.keys);
|
efl_canvas_wl_seat_keymap_set(obj, NULL, e_comp_wl->xkb.state, e_comp_wl->xkb.map_string, &e_comp_wl->kbd.keys);
|
||||||
efl_wl_seat_key_repeat_set(obj, NULL, e_config->keyboard.repeat_rate, e_config->keyboard.repeat_delay);
|
efl_canvas_wl_seat_key_repeat_set(obj, NULL, e_config->keyboard.repeat_rate, e_config->keyboard.repeat_delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -838,7 +841,7 @@ runner_menu(void *data, Evas_Object *obj, void *event_info)
|
||||||
e_object_unref(E_OBJECT(subm));
|
e_object_unref(E_OBJECT(subm));
|
||||||
|
|
||||||
mi = e_menu_item_new(subm);
|
mi = e_menu_item_new(subm);
|
||||||
snprintf(buf, sizeof(buf), "PID: %u", ecore_exe_pid_get(inst->exe));
|
snprintf(buf, sizeof(buf), "PID: %u", efl_exe_pid_get(inst->exe));
|
||||||
e_menu_item_label_set(mi, buf);
|
e_menu_item_label_set(mi, buf);
|
||||||
e_menu_item_disabled_set(mi, 1);
|
e_menu_item_disabled_set(mi, 1);
|
||||||
|
|
||||||
|
@ -872,24 +875,24 @@ gadget_create(Evas_Object *parent, Config_Item *ci, int *id, E_Gadget_Site_Orien
|
||||||
inst->ci = _conf_item_get(id);
|
inst->ci = _conf_item_get(id);
|
||||||
inst->ci->inst = inst;
|
inst->ci->inst = inst;
|
||||||
inst->allowed_pids = eina_hash_int32_new(NULL);
|
inst->allowed_pids = eina_hash_int32_new(NULL);
|
||||||
inst->obj = efl_wl_add(e_comp->evas);
|
inst->obj = efl_add(EFL_CANVAS_WL_CLASS, e_comp->evas);
|
||||||
if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
|
if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
|
||||||
{
|
{
|
||||||
efl_wl_seat_keymap_set(inst->obj, NULL, e_comp_wl->xkb.state, e_comp_wl->xkb.map_string, &e_comp_wl->kbd.keys);
|
efl_canvas_wl_seat_keymap_set(inst->obj, NULL, e_comp_wl->xkb.state, e_comp_wl->xkb.map_string, &e_comp_wl->kbd.keys);
|
||||||
efl_wl_seat_key_repeat_set(inst->obj, NULL, e_config->keyboard.repeat_rate, e_config->keyboard.repeat_delay);
|
efl_canvas_wl_seat_key_repeat_set(inst->obj, NULL, e_config->keyboard.repeat_rate, e_config->keyboard.repeat_delay);
|
||||||
e_comp_wl->efl_wls = eina_list_append(e_comp_wl->efl_wls, inst->obj);
|
e_comp_wl->efl_wls = eina_list_append(e_comp_wl->efl_wls, inst->obj);
|
||||||
}
|
}
|
||||||
E_EXPAND(inst->obj);
|
E_EXPAND(inst->obj);
|
||||||
E_FILL(inst->obj);
|
E_FILL(inst->obj);
|
||||||
efl_wl_aspect_set(inst->obj, 1);
|
efl_canvas_wl_aspect_set(inst->obj, 1);
|
||||||
efl_wl_minmax_set(inst->obj, 1);
|
efl_canvas_wl_minmax_set(inst->obj, 1);
|
||||||
efl_wl_global_add(inst->obj, &e_gadget_interface, 1, inst, gadget_bind);
|
efl_canvas_wl_global_add(inst->obj, &e_gadget_interface, 1, inst, gadget_bind);
|
||||||
evas_object_smart_callback_add(inst->obj, "child_added", child_added, inst);
|
evas_object_smart_callback_add(inst->obj, "child_added", child_added, inst);
|
||||||
evas_object_smart_callback_add(inst->obj, "popup_added", popup_added, inst);
|
evas_object_smart_callback_add(inst->obj, "popup_added", popup_added, inst);
|
||||||
if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
|
if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
|
||||||
evas_object_smart_callback_add(inst->obj, "seat_added", seat_added, inst);
|
evas_object_smart_callback_add(inst->obj, "seat_added", seat_added, inst);
|
||||||
e_comp_wl_extension_action_route_interface_get(&ar_version);
|
e_comp_wl_extension_action_route_interface_get(&ar_version);
|
||||||
efl_wl_global_add(inst->obj, &action_route_interface, ar_version, inst, ar_bind);
|
efl_canvas_wl_global_add(inst->obj, &action_route_interface, ar_version, inst, ar_bind);
|
||||||
evas_object_event_callback_add(inst->obj, EVAS_CALLBACK_MOUSE_DOWN, mouse_down, inst);
|
evas_object_event_callback_add(inst->obj, EVAS_CALLBACK_MOUSE_DOWN, mouse_down, inst);
|
||||||
evas_object_smart_callback_add(parent, "gadget_created", runner_created, inst);
|
evas_object_smart_callback_add(parent, "gadget_created", runner_created, inst);
|
||||||
evas_object_smart_callback_add(parent, "gadget_removed", runner_removed, inst);
|
evas_object_smart_callback_add(parent, "gadget_removed", runner_removed, inst);
|
||||||
|
@ -923,17 +926,17 @@ runner_create(Evas_Object *parent, int *id, E_Gadget_Site_Orient orient)
|
||||||
return gadget_create(parent, ci, id, orient);
|
return gadget_create(parent, ci, id, orient);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static void
|
||||||
runner_exe_del(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Exe_Event_Del *ev)
|
runner_exe_del(void *data, const Efl_Event *ev)
|
||||||
{
|
{
|
||||||
Instance *inst = ecore_exe_data_get(ev->exe);
|
Instance *inst = data;
|
||||||
|
|
||||||
if ((!inst) || (!instances) || (!eina_list_data_find(instances, inst))) return ECORE_CALLBACK_RENEW;
|
if ((!instances) || (!eina_list_data_find(instances, inst))) return;
|
||||||
switch (inst->ci->exit_mode)
|
switch (inst->ci->exit_mode)
|
||||||
{
|
{
|
||||||
case EXIT_MODE_RESTART:
|
case EXIT_MODE_RESTART:
|
||||||
/* FIXME: probably notify? */
|
/* FIXME: probably notify? */
|
||||||
if (ev->exit_code == 255) //exec error
|
if (efl_task_exit_code_get(ev->object) == 255) //exec error
|
||||||
e_gadget_del(inst->box);
|
e_gadget_del(inst->box);
|
||||||
else
|
else
|
||||||
runner_run(inst);
|
runner_run(inst);
|
||||||
|
@ -942,7 +945,6 @@ runner_exe_del(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Exe_Event_Del *ev)
|
||||||
e_gadget_del(inst->box);
|
e_gadget_del(inst->box);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return ECORE_CALLBACK_RENEW;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////
|
///////////////////////////////
|
||||||
|
@ -1211,7 +1213,6 @@ e_gadget_runner_init(void)
|
||||||
gadget_monitor = eio_monitor_add(buf);
|
gadget_monitor = eio_monitor_add(buf);
|
||||||
gadget_lister = eio_file_direct_ls(buf, list_filter_cb, list_main_cb, list_done_cb, list_error_cb, NULL);
|
gadget_lister = eio_file_direct_ls(buf, list_filter_cb, list_main_cb, list_done_cb, list_error_cb, NULL);
|
||||||
}
|
}
|
||||||
E_LIST_HANDLER_APPEND(handlers, ECORE_EXE_EVENT_DEL, runner_exe_del, NULL);
|
|
||||||
E_LIST_HANDLER_APPEND(handlers, EIO_MONITOR_DIRECTORY_CREATED, monitor_dir_create, NULL);
|
E_LIST_HANDLER_APPEND(handlers, EIO_MONITOR_DIRECTORY_CREATED, monitor_dir_create, NULL);
|
||||||
E_LIST_HANDLER_APPEND(handlers, EIO_MONITOR_DIRECTORY_DELETED, monitor_dir_del, NULL);
|
E_LIST_HANDLER_APPEND(handlers, EIO_MONITOR_DIRECTORY_DELETED, monitor_dir_del, NULL);
|
||||||
E_LIST_HANDLER_APPEND(handlers, EIO_MONITOR_ERROR, monitor_error, NULL);
|
E_LIST_HANDLER_APPEND(handlers, EIO_MONITOR_ERROR, monitor_error, NULL);
|
||||||
|
|
Loading…
Reference in New Issue