forked from enlightenment/efl
evas: Move clip_unset to legacy, remove group_clip
Similarly to group_color_set, group_clip_[un]set should not exist and should be a result of efl_super and inheritance. This patch also removes clip_unset from the EO API and keeps only clip_set(NULL). The reason is that it will avoid bad overrides of clip_unset() vs. clip_unset(NULL). This also simplifies the code a bit. Ideally we should be able to reintroduce clip_unset in EO if we can have a "@final" tag (like java's final keyword), to prevent overrides.
This commit is contained in:
parent
c60cc50f5a
commit
62abe2cbff
|
@ -129,7 +129,7 @@ _on_keydown(void *data EINA_UNUSED,
|
||||||
clip = efl_canvas_object_clip_get(d.img);
|
clip = efl_canvas_object_clip_get(d.img);
|
||||||
if (clip == d.clipper)
|
if (clip == d.clipper)
|
||||||
{
|
{
|
||||||
efl_canvas_object_clip_unset(d.img);
|
efl_canvas_object_clip_set(d.img, NULL);
|
||||||
fprintf(stdout, "off\n");
|
fprintf(stdout, "off\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -634,23 +634,17 @@ _efl_ui_image_efl_gfx_color_set(Eo *obj, Efl_Ui_Image_Data *sd, int r, int g, in
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_efl_ui_image_efl_canvas_group_group_clip_set(Eo *obj, Efl_Ui_Image_Data *sd, Evas_Object *clip)
|
_efl_ui_image_efl_canvas_object_clip_set(Eo *obj, Efl_Ui_Image_Data *sd, Evas_Object *clip)
|
||||||
{
|
{
|
||||||
efl_canvas_group_clip_set(efl_super(obj, MY_CLASS), clip);
|
if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_CLIP_SET, 0, clip))
|
||||||
|
return;
|
||||||
|
|
||||||
|
efl_canvas_object_clip_set(efl_super(obj, MY_CLASS), clip);
|
||||||
|
|
||||||
evas_object_clip_set(sd->img, clip);
|
evas_object_clip_set(sd->img, clip);
|
||||||
if (sd->prev_img) evas_object_clip_set(sd->prev_img, clip);
|
if (sd->prev_img) evas_object_clip_set(sd->prev_img, clip);
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
|
||||||
_efl_ui_image_efl_canvas_group_group_clip_unset(Eo *obj, Efl_Ui_Image_Data *sd)
|
|
||||||
{
|
|
||||||
efl_canvas_group_clip_unset(efl_super(obj, MY_CLASS));
|
|
||||||
|
|
||||||
evas_object_clip_unset(sd->img);
|
|
||||||
if (sd->prev_img) evas_object_clip_unset(sd->prev_img);
|
|
||||||
}
|
|
||||||
|
|
||||||
EOLIAN static Elm_Theme_Apply
|
EOLIAN static Elm_Theme_Apply
|
||||||
_efl_ui_image_elm_widget_theme_apply(Eo *obj, Efl_Ui_Image_Data *sd EINA_UNUSED)
|
_efl_ui_image_elm_widget_theme_apply(Eo *obj, Efl_Ui_Image_Data *sd EINA_UNUSED)
|
||||||
{
|
{
|
||||||
|
|
|
@ -140,9 +140,8 @@ class Efl.Ui.Image (Elm.Widget, Efl.Ui.Clickable, Efl.Ui.Draggable,
|
||||||
Edje.Object.size_max.get;
|
Edje.Object.size_max.get;
|
||||||
Edje.Object.size_min_calc;
|
Edje.Object.size_min_calc;
|
||||||
Edje.Object.calc_force;
|
Edje.Object.calc_force;
|
||||||
|
Efl.Canvas.Object.clip.set;
|
||||||
Efl.Canvas.Group.group_hide;
|
Efl.Canvas.Group.group_hide;
|
||||||
Efl.Canvas.Group.group_clip.set;
|
|
||||||
Efl.Canvas.Group.group_clip_unset;
|
|
||||||
Efl.Canvas.Group.group_show;
|
Efl.Canvas.Group.group_show;
|
||||||
Efl.Canvas.Group.group_move;
|
Efl.Canvas.Group.group_move;
|
||||||
Efl.Canvas.Group.group_add;
|
Efl.Canvas.Group.group_add;
|
||||||
|
|
|
@ -599,11 +599,16 @@ _elm_widget_efl_canvas_object_no_render_set(Eo *obj, Elm_Widget_Smart_Data *_pd
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_elm_widget_efl_canvas_group_group_clip_set(Eo *obj, Elm_Widget_Smart_Data *_pd EINA_UNUSED, Evas_Object *clip)
|
_elm_widget_efl_canvas_object_clip_set(Eo *obj, Elm_Widget_Smart_Data *_pd EINA_UNUSED, Evas_Object *clip)
|
||||||
{
|
{
|
||||||
Eina_Iterator *it;
|
Eina_Iterator *it;
|
||||||
Evas_Object *o;
|
Evas_Object *o;
|
||||||
|
|
||||||
|
if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_CLIP_SET, 0, clip))
|
||||||
|
return;
|
||||||
|
|
||||||
|
efl_canvas_object_clip_set(efl_super(obj, MY_CLASS), clip);
|
||||||
|
|
||||||
it = evas_object_smart_iterator_new(obj);
|
it = evas_object_smart_iterator_new(obj);
|
||||||
EINA_ITERATOR_FOREACH(it, o)
|
EINA_ITERATOR_FOREACH(it, o)
|
||||||
{
|
{
|
||||||
|
@ -613,21 +618,6 @@ _elm_widget_efl_canvas_group_group_clip_set(Eo *obj, Elm_Widget_Smart_Data *_pd
|
||||||
eina_iterator_free(it);
|
eina_iterator_free(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
|
||||||
_elm_widget_efl_canvas_group_group_clip_unset(Eo *obj, Elm_Widget_Smart_Data *_pd EINA_UNUSED)
|
|
||||||
{
|
|
||||||
Eina_Iterator *it;
|
|
||||||
Evas_Object *o;
|
|
||||||
|
|
||||||
it = evas_object_smart_iterator_new(obj);
|
|
||||||
EINA_ITERATOR_FOREACH(it, o)
|
|
||||||
{
|
|
||||||
if (evas_object_data_get(o, "_elm_leaveme")) continue;
|
|
||||||
evas_object_clip_unset(o);
|
|
||||||
}
|
|
||||||
eina_iterator_free(it);
|
|
||||||
}
|
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_elm_widget_efl_canvas_group_group_calculate(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *_pd EINA_UNUSED)
|
_elm_widget_efl_canvas_group_group_calculate(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *_pd EINA_UNUSED)
|
||||||
{
|
{
|
||||||
|
|
|
@ -848,16 +848,15 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible, Elm.Inter
|
||||||
Efl.Object.dbg_info_get;
|
Efl.Object.dbg_info_get;
|
||||||
Efl.Object.provider_find;
|
Efl.Object.provider_find;
|
||||||
Efl.Gfx.color.set;
|
Efl.Gfx.color.set;
|
||||||
|
Efl.Canvas.Object.clip.set;
|
||||||
Efl.Canvas.Object.no_render.set;
|
Efl.Canvas.Object.no_render.set;
|
||||||
Efl.Canvas.Group.group_hide;
|
Efl.Canvas.Group.group_hide;
|
||||||
Efl.Canvas.Group.group_calculate;
|
Efl.Canvas.Group.group_calculate;
|
||||||
Efl.Canvas.Group.group_clip_unset;
|
|
||||||
Efl.Canvas.Group.group_show;
|
Efl.Canvas.Group.group_show;
|
||||||
Efl.Canvas.Group.group_move;
|
Efl.Canvas.Group.group_move;
|
||||||
Efl.Canvas.Group.group_member_del;
|
Efl.Canvas.Group.group_member_del;
|
||||||
Efl.Canvas.Group.group_add;
|
Efl.Canvas.Group.group_add;
|
||||||
Efl.Canvas.Group.group_del;
|
Efl.Canvas.Group.group_del;
|
||||||
Efl.Canvas.Group.group_clip.set;
|
|
||||||
Efl.Canvas.Group.group_member_add;
|
Efl.Canvas.Group.group_member_add;
|
||||||
Efl.Canvas.Group.group_resize;
|
Efl.Canvas.Group.group_resize;
|
||||||
Elm.Interface.Atspi_Accessible.name.get;
|
Elm.Interface.Atspi_Accessible.name.get;
|
||||||
|
|
|
@ -52,14 +52,13 @@ class Efl.Canvas.Video (Efl.Canvas.Group, Efl.File, Efl.Player, Efl.Image, Efl.I
|
||||||
implements {
|
implements {
|
||||||
Efl.Object.constructor;
|
Efl.Object.constructor;
|
||||||
Efl.Gfx.color.set;
|
Efl.Gfx.color.set;
|
||||||
|
Efl.Canvas.Object.clip.set;
|
||||||
Efl.Canvas.Group.group_add;
|
Efl.Canvas.Group.group_add;
|
||||||
Efl.Canvas.Group.group_del;
|
Efl.Canvas.Group.group_del;
|
||||||
Efl.Canvas.Group.group_move;
|
Efl.Canvas.Group.group_move;
|
||||||
Efl.Canvas.Group.group_resize;
|
Efl.Canvas.Group.group_resize;
|
||||||
Efl.Canvas.Group.group_show;
|
Efl.Canvas.Group.group_show;
|
||||||
Efl.Canvas.Group.group_hide;
|
Efl.Canvas.Group.group_hide;
|
||||||
Efl.Canvas.Group.group_clip.set;
|
|
||||||
Efl.Canvas.Group.group_clip_unset;
|
|
||||||
Efl.File.file.set;
|
Efl.File.file.set;
|
||||||
Efl.File.file.get;
|
Efl.File.file.get;
|
||||||
Efl.Player.play.set;
|
Efl.Player.play.set;
|
||||||
|
|
|
@ -1977,20 +1977,14 @@ _efl_canvas_video_efl_gfx_color_set(Evas_Object *obj, Efl_Canvas_Video_Data *sd,
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_efl_canvas_video_efl_canvas_group_group_clip_set(Evas_Object *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd, Evas_Object * clip)
|
_efl_canvas_video_efl_canvas_object_clip_set(Evas_Object *obj, Efl_Canvas_Video_Data *sd, Evas_Object *clip)
|
||||||
{
|
{
|
||||||
|
if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_CLIP_SET, 0, clip))
|
||||||
|
return;
|
||||||
|
|
||||||
if (sd->crop.clipper) evas_object_clip_set(sd->crop.clipper, clip);
|
if (sd->crop.clipper) evas_object_clip_set(sd->crop.clipper, clip);
|
||||||
else evas_object_clip_set(sd->obj, clip);
|
else evas_object_clip_set(sd->obj, clip);
|
||||||
evas_object_clip_set(sd->bg, clip);
|
evas_object_clip_set(sd->bg, clip);
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
|
||||||
_efl_canvas_video_efl_canvas_group_group_clip_unset(Evas_Object *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd)
|
|
||||||
{
|
|
||||||
if (sd->crop.clipper) evas_object_clip_unset(sd->crop.clipper);
|
|
||||||
else evas_object_clip_unset(sd->obj);
|
|
||||||
evas_object_clip_unset(sd->bg);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "efl_canvas_video.eo.c"
|
#include "efl_canvas_video.eo.c"
|
||||||
|
|
|
@ -1011,6 +1011,21 @@ EAPI void evas_object_size_hint_request_get(const Evas_Object *obj, Evas_Coord *
|
||||||
*/
|
*/
|
||||||
EAPI void evas_object_size_hint_min_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
|
EAPI void evas_object_size_hint_min_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Disable/cease clipping on a clipped @c obj object.
|
||||||
|
*
|
||||||
|
* This function disables clipping for the object @c obj, if it was already
|
||||||
|
* clipped, i.e., its visibility and color get detached from the previous
|
||||||
|
* clipper. If it wasn't, this has no effect. The object @c obj must be a valid
|
||||||
|
* Evas_Object.
|
||||||
|
*
|
||||||
|
* See also @ref evas_object_clip_set, @ref evas_object_clipees_get and
|
||||||
|
* @ref evas_object_clip_get.
|
||||||
|
*
|
||||||
|
* @ingroup Evas_Object
|
||||||
|
*/
|
||||||
|
EAPI void evas_object_clip_unset(Evas_Object *obj);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Retrieves the hints for an object's minimum size.
|
* @brief Retrieves the hints for an object's minimum size.
|
||||||
*
|
*
|
||||||
|
|
|
@ -78,15 +78,6 @@ class Efl.Canvas.Group (Efl.Canvas.Object)
|
||||||
return: free(own(iterator<Efl.Gfx>), eina_iterator_free);
|
return: free(own(iterator<Efl.Gfx>), eina_iterator_free);
|
||||||
legacy: evas_object_smart_iterator_new;
|
legacy: evas_object_smart_iterator_new;
|
||||||
}
|
}
|
||||||
@property group_clip {
|
|
||||||
set {
|
|
||||||
[[No description supplied by the EAPI.]]
|
|
||||||
legacy: null;
|
|
||||||
}
|
|
||||||
values {
|
|
||||||
clip: Efl.Canvas.Object;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
group_show {
|
group_show {
|
||||||
[[No description supplied by the EAPI.]]
|
[[No description supplied by the EAPI.]]
|
||||||
legacy: null;
|
legacy: null;
|
||||||
|
@ -140,10 +131,6 @@ class Efl.Canvas.Group (Efl.Canvas.Object)
|
||||||
@in h: Evas.Coord;
|
@in h: Evas.Coord;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
group_clip_unset {
|
|
||||||
[[No description supplied by the EAPI.]]
|
|
||||||
legacy: null;
|
|
||||||
}
|
|
||||||
group_member_del {
|
group_member_del {
|
||||||
[[Removes a member object from a given smart object.
|
[[Removes a member object from a given smart object.
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,9 @@ abstract Efl.Canvas.Group.Clipped (Efl.Canvas.Group)
|
||||||
data: Evas_Object_Smart_Clipped_Data;
|
data: Evas_Object_Smart_Clipped_Data;
|
||||||
implements {
|
implements {
|
||||||
Efl.Gfx.color.set;
|
Efl.Gfx.color.set;
|
||||||
|
Efl.Canvas.Object.clip.set;
|
||||||
Efl.Canvas.Object.no_render.set;
|
Efl.Canvas.Object.no_render.set;
|
||||||
Efl.Canvas.Group.group_hide;
|
Efl.Canvas.Group.group_hide;
|
||||||
Efl.Canvas.Group.group_clip.set;
|
|
||||||
Efl.Canvas.Group.group_clip_unset;
|
|
||||||
Efl.Canvas.Group.group_show;
|
Efl.Canvas.Group.group_show;
|
||||||
Efl.Canvas.Group.group_move;
|
Efl.Canvas.Group.group_move;
|
||||||
Efl.Canvas.Group.group_member_del;
|
Efl.Canvas.Group.group_member_del;
|
||||||
|
|
|
@ -131,27 +131,13 @@ abstract Efl.Canvas.Object (Efl.Object, Efl.Gfx, Efl.Gfx.Stack, Efl.Animator,
|
||||||
is called, it gets implicitly removed from the old clipper's
|
is called, it gets implicitly removed from the old clipper's
|
||||||
domain and is made now to be clipped by its new clipper.
|
domain and is made now to be clipped by its new clipper.
|
||||||
|
|
||||||
Note: At the moment the only objects that can validly be used
|
If $clip is $null, this call will disable clipping for the object
|
||||||
to clip other objects are rectangle objects. All other object
|
i.e. its visibility and color get detached from the previous
|
||||||
types are invalid and the result of using them is undefined.
|
clipper. If it wasn't, this has no effect.
|
||||||
The clip object $clip must be a valid object, but can also be
|
|
||||||
$null, in which case the effect of this function is the same
|
Note: Only rectangle and image (masks) objects can be used
|
||||||
as @.clip_unset on the $obj object.
|
as clippers. Anything else will result in undefined behaviour.
|
||||||
]]
|
]]
|
||||||
/* FIXME-doc
|
|
||||||
The following figure illustrates some clipping in Evas:
|
|
||||||
|
|
||||||
@image html clipping.png
|
|
||||||
@image rtf clipping.png
|
|
||||||
@image latex clipping.eps
|
|
||||||
---
|
|
||||||
Example:
|
|
||||||
@dontinclude evas-object-manipulation.c
|
|
||||||
@skip solid white clipper (note that it's the default color for a
|
|
||||||
@until evas_object_show(d.clipper);
|
|
||||||
|
|
||||||
See the full @ref Example_Evas_Object_Manipulation "example".
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
get {
|
get {
|
||||||
[[Get the object clipping $obj (if any).
|
[[Get the object clipping $obj (if any).
|
||||||
|
@ -160,14 +146,6 @@ abstract Efl.Canvas.Object (Efl.Object, Efl.Gfx, Efl.Gfx.Stack, Efl.Animator,
|
||||||
not being clipped at all, $null is returned. The object $obj
|
not being clipped at all, $null is returned. The object $obj
|
||||||
must be a valid Evas_Object.
|
must be a valid Evas_Object.
|
||||||
]]
|
]]
|
||||||
/* FIXME-doc
|
|
||||||
Example:
|
|
||||||
@dontinclude evas-object-manipulation.c
|
|
||||||
@skip if (evas_object_clip_get(d.img) == d.clipper)
|
|
||||||
@until return
|
|
||||||
|
|
||||||
See the full @ref Example_Evas_Object_Manipulation "example".
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
values {
|
values {
|
||||||
clip: Efl.Canvas.Object @nonull; [[The object to clip $obj by.]]
|
clip: Efl.Canvas.Object @nonull; [[The object to clip $obj by.]]
|
||||||
|
@ -381,7 +359,7 @@ abstract Efl.Canvas.Object (Efl.Object, Efl.Gfx, Efl.Gfx.Stack, Efl.Animator,
|
||||||
anymore after that point. Any use of the list after this
|
anymore after that point. Any use of the list after this
|
||||||
may have undefined results, possibly leading to crashes.
|
may have undefined results, possibly leading to crashes.
|
||||||
|
|
||||||
See also @.clip and @.clip_unset.
|
See also @.clip.
|
||||||
]]
|
]]
|
||||||
legacy: null;
|
legacy: null;
|
||||||
return: iterator<Efl.Canvas.Object> @warn_unused; [[An iterator over the
|
return: iterator<Efl.Canvas.Object> @warn_unused; [[An iterator over the
|
||||||
|
@ -498,17 +476,6 @@ abstract Efl.Canvas.Object (Efl.Object, Efl.Gfx, Efl.Gfx.Stack, Efl.Animator,
|
||||||
]]
|
]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
clip_unset {
|
|
||||||
[[Disable/cease clipping on a clipped $obj object.
|
|
||||||
|
|
||||||
This function disables clipping for the object $obj, if it was
|
|
||||||
already clipped, i.e., its visibility and color get detached from
|
|
||||||
the previous clipper. If it wasn't, this has no effect. The
|
|
||||||
object $obj must be a valid Evas_Object.
|
|
||||||
|
|
||||||
See also @.clip.set, @.clipees.get and @.clip.get.
|
|
||||||
]]
|
|
||||||
}
|
|
||||||
@property no_render {
|
@property no_render {
|
||||||
get {
|
get {
|
||||||
[[Returns the state of the "no-render" flag, which means, when
|
[[Returns the state of the "no-render" flag, which means, when
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include "evas_common_private.h"
|
#include "evas_common_private.h"
|
||||||
#include "evas_private.h"
|
#include "evas_private.h"
|
||||||
|
|
||||||
|
static void _clip_unset(Eo *eo_obj, Evas_Object_Protected_Data *obj);
|
||||||
|
|
||||||
void
|
void
|
||||||
evas_object_clip_dirty(Evas_Object *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj)
|
evas_object_clip_dirty(Evas_Object *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj)
|
||||||
{
|
{
|
||||||
|
@ -215,6 +217,47 @@ extern const char *o_image_type;
|
||||||
|
|
||||||
static void _clipper_del_cb(void *data, const Efl_Event *event);
|
static void _clipper_del_cb(void *data, const Efl_Event *event);
|
||||||
|
|
||||||
|
Eina_Bool
|
||||||
|
_efl_canvas_object_clip_set_block(Eo *eo_obj, Evas_Object_Protected_Data *obj,
|
||||||
|
Evas_Object *eo_clip, Evas_Object_Protected_Data *clip)
|
||||||
|
{
|
||||||
|
if (!obj) obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
|
||||||
|
if (!clip) clip = efl_data_scope_get(eo_clip, EFL_CANVAS_OBJECT_CLASS);
|
||||||
|
|
||||||
|
evas_object_async_block(obj);
|
||||||
|
|
||||||
|
if (obj->cur->clipper && (obj->cur->clipper->object == eo_clip)) return EINA_TRUE;
|
||||||
|
if (eo_obj == eo_clip) goto err_same;
|
||||||
|
if (clip->delete_me) goto err_clip_deleted;
|
||||||
|
if (obj->delete_me) goto err_obj_deleted;
|
||||||
|
if (!obj->layer || !clip->layer) goto err_no_layer;
|
||||||
|
if (obj->layer->evas != clip->layer->evas) goto err_diff_evas;
|
||||||
|
if ((clip->type != o_rect_type) && (clip->type != o_image_type)) goto err_type;
|
||||||
|
|
||||||
|
return EINA_FALSE;
|
||||||
|
|
||||||
|
err_same:
|
||||||
|
CRI("Setting clip %p on itself", eo_obj);
|
||||||
|
return EINA_TRUE;
|
||||||
|
err_clip_deleted:
|
||||||
|
CRI("Setting deleted object %p as clip obj %p", eo_clip, eo_obj);
|
||||||
|
return EINA_TRUE;
|
||||||
|
err_obj_deleted:
|
||||||
|
CRI("Setting object %p as clip to deleted obj %p", eo_clip, eo_obj);
|
||||||
|
return EINA_TRUE;
|
||||||
|
err_no_layer:
|
||||||
|
CRI("Object %p or clip %p layer is not set !", obj, clip);;
|
||||||
|
return EINA_TRUE;
|
||||||
|
err_diff_evas:
|
||||||
|
CRI("Setting object %p from Evas (%p) to another Evas (%p)",
|
||||||
|
obj, obj->layer->evas, clip->layer->evas);
|
||||||
|
return EINA_TRUE;
|
||||||
|
err_type:
|
||||||
|
CRI("A clipper can only be an evas rectangle or image (got %s)",
|
||||||
|
efl_class_name_get(eo_clip));
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
EOLIAN void
|
EOLIAN void
|
||||||
_efl_canvas_object_clip_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, Evas_Object *eo_clip)
|
_efl_canvas_object_clip_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, Evas_Object *eo_clip)
|
||||||
{
|
{
|
||||||
|
@ -223,62 +266,18 @@ _efl_canvas_object_clip_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, Evas_Ob
|
||||||
|
|
||||||
if (!eo_clip)
|
if (!eo_clip)
|
||||||
{
|
{
|
||||||
evas_object_clip_unset(eo_obj);
|
_clip_unset(eo_obj, obj);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MAGIC_CHECK(eo_clip, Evas_Object, MAGIC_OBJ);
|
|
||||||
return;
|
|
||||||
MAGIC_CHECK_END();
|
|
||||||
|
|
||||||
evas_object_async_block(obj);
|
|
||||||
|
|
||||||
clip = efl_data_scope_get(eo_clip, EFL_CANVAS_OBJECT_CLASS);
|
clip = efl_data_scope_get(eo_clip, EFL_CANVAS_OBJECT_CLASS);
|
||||||
if (obj->cur->clipper && obj->cur->clipper->object == eo_clip) return;
|
if (_efl_canvas_object_clip_set_block(eo_obj, obj, eo_clip, clip)) return;
|
||||||
if (eo_obj == eo_clip)
|
if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_CLIP_SET, 1, eo_clip)) return;
|
||||||
{
|
|
||||||
CRI("Setting clip %p on itself", eo_obj);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (clip->delete_me)
|
|
||||||
{
|
|
||||||
CRI("Setting deleted object %p as clip obj %p", eo_clip, eo_obj);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (obj->delete_me)
|
|
||||||
{
|
|
||||||
CRI("Setting object %p as clip to deleted obj %p", eo_clip, eo_obj);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!obj->layer)
|
|
||||||
{
|
|
||||||
CRI("No evas surface associated with object (%p)", eo_obj);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ((obj->layer && clip->layer) &&
|
|
||||||
(obj->layer->evas != clip->layer->evas))
|
|
||||||
{
|
|
||||||
CRI("Setting object %p from Evas (%p) to another Evas (%p)", obj, obj->layer->evas, clip->layer->evas);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!obj->layer || !clip->layer)
|
|
||||||
{
|
|
||||||
CRI("Object %p or clip %p layer is not set !", obj, clip);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_CLIP_SET, 1, eo_clip))
|
if (obj->is_smart && obj->smart.smart && obj->smart.smart->smart_class &&
|
||||||
return;
|
obj->smart.smart->smart_class->clip_set)
|
||||||
|
|
||||||
// illegal to set anything but a rect or an image as a clip
|
|
||||||
if (clip->type != o_rect_type && clip->type != o_image_type)
|
|
||||||
{
|
{
|
||||||
ERR("For now a clip on other object than a rectangle or an image is disabled");
|
obj->smart.smart->smart_class->clip_set(eo_obj, eo_clip);
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (obj->is_smart)
|
|
||||||
{
|
|
||||||
efl_canvas_group_clip_set(eo_obj, eo_clip);
|
|
||||||
}
|
}
|
||||||
if (obj->cur->clipper)
|
if (obj->cur->clipper)
|
||||||
{
|
{
|
||||||
|
@ -402,18 +401,27 @@ _efl_canvas_object_clip_get(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN void
|
Eina_Bool
|
||||||
_efl_canvas_object_clip_unset(Eo *eo_obj, Evas_Object_Protected_Data *obj)
|
_efl_canvas_object_clip_unset_block(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj)
|
||||||
{
|
{
|
||||||
if (!obj->cur->clipper) return;
|
if (!obj->cur->clipper)
|
||||||
|
return EINA_TRUE;
|
||||||
|
|
||||||
evas_object_async_block(obj);
|
evas_object_async_block(obj);
|
||||||
obj->clip.cache_clipees_answer = eina_list_free(obj->clip.cache_clipees_answer);
|
obj->clip.cache_clipees_answer = eina_list_free(obj->clip.cache_clipees_answer);
|
||||||
|
|
||||||
/* unclip */
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_clip_unset(Eo *eo_obj, Evas_Object_Protected_Data *obj)
|
||||||
|
{
|
||||||
|
if (_efl_canvas_object_clip_unset_block(eo_obj, obj)) return;
|
||||||
if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_CLIP_UNSET, 1)) return;
|
if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_CLIP_UNSET, 1)) return;
|
||||||
if (obj->is_smart)
|
if (obj->is_smart && obj->smart.smart && obj->smart.smart->smart_class &&
|
||||||
|
obj->smart.smart->smart_class->clip_unset)
|
||||||
{
|
{
|
||||||
efl_canvas_group_clip_unset(eo_obj);
|
obj->smart.smart->smart_class->clip_unset(eo_obj);
|
||||||
}
|
}
|
||||||
if (obj->cur->clipper)
|
if (obj->cur->clipper)
|
||||||
{
|
{
|
||||||
|
@ -478,6 +486,16 @@ _efl_canvas_object_clip_unset(Eo *eo_obj, Evas_Object_Protected_Data *obj)
|
||||||
evas_object_clip_across_check(eo_obj, obj);
|
evas_object_clip_across_check(eo_obj, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
evas_object_clip_unset(Evas_Object *eo_obj)
|
||||||
|
{
|
||||||
|
Evas_Object_Protected_Data *obj;
|
||||||
|
|
||||||
|
if (!efl_isa(eo_obj, EFL_CANVAS_OBJECT_CLASS)) return;
|
||||||
|
obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
|
||||||
|
_clip_unset(eo_obj, obj);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_clipper_del_cb(void *data, const Efl_Event *event)
|
_clipper_del_cb(void *data, const Efl_Event *event)
|
||||||
{
|
{
|
||||||
|
@ -486,7 +504,7 @@ _clipper_del_cb(void *data, const Efl_Event *event)
|
||||||
|
|
||||||
if (!obj) return;
|
if (!obj) return;
|
||||||
|
|
||||||
_efl_canvas_object_clip_unset(eo_obj, obj);
|
_clip_unset(eo_obj, obj);
|
||||||
if (obj->prev->clipper && (obj->prev->clipper->object == event->object))
|
if (obj->prev->clipper && (obj->prev->clipper->object == event->object))
|
||||||
{
|
{
|
||||||
// not removing cb since it's the del cb... it can't be called again!
|
// not removing cb since it's the del cb... it can't be called again!
|
||||||
|
|
|
@ -104,101 +104,111 @@ _evas_object_intercept_call(Evas_Object *eo_obj, Evas_Object_Intercept_Cb_Type c
|
||||||
case EVAS_OBJECT_INTERCEPT_CB_SHOW:
|
case EVAS_OBJECT_INTERCEPT_CB_SHOW:
|
||||||
if (obj->cur->visible) return 1;
|
if (obj->cur->visible) return 1;
|
||||||
if (!obj->interceptors) return 0;
|
if (!obj->interceptors) return 0;
|
||||||
blocked = evas_object_intercept_call_show(eo_obj, obj);
|
return evas_object_intercept_call_show(eo_obj, obj);
|
||||||
break;
|
|
||||||
|
|
||||||
case EVAS_OBJECT_INTERCEPT_CB_HIDE:
|
case EVAS_OBJECT_INTERCEPT_CB_HIDE:
|
||||||
if (!obj->cur->visible) return 1;
|
if (!obj->cur->visible) return 1;
|
||||||
if (!obj->interceptors) return 0;
|
if (!obj->interceptors) return 0;
|
||||||
blocked = evas_object_intercept_call_hide(eo_obj, obj);
|
return evas_object_intercept_call_hide(eo_obj, obj);
|
||||||
break;
|
|
||||||
|
|
||||||
case EVAS_OBJECT_INTERCEPT_CB_MOVE:
|
case EVAS_OBJECT_INTERCEPT_CB_MOVE:
|
||||||
if (!obj->interceptors) return 0;
|
if (!obj->interceptors) return 0;
|
||||||
va_start(args, cb_type);
|
va_start(args, internal);
|
||||||
i = va_arg(args, int);
|
i = va_arg(args, int);
|
||||||
j = va_arg(args, int);
|
j = va_arg(args, int);
|
||||||
blocked = evas_object_intercept_call_move(eo_obj, obj, i, j);
|
blocked = evas_object_intercept_call_move(eo_obj, obj, i, j);
|
||||||
va_end(args);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EVAS_OBJECT_INTERCEPT_CB_RESIZE:
|
case EVAS_OBJECT_INTERCEPT_CB_RESIZE:
|
||||||
if (!obj->interceptors) return 0;
|
if (!obj->interceptors) return 0;
|
||||||
va_start(args, cb_type);
|
va_start(args, internal);
|
||||||
i = va_arg(args, int);
|
i = va_arg(args, int);
|
||||||
j = va_arg(args, int);
|
j = va_arg(args, int);
|
||||||
blocked = evas_object_intercept_call_resize(eo_obj, obj, i, j);
|
blocked = evas_object_intercept_call_resize(eo_obj, obj, i, j);
|
||||||
va_end(args);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EVAS_OBJECT_INTERCEPT_CB_RAISE:
|
case EVAS_OBJECT_INTERCEPT_CB_RAISE:
|
||||||
if (!obj->interceptors) return 0;
|
if (!obj->interceptors) return 0;
|
||||||
blocked = evas_object_intercept_call_raise(eo_obj, obj);
|
return evas_object_intercept_call_raise(eo_obj, obj);
|
||||||
break;
|
|
||||||
|
|
||||||
case EVAS_OBJECT_INTERCEPT_CB_LOWER:
|
case EVAS_OBJECT_INTERCEPT_CB_LOWER:
|
||||||
if (!obj->interceptors) return 0;
|
if (!obj->interceptors) return 0;
|
||||||
blocked = evas_object_intercept_call_lower(eo_obj, obj);
|
return evas_object_intercept_call_lower(eo_obj, obj);
|
||||||
break;
|
|
||||||
|
|
||||||
case EVAS_OBJECT_INTERCEPT_CB_STACK_ABOVE:
|
case EVAS_OBJECT_INTERCEPT_CB_STACK_ABOVE:
|
||||||
if (!obj->interceptors) return 0;
|
if (!obj->interceptors) return 0;
|
||||||
va_start(args, cb_type);
|
va_start(args, internal);
|
||||||
eo_other = va_arg(args, Evas_Object *);
|
eo_other = va_arg(args, Evas_Object *);
|
||||||
blocked = evas_object_intercept_call_stack_above(eo_obj, obj, eo_other);
|
blocked = evas_object_intercept_call_stack_above(eo_obj, obj, eo_other);
|
||||||
va_end(args);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EVAS_OBJECT_INTERCEPT_CB_STACK_BELOW:
|
case EVAS_OBJECT_INTERCEPT_CB_STACK_BELOW:
|
||||||
if (!obj->interceptors) return 0;
|
if (!obj->interceptors) return 0;
|
||||||
va_start(args, cb_type);
|
va_start(args, internal);
|
||||||
eo_other = va_arg(args, Evas_Object *);
|
eo_other = va_arg(args, Evas_Object *);
|
||||||
blocked = evas_object_intercept_call_stack_below(eo_obj, obj, eo_other);
|
blocked = evas_object_intercept_call_stack_below(eo_obj, obj, eo_other);
|
||||||
va_end(args);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EVAS_OBJECT_INTERCEPT_CB_LAYER_SET:
|
case EVAS_OBJECT_INTERCEPT_CB_LAYER_SET:
|
||||||
if (!obj->interceptors) return 0;
|
if (!obj->interceptors) return 0;
|
||||||
va_start(args, cb_type);
|
va_start(args, internal);
|
||||||
i = va_arg(args, int);
|
i = va_arg(args, int);
|
||||||
blocked = evas_object_intercept_call_layer_set(eo_obj, obj, i);
|
blocked = evas_object_intercept_call_layer_set(eo_obj, obj, i);
|
||||||
va_end(args);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EVAS_OBJECT_INTERCEPT_CB_FOCUS_SET:
|
case EVAS_OBJECT_INTERCEPT_CB_FOCUS_SET:
|
||||||
if (!obj->interceptors) return 0;
|
if (!obj->interceptors) return 0;
|
||||||
va_start(args, cb_type);
|
va_start(args, internal);
|
||||||
i = va_arg(args, int);
|
i = va_arg(args, int);
|
||||||
blocked = evas_object_intercept_call_focus_set(eo_obj, obj, !!i);
|
blocked = evas_object_intercept_call_focus_set(eo_obj, obj, !!i);
|
||||||
va_end(args);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EVAS_OBJECT_INTERCEPT_CB_COLOR_SET:
|
case EVAS_OBJECT_INTERCEPT_CB_COLOR_SET:
|
||||||
if (!obj->interceptors) return 0;
|
if (!obj->interceptors) return 0;
|
||||||
va_start(args, cb_type);
|
va_start(args, internal);
|
||||||
r = va_arg(args, int);
|
r = va_arg(args, int);
|
||||||
g = va_arg(args, int);
|
g = va_arg(args, int);
|
||||||
b = va_arg(args, int);
|
b = va_arg(args, int);
|
||||||
a = va_arg(args, int);
|
a = va_arg(args, int);
|
||||||
blocked = evas_object_intercept_call_color_set(eo_obj, obj, r, g, b, a);
|
blocked = evas_object_intercept_call_color_set(eo_obj, obj, r, g, b, a);
|
||||||
va_end(args);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EVAS_OBJECT_INTERCEPT_CB_CLIP_SET:
|
case EVAS_OBJECT_INTERCEPT_CB_CLIP_SET:
|
||||||
if (!obj->interceptors) return 0;
|
va_start(args, internal);
|
||||||
va_start(args, cb_type);
|
|
||||||
eo_other = va_arg(args, Evas_Object *);
|
eo_other = va_arg(args, Evas_Object *);
|
||||||
|
if (eo_other)
|
||||||
|
{
|
||||||
|
if (!internal)
|
||||||
|
{
|
||||||
|
if (_efl_canvas_object_clip_set_block(eo_obj, obj, eo_other, NULL))
|
||||||
|
goto end_block;
|
||||||
|
}
|
||||||
|
if (!obj->interceptors) goto end_noblock;
|
||||||
blocked = evas_object_intercept_call_clip_set(eo_obj, obj, eo_other);
|
blocked = evas_object_intercept_call_clip_set(eo_obj, obj, eo_other);
|
||||||
va_end(args);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EVAS_OBJECT_INTERCEPT_CB_CLIP_UNSET:
|
|
||||||
if (!obj->interceptors) return 0;
|
|
||||||
blocked = evas_object_intercept_call_clip_unset(eo_obj, obj);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// else: fallthrough to unset
|
||||||
|
|
||||||
|
case EVAS_OBJECT_INTERCEPT_CB_CLIP_UNSET:
|
||||||
|
if (!internal)
|
||||||
|
{
|
||||||
|
if (_efl_canvas_object_clip_unset_block(eo_obj, obj))
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (!obj->interceptors) return 0;
|
||||||
|
return evas_object_intercept_call_clip_unset(eo_obj, obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
va_end(args);
|
||||||
return blocked;
|
return blocked;
|
||||||
|
|
||||||
|
end_block:
|
||||||
|
va_end(args);
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
end_noblock:
|
||||||
|
va_end(args);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* public calls */
|
/* public calls */
|
||||||
|
|
|
@ -649,26 +649,6 @@ _efl_canvas_group_group_hide(Eo *eo_obj, Evas_Smart_Data *o EINA_UNUSED)
|
||||||
if (s && s->smart_class->hide) s->smart_class->hide(eo_obj);
|
if (s && s->smart_class->hide) s->smart_class->hide(eo_obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
|
||||||
_efl_canvas_group_group_clip_set(Eo *eo_obj, Evas_Smart_Data *o EINA_UNUSED, Evas_Object *clip)
|
|
||||||
{
|
|
||||||
// If this function is reached, so we do nothing except trying to call
|
|
||||||
// the function of the legacy smart class.
|
|
||||||
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
|
|
||||||
Evas_Smart *s = obj->smart.smart;
|
|
||||||
if (s && s->smart_class->clip_set) s->smart_class->clip_set(eo_obj, clip);
|
|
||||||
}
|
|
||||||
|
|
||||||
EOLIAN static void
|
|
||||||
_efl_canvas_group_group_clip_unset(Eo *eo_obj, Evas_Smart_Data *o EINA_UNUSED)
|
|
||||||
{
|
|
||||||
// If this function is reached, so we do nothing except trying to call
|
|
||||||
// the function of the legacy smart class.
|
|
||||||
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
|
|
||||||
Evas_Smart *s = obj->smart.smart;
|
|
||||||
if (s && s->smart_class->clip_unset) s->smart_class->clip_unset(eo_obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_efl_canvas_group_efl_canvas_object_no_render_set(Eo *eo_obj, Evas_Smart_Data *o EINA_UNUSED, Eina_Bool enable)
|
_efl_canvas_group_efl_canvas_object_no_render_set(Eo *eo_obj, Evas_Smart_Data *o EINA_UNUSED, Eina_Bool enable)
|
||||||
{
|
{
|
||||||
|
|
|
@ -175,12 +175,6 @@ evas_object_smart_clipped_smart_clip_set(Evas_Object *eo_obj, Evas_Object *clip)
|
||||||
evas_object_clip_set(cso->clipper, clip);
|
evas_object_clip_set(cso->clipper, clip);
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
|
||||||
_efl_canvas_group_clipped_efl_canvas_group_group_clip_set(Eo *eo_obj, Evas_Object_Smart_Clipped_Data *obj EINA_UNUSED, Evas_Object *clip)
|
|
||||||
{
|
|
||||||
evas_object_smart_clipped_smart_clip_set(eo_obj, clip);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
evas_object_smart_clipped_smart_clip_unset(Evas_Object *eo_obj)
|
evas_object_smart_clipped_smart_clip_unset(Evas_Object *eo_obj)
|
||||||
{
|
{
|
||||||
|
@ -189,9 +183,20 @@ evas_object_smart_clipped_smart_clip_unset(Evas_Object *eo_obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_efl_canvas_group_clipped_efl_canvas_group_group_clip_unset(Eo *eo_obj, Evas_Object_Smart_Clipped_Data *obj EINA_UNUSED)
|
_efl_canvas_group_clipped_efl_canvas_object_clip_set(Eo *eo_obj, Evas_Object_Smart_Clipped_Data *obj EINA_UNUSED, Evas_Object *clip)
|
||||||
{
|
{
|
||||||
|
if (clip)
|
||||||
|
{
|
||||||
|
if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_CLIP_SET, 0, clip))
|
||||||
|
return;
|
||||||
|
evas_object_smart_clipped_smart_clip_set(eo_obj, clip);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_CLIP_UNSET, 0))
|
||||||
|
return;
|
||||||
evas_object_smart_clipped_smart_clip_unset(eo_obj);
|
evas_object_smart_clipped_smart_clip_unset(eo_obj);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -1652,6 +1652,9 @@ void evas_font_draw_async_check(Evas_Object_Protected_Data *obj,
|
||||||
|
|
||||||
void _efl_canvas_object_clip_prev_reset(Evas_Object_Protected_Data *obj, Eina_Bool cur_prev);
|
void _efl_canvas_object_clip_prev_reset(Evas_Object_Protected_Data *obj, Eina_Bool cur_prev);
|
||||||
|
|
||||||
|
Eina_Bool _efl_canvas_object_clip_set_block(Eo *eo_obj, Evas_Object_Protected_Data *obj, Evas_Object *eo_clip, Evas_Object_Protected_Data *clip);
|
||||||
|
Eina_Bool _efl_canvas_object_clip_unset_block(Eo *eo_obj, Evas_Object_Protected_Data *obj);
|
||||||
|
|
||||||
void _canvas_event_default_flags_set(Eo *e, void *_pd, va_list *list);
|
void _canvas_event_default_flags_set(Eo *e, void *_pd, va_list *list);
|
||||||
void _canvas_event_default_flags_get(Eo *e, void *_pd, va_list *list);
|
void _canvas_event_default_flags_get(Eo *e, void *_pd, va_list *list);
|
||||||
void _canvas_event_freeze(Eo *e, void *_pd, va_list *list);
|
void _canvas_event_freeze(Eo *e, void *_pd, va_list *list);
|
||||||
|
|
Loading…
Reference in New Issue