return EINA_FALSE;
}
+ if (!ec || e_object_is_del(E_OBJECT(ec)) || !ec->comp_data) return EINA_FALSE;
+
+ if (!epc || e_object_is_del(E_OBJECT(epc)))
+ {
+ if (ec->comp_data->sub.watcher)
+ tizen_subsurface_watcher_send_message(ec->comp_data->sub.watcher, TIZEN_SUBSURFACE_WATCHER_MSG_PARENT_ID_INVALID);
+
+ /* We have to create a subsurface resource here even though it's error case
+ * because server will send the fatal error when a client destroy a subsurface object.
+ * Otherwise, server will kill a client by the fatal error.
+ */
+ res = wl_resource_create(client, &wl_subsurface_interface, 1, id);
+ wl_resource_set_implementation(res, &_e_subsurface_interface, NULL, NULL);
+
+ ERR("tizen_policy failed: invalid parent");
+ return EINA_FALSE;
+ }
+
// reparent remote surface provider's subsurfaces
if (epc->comp_data->remote_surface.onscreen_parent)
{
return EINA_FALSE;
}
+static void
+_e_comp_wl_surface_sub_list_free(Eina_List *sub_list)
+{
+ E_Client *subc;
+
+ EINA_LIST_FREE(sub_list, subc)
+ {
+ if (!subc->comp_data || !subc->comp_data->sub.data) continue;
+
+ subc->comp_data->sub.data->parent = NULL;
+
+ if (subc->comp_data->sub.watcher)
+ tizen_subsurface_watcher_send_message(subc->comp_data->sub.watcher, TIZEN_SUBSURFACE_WATCHER_MSG_PARENT_ID_DESTROYED);
+ }
+}
+
static void
_e_comp_wl_subcompositor_cb_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *resource)
{
{
/* Eina_Rectangle *dmg; */
struct wl_resource *cb;
- E_Client *subc;
/* make sure this is a wayland client */
if (e_pixmap_type_get(ec->pixmap) != E_PIXMAP_TYPE_WL) return;
/* remove sub list */
/* TODO: if parent is set by onscreen_parent of remote surface? */
- EINA_LIST_FREE(ec->comp_data->sub.list, subc)
- if (subc->comp_data && subc->comp_data->sub.data) subc->comp_data->sub.data->parent = NULL;
- EINA_LIST_FREE(ec->comp_data->sub.list_pending, subc)
- if (subc->comp_data && subc->comp_data->sub.data) subc->comp_data->sub.data->parent = NULL;
- EINA_LIST_FREE(ec->comp_data->sub.below_list, subc)
- if (subc->comp_data && subc->comp_data->sub.data) subc->comp_data->sub.data->parent = NULL;
- EINA_LIST_FREE(ec->comp_data->sub.below_list_pending, subc)
- if (subc->comp_data && subc->comp_data->sub.data) subc->comp_data->sub.data->parent = NULL;
+ _e_comp_wl_surface_sub_list_free(ec->comp_data->sub.list);
+ _e_comp_wl_surface_sub_list_free(ec->comp_data->sub.list_pending);
+ _e_comp_wl_surface_sub_list_free(ec->comp_data->sub.below_list);
+ _e_comp_wl_surface_sub_list_free(ec->comp_data->sub.below_list_pending);
+
+ if (ec->comp_data->sub.watcher)
+ wl_resource_destroy(ec->comp_data->sub.watcher);
if ((ec->parent) && (ec->parent->modal == ec))
{
Evas_Object *below_obj;
Eina_Bool restacking : 1;
+
+ struct wl_resource *watcher;
} sub;
/* regular surface resource (wl_compositor_create_surface) */
if (e_object_is_del(E_OBJECT(ec))) return;
- epc = e_pixmap_find_client_by_res_id(parent_id);
- if (!epc)
- {
- ERR("tizen_policy failed: wrong parent_id(%d)", parent_id);
- return;
- }
-
- if (e_object_is_del(E_OBJECT(epc))) return;
-
/* check if this surface is already a sub-surface */
if ((ec->comp_data) && (ec->comp_data->sub.data))
{
return;
}
+ epc = e_pixmap_find_client_by_res_id(parent_id);
+
/* try to create a new subsurface */
if (!e_comp_wl_subsurface_create(ec, epc, id, surface))
- ERR("Failed to create subsurface for surface@%d",
- wl_resource_get_id(surface));
+ {
+ ERR("Failed to create subsurface for surface@%d", wl_resource_get_id(surface));
+ return;
+ }
/* ec's parent comes from another process */
if (ec->comp_data)
(res_tz_dpy_pol, surf, brightness, TIZEN_DISPLAY_POLICY_ERROR_STATE_NONE);
}
+static void
+_tzpol_iface_cb_subsurf_watcher_destroy(struct wl_resource *resource)
+{
+ E_Client *ec;
+
+ if (!(ec = wl_resource_get_user_data(resource))) return;
+ if (e_object_is_del(E_OBJECT(ec)) || !ec->comp_data) return;
+
+ ec->comp_data->sub.watcher = NULL;
+}
+
+static void
+_tzpol_iface_cb_subsurf_watcher_get(struct wl_client *client, struct wl_resource *res_tzpol, uint32_t id, struct wl_resource *surface)
+{
+ E_Client *ec;
+ struct wl_resource *res;
+
+ if (!(ec = wl_resource_get_user_data(surface))) return;
+ if (e_object_is_del(E_OBJECT(ec))) return;
+
+ if (!(res = wl_resource_create(client, &tizen_subsurface_watcher_interface, 1, id)))
+ {
+ wl_resource_post_no_memory(res_tzpol);
+ return;
+ }
+
+ ec->comp_data->sub.watcher = res;
+
+ wl_resource_set_implementation(res, NULL, ec, _tzpol_iface_cb_subsurf_watcher_destroy);
+}
+
// --------------------------------------------------------
// tizen_policy_interface
// --------------------------------------------------------
_tzpol_iface_cb_floating_mode_unset,
_tzpol_iface_cb_stack_mode_set,
_tzpol_iface_cb_activate_above_by_res_id,
+ _tzpol_iface_cb_subsurf_watcher_get,
};
static void
/* create globals */
global = wl_global_create(e_comp_wl->wl.disp,
&tizen_policy_interface,
- 1,
+ 2,
NULL,
_tzpol_cb_bind);
EINA_SAFETY_ON_NULL_GOTO(global, err);