EINTERN void
e_shell_e_client_parent_set(E_Client *ec, struct wl_resource *parent_resource)
{
- E_Client *pc, *child;
- Ecore_Window pwin = 0;
- Eina_List *dup_transients = NULL;
+ E_Client *parent = NULL;
EINA_SAFETY_ON_NULL_RETURN(ec);
- ELOGF("SHELL", "Parent Set. parent_ec:%p, child_ec:%p, prev_parent_ec: %p",
- ec, parent_resource? wl_resource_get_user_data(parent_resource) : NULL, ec, ec->parent);
-
- if (!parent_resource)
- {
- ec->icccm.fetch.transient_for = EINA_FALSE;
- ec->icccm.transient_for = 0;
- if (ec->parent)
- {
- ec->parent->transients =
- eina_list_remove(ec->parent->transients, ec);
- if (ec->parent->modal == ec) ec->parent->modal = NULL;
- ec->parent = NULL;
- }
- return;
- }
-
- pc = wl_resource_get_user_data(parent_resource);
- if (!pc)
- {
- ERR("Could not get parent resource client");
- return;
- }
-
- pwin = e_pixmap_window_get(pc->pixmap);
-
- e_pixmap_parent_window_set(ec->pixmap, pwin);
-
- /* If we already have a parent, remove it */
- if (ec->parent)
- {
- if (pc != ec->parent)
- {
- ec->parent->transients =
- eina_list_remove(ec->parent->transients, ec);
- if (ec->parent->modal == ec) ec->parent->modal = NULL;
- ec->parent = NULL;
- }
- }
-
- if ((pc != ec) &&
- (eina_list_data_find(pc->transients, ec) != ec))
- {
- pc->transients = eina_list_append(pc->transients, ec);
- ec->parent = pc;
- }
+ if (parent_resource)
+ parent = wl_resource_get_user_data(parent_resource);
- dup_transients = eina_list_clone(pc->transients);
- EINA_LIST_FREE(dup_transients, child)
- {
- if (child->transient_for_always_on_top)
- {
- pc->transients = eina_list_remove(pc->transients, child);
- pc->transients = eina_list_append(pc->transients, child);
- }
- }
+ ELOGF("SHELL", "Parent Set. parent_resource:%p, parent_ec:%p, prev_parent_ec:%p",
+ ec, parent_resource, parent, ec->parent);
- ec->icccm.fetch.transient_for = EINA_TRUE;
- ec->icccm.transient_for = pwin;
+ e_policy_stack_parent_set(ec, parent);
}
EINTERN Eina_Bool
// transient for
// --------------------------------------------------------
static void
-_e_policy_wl_parent_surf_set(E_Client *ec, struct wl_resource *parent_surf)
-{
- E_Client *pc = NULL;
-
- if (parent_surf)
- {
- if (!(pc = wl_resource_get_user_data(parent_surf)))
- {
- ERR("Could not get parent res e_client");
- return;
- }
- }
-
- e_policy_stack_transient_for_set(ec, pc);
-}
-
-static void
_tzpol_iface_cb_transient_for_set(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol, uint32_t child_id, uint32_t parent_id)
{
- E_Client *ec, *pc;
- E_Comp_Wl_Client_Data *cdata, *pc_cdata;
- struct wl_resource *parent_surf;
+ E_Client *ec, *parent_ec;
+ E_Comp_Wl_Client_Data *cdata, *p_cdata;
ELOGF("TZPOL",
- "TF_SET |res_tzpol:%8p|parent:%d|child:%d",
+ "TF_SET |res_tzpol:%8p|parent_id:%8d |child_id:8%d",
NULL, res_tzpol, parent_id, child_id);
ec = e_pixmap_find_client_by_res_id(child_id);
EINA_SAFETY_ON_NULL_RETURN(ec);
cdata = e_client_cdata_get(ec);
- pc = e_pixmap_find_client_by_res_id(parent_id);
- EINA_SAFETY_ON_NULL_RETURN(pc);
- pc_cdata = e_client_cdata_get(pc);
- EINA_SAFETY_ON_NULL_RETURN(pc_cdata);
-
- parent_surf = pc_cdata->surface;
-
- _e_policy_wl_parent_surf_set(ec, parent_surf);
+ parent_ec = e_pixmap_find_client_by_res_id(parent_id);
+ EINA_SAFETY_ON_NULL_RETURN(parent_ec);
+ p_cdata = e_client_cdata_get(parent_ec);
ELOGF("TZPOL",
- " |win:0x%08zx|parent|s:%8p",
- pc,
- e_client_util_win_get(pc),
- parent_surf);
-
- ELOGF("TZPOL",
- " |win:0x%08zx|child |s:%8p",
- ec,
- e_client_util_win_get(ec),
- (cdata ? cdata->surface : NULL));
+ " |res_tzpol:%8p|parent_surf:%8p|child_surf:%8p",
+ NULL, res_tzpol, (p_cdata ? p_cdata->surface : NULL), (cdata ? cdata->surface : NULL));
+ e_policy_stack_transient_for_set(ec, parent_ec);
tizen_policy_send_transient_for_done(res_tzpol, child_id);
-
- EC_CHANGED(ec);
}
static void
ec = e_pixmap_find_client_by_res_id(child_id);
EINA_SAFETY_ON_NULL_RETURN(ec);
- _e_policy_wl_parent_surf_set(ec, NULL);
-
+ e_policy_stack_transient_for_set(ec, NULL);
tizen_policy_send_transient_for_done(res_tzpol, child_id);
-
- EC_CHANGED(ec);
}
// --------------------------------------------------------
static void
_tzpol_iface_cb_parent_set(struct wl_client *client, struct wl_resource *res_tzpol, struct wl_resource *child, struct wl_resource *parent)
{
- E_Client *ec, *pc;
- E_Comp_Wl_Client_Data *cdata, *pc_cdata;
- struct wl_resource *parent_surf;
+ E_Client *ec, *parent_ec;
ELOGF("TZPOL",
- "PARENT_SET |res_tzpol:%8p|parent:%8p|child:%8p",
+ "PARENT_SET |res_tzpol:%8p|parent_surf:%8p|child_surf:%8p",
NULL, res_tzpol, parent, child);
ec = wl_resource_get_user_data(child);
EINA_SAFETY_ON_NULL_RETURN(ec);
- pc = wl_resource_get_user_data(parent);
- if (!pc)
- {
- _e_policy_wl_parent_surf_set(ec, NULL);
- }
- else
- {
- pc_cdata = e_client_cdata_get(pc);
- EINA_SAFETY_ON_NULL_RETURN(pc_cdata);
-
- parent_surf = pc_cdata->surface;
- _e_policy_wl_parent_surf_set(ec, parent_surf);
-
- ELOGF("TZPOL",
- " |win:0x%08zx|parent|s:%8p",
- pc,
- e_client_util_win_get(pc),
- parent_surf);
-
- cdata = e_client_cdata_get(ec);
- ELOGF("TZPOL",
- " |win:0x%08zx|child |s:%8p",
- ec,
- e_client_util_win_get(ec),
- (cdata ? cdata->surface : NULL));
- }
-
- EC_CHANGED(ec);
+ parent_ec = wl_resource_get_user_data(parent);
+ e_policy_stack_parent_set(ec, parent_ec);
}
static void