_e_comp_wl_send_touch_cancel(ec);
}
-static void
-_e_comp_wl_evas_cb_restack(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
-{
- E_Client *ec = (E_Client *)data;
-
- if ((!ec) || (!ec->comp_data)) return;
- if (e_object_is_del(E_OBJECT(ec))) return;
- if (ec->comp_data->sub.restacking) return;
-
- e_comp_wl_subsurface_stack_update(ec);
-}
-
static E_Devicemgr_Input_Device *
_e_comp_wl_device_last_device_get(Ecore_Device_Class dev_class)
{
if (!ec || !ec->comp_data) return;
if (ec->comp_data->evas_init) return;
- /* Workaround:
- * Updating stack order of subsurface has to be done for safety, because
- * stack order can be abnormal before registering a callback function.
- * If a callback function of EVAS_CALLBACK_RESTACK is called immediately
- * in some way, stack order will become normal, otherwise it will remain
- * abnormal until callback function is called.
- *
- * Note that stacking subsurface object can be improved by taking advantage
- * of evas smart member object mechanism. */
- e_comp_wl_subsurface_stack_update(ec);
-
evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_SHOW, _e_comp_wl_evas_cb_show, ec);
evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_HIDE, _e_comp_wl_evas_cb_hide, ec);
evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_MOVE, _e_comp_wl_evas_cb_move, ec);
- evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_RESTACK, _e_comp_wl_evas_cb_restack, ec);
evas_object_event_callback_priority_add(ec->frame, EVAS_CALLBACK_MOUSE_IN, EVAS_CALLBACK_PRIORITY_AFTER, _e_comp_wl_evas_cb_mouse_in, ec);
static struct wl_global *global = NULL;
static Eina_List *hooks = NULL;
+static Eina_List *handlers = NULL;
static E_Comp_Wl_Subsurf_Data *_e_comp_wl_subsurface_data_get(E_Client *ec);
static void _e_comp_wl_subsurface_child_remove(E_Comp_Wl_Client_Data *parent_cdata, E_Client *child);
static void _e_comp_wl_subsurface_place_above(E_Client *parent, E_Client *subc, E_Client *above);
static void _e_comp_wl_subsurface_place_below(E_Client *parent, E_Client *subc, E_Client *below);
+static void _e_comp_wl_subsurface_stack_update(E_Client *ec);
static void
_e_comp_wl_subsurface_restack_bg_rectangle(E_Client *ec)
return EINA_FALSE;
}
+static void
+_e_comp_wl_subsurface_cb_comp_object_restack(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ E_Client *ec;
+
+ ec = data;
+ if ((!ec) || (!ec->comp_data))
+ return;
+
+ if (e_object_is_del(E_OBJECT(ec)))
+ return;
+
+ if (ec->comp_data->sub.restacking)
+ return;
+
+ _e_comp_wl_subsurface_stack_update(ec);
+}
+
+static Eina_Bool
+_e_comp_wl_subsurface_cb_comp_object_add(void *data EINA_UNUSED, int type EINA_UNUSED, E_Event_Comp_Object *ev)
+{
+ E_Client *ec;
+
+ ec = e_comp_object_client_get(ev->comp_object);
+ if (!ec)
+ goto end;
+
+ if (e_object_is_del(E_OBJECT(ec)))
+ goto end;
+
+ /* Workaround:
+ * Updating stack order of subsurface has to be done for safety, because
+ * stack order can be abnormal before registering a callback function.
+ * If a callback function of EVAS_CALLBACK_RESTACK is called immediately
+ * in some way, stack order will become normal, otherwise it will remain
+ * abnormal until callback function is called.
+ *
+ * Note that stacking subsurface object can be improved by taking advantage
+ * of evas smart member object mechanism. */
+ _e_comp_wl_subsurface_stack_update(ec);
+
+ evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_RESTACK, _e_comp_wl_subsurface_cb_comp_object_restack, ec);
+
+end:
+ return ECORE_CALLBACK_RENEW;
+}
+
EINTERN Eina_Bool
e_comp_wl_subsurfaces_init(E_Comp_Wl_Data *wl_comp)
{
E_LIST_HOOK_APPEND(hooks, E_CLIENT_HOOK_ICONIFY, _e_comp_wl_subsurface_cb_ec_iconify, NULL);
E_LIST_HOOK_APPEND(hooks, E_CLIENT_HOOK_UNICONIFY, _e_comp_wl_subsurface_cb_ec_uniconify, NULL);
+ E_LIST_HANDLER_APPEND(handlers, E_EVENT_COMP_OBJECT_ADD, _e_comp_wl_subsurface_cb_comp_object_add, NULL);
+
return EINA_TRUE;
}
{
E_FREE_FUNC(global, wl_global_destroy);
E_FREE_LIST(hooks, e_client_hook_del);
+ E_FREE_LIST(handlers, ecore_event_handler_del);
}
E_API Eina_Bool
E_API void
e_comp_wl_subsurface_stack_update(E_Client *ec)
{
- E_Client *topmost;
-
EINA_SAFETY_ON_NULL_RETURN(ec);
- if (!ec->comp_data) return;
- if (e_object_is_del(E_OBJECT(ec))) return;
- if (ec->comp_data->sub.restacking) return;
-
- /* return if ec isn't both a parent of a subsurface and a subsurface itself */
- if (!ec->comp_data->sub.list && !ec->comp_data->sub.below_list && !ec->comp_data->sub.data)
- {
- if (ec->comp_data->sub.below_obj)
- _e_comp_wl_subsurface_restack_bg_rectangle(ec);
- return;
- }
-
- topmost = e_comp_wl_topmost_parent_get(ec);
-
- _e_comp_wl_subsurface_restack(topmost);
- _e_comp_wl_subsurface_restack_bg_rectangle(topmost);
-
- //To update client stack list
- if ((ec->comp_data->sub.data) &&
- (ec->comp_data->sub.data->parent))
- {
- E_Client *parent;
- Evas_Object *o;
-
- parent = ec->comp_data->sub.data->parent;
-
- if ((parent->comp_data->sub.list) &&
- (eina_list_data_find(parent->comp_data->sub.list, ec)))
- {
- //stack above done
- o = evas_object_below_get(ec->frame);
- e_comp_object_layer_update(ec->frame, o, NULL);
- }
- else if ((parent->comp_data->sub.below_list) &&
- (eina_list_data_find(parent->comp_data->sub.below_list, ec)))
- {
- //stack below done
- o = evas_object_above_get(ec->frame);
- e_comp_object_layer_update(ec->frame, NULL, o);
- }
- }
+ _e_comp_wl_subsurface_stack_update(ec);
}
EINTERN Eina_Bool
pc->sub.list_changed = EINA_TRUE;
}
+
+static void
+_e_comp_wl_subsurface_stack_update(E_Client *ec)
+{
+ E_Client *topmost;
+
+ if (!ec->comp_data) return;
+ if (e_object_is_del(E_OBJECT(ec))) return;
+ if (ec->comp_data->sub.restacking) return;
+
+ /* return if ec isn't both a parent of a subsurface and a subsurface itself */
+ if (!ec->comp_data->sub.list && !ec->comp_data->sub.below_list && !ec->comp_data->sub.data)
+ {
+ if (ec->comp_data->sub.below_obj)
+ _e_comp_wl_subsurface_restack_bg_rectangle(ec);
+ return;
+ }
+
+ topmost = e_comp_wl_topmost_parent_get(ec);
+
+ _e_comp_wl_subsurface_restack(topmost);
+ _e_comp_wl_subsurface_restack_bg_rectangle(topmost);
+
+ //To update client stack list
+ if ((ec->comp_data->sub.data) &&
+ (ec->comp_data->sub.data->parent))
+ {
+ E_Client *parent;
+ Evas_Object *o;
+
+ parent = ec->comp_data->sub.data->parent;
+
+ if ((parent->comp_data->sub.list) &&
+ (eina_list_data_find(parent->comp_data->sub.list, ec)))
+ {
+ //stack above done
+ o = evas_object_below_get(ec->frame);
+ e_comp_object_layer_update(ec->frame, o, NULL);
+ }
+ else if ((parent->comp_data->sub.below_list) &&
+ (eina_list_data_find(parent->comp_data->sub.below_list, ec)))
+ {
+ //stack below done
+ o = evas_object_above_get(ec->frame);
+ e_comp_object_layer_update(ec->frame, NULL, o);
+ }
+ }
+}