forked from enlightenment/efl
efl.canvas.object: implement pointer_inside of Efl.Canvas.Pointer.
remove eo apis pointer_in, pointer_device_in, pointer_inside_get & pointer_inside_by_device_get and add legacy APIs for pointer_inside_get & pointer_inside_by_device_get. These four APIs do almost same things.
This commit is contained in:
parent
80463f0e2e
commit
b734c132f9
|
@ -570,7 +570,7 @@ _elm_cursor_cur_set(Elm_Cursor *cur)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (efl_canvas_object_pointer_in_get(cur->eventarea))
|
if (efl_canvas_pointer_inside_get(cur->eventarea, NULL))
|
||||||
_elm_cursor_set(cur);
|
_elm_cursor_set(cur);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2210,6 +2210,39 @@ EAPI void evas_object_scale_set(Evas_Object *obj, double scale);
|
||||||
*/
|
*/
|
||||||
EAPI double evas_object_scale_get(const Evas_Object *obj);
|
EAPI double evas_object_scale_get(const Evas_Object *obj);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns whether the mouse pointer is logically inside the object.
|
||||||
|
*
|
||||||
|
* @param[in] dev The pointer device.
|
||||||
|
*
|
||||||
|
* @return @c true if the pointer is inside, @c false otherwise.
|
||||||
|
*
|
||||||
|
* @since 1.20
|
||||||
|
*
|
||||||
|
* @ingroup Evas_Object
|
||||||
|
*/
|
||||||
|
EAPI Eina_Bool evas_object_pointer_inside_by_device_get(const Evas_Object *obj, Efl_Input_Device * dev);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns whether the default mouse pointer is logically inside the
|
||||||
|
* object.
|
||||||
|
*
|
||||||
|
* When this function is called it will return a value of either @c false or
|
||||||
|
* @c true, depending on if event_feed_mouse_in or event_feed_mouse_out have
|
||||||
|
* been called to feed in a mouse enter event into the object.
|
||||||
|
*
|
||||||
|
* A return value of @c true indicates the mouse is logically inside the
|
||||||
|
* object, and @c false implies it is logically outside the object.
|
||||||
|
*
|
||||||
|
* If @c e is not a valid object, the return value is undefined.
|
||||||
|
*
|
||||||
|
* @return @c true if the mouse pointer is inside the object, @c false
|
||||||
|
* otherwise
|
||||||
|
*
|
||||||
|
* @ingroup Evas_Object
|
||||||
|
*/
|
||||||
|
EAPI Eina_Bool evas_object_pointer_inside_get(const Evas_Object *obj) EINA_WARN_UNUSED_RESULT;
|
||||||
|
|
||||||
|
|
||||||
#include "canvas/efl_canvas_object.eo.legacy.h"
|
#include "canvas/efl_canvas_object.eo.legacy.h"
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import efl_animation_types;
|
||||||
|
|
||||||
abstract Efl.Canvas.Object (Efl.Object, Efl.Gfx, Efl.Gfx.Stack, Efl.Animator,
|
abstract Efl.Canvas.Object (Efl.Object, Efl.Gfx, Efl.Gfx.Stack, Efl.Animator,
|
||||||
Efl.Input.Interface, Efl.Gfx.Size.Hint,
|
Efl.Input.Interface, Efl.Gfx.Size.Hint,
|
||||||
Efl.Gfx.Map, Efl.Loop_User, Efl.Ui.Base)
|
Efl.Gfx.Map, Efl.Loop_User, Efl.Ui.Base, Efl.Canvas.Pointer)
|
||||||
{
|
{
|
||||||
[[Efl canvas object abstract class]]
|
[[Efl canvas object abstract class]]
|
||||||
legacy_prefix: evas_object;
|
legacy_prefix: evas_object;
|
||||||
|
@ -56,41 +56,6 @@ abstract Efl.Canvas.Object (Efl.Object, Efl.Gfx, Efl.Gfx.Stack, Efl.Animator,
|
||||||
pointer_mode: Efl.Input.Object_Pointer_Mode; [[Input pointer mode]]
|
pointer_mode: Efl.Input.Object_Pointer_Mode; [[Input pointer mode]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@property pointer_in {
|
|
||||||
[[Read-only value indicating whether the main pointer is in the object.
|
|
||||||
|
|
||||||
This shall be true between pointer,in and pointer,out events (coming
|
|
||||||
in matching numbers). Note that group objects may receive multiple
|
|
||||||
pointer,in in a row. See algo @.pointer_device_in.get
|
|
||||||
|
|
||||||
@since 1.19
|
|
||||||
]]
|
|
||||||
get {
|
|
||||||
legacy: null;
|
|
||||||
}
|
|
||||||
values {
|
|
||||||
in: bool; [[If $true the main pointer has entered this object.]]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@property pointer_device_in {
|
|
||||||
[[Read-only value indicating whether a pointer is in the object.
|
|
||||||
|
|
||||||
This shall be true between pointer,in and pointer,out events (coming
|
|
||||||
in matching numbers). Note that group objects may receive multiple
|
|
||||||
pointer,in in a row.
|
|
||||||
|
|
||||||
@since 1.19
|
|
||||||
]]
|
|
||||||
get {
|
|
||||||
legacy: null;
|
|
||||||
}
|
|
||||||
keys {
|
|
||||||
pointer: Efl.Input.Device; [[The pointer. Use $null for the defaul pointer]]
|
|
||||||
}
|
|
||||||
values {
|
|
||||||
in: bool; [[If $true the pointer has entered this object.]]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@property render_op {
|
@property render_op {
|
||||||
[[Render mode to be used for compositing the Evas object.
|
[[Render mode to be used for compositing the Evas object.
|
||||||
|
|
||||||
|
@ -586,36 +551,6 @@ abstract Efl.Canvas.Object (Efl.Object, Efl.Gfx, Efl.Gfx.Stack, Efl.Animator,
|
||||||
enable: bool; [[Enable "no-render" mode.]]
|
enable: bool; [[Enable "no-render" mode.]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@property pointer_inside_by_device {
|
|
||||||
[[Returns whether the mouse pointer is logically inside the
|
|
||||||
object. @since 1.20]]
|
|
||||||
keys {
|
|
||||||
dev: Efl.Input.Device; [[The pointer device.]]
|
|
||||||
}
|
|
||||||
get {}
|
|
||||||
values {
|
|
||||||
in: bool; [[$true if the pointer is inside, $false otherwise.]]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@property pointer_inside {
|
|
||||||
get {
|
|
||||||
[[Returns whether the default mouse pointer is logically inside the
|
|
||||||
object.
|
|
||||||
|
|
||||||
When this function is called it will return a value of either
|
|
||||||
$false or $true, depending on if event_feed_mouse_in or
|
|
||||||
event_feed_mouse_out have been called to feed in a mouse
|
|
||||||
enter event into the object.
|
|
||||||
|
|
||||||
A return value of $true indicates the mouse is logically
|
|
||||||
inside the object, and $false implies it is logically
|
|
||||||
outside the object.
|
|
||||||
|
|
||||||
If $e is not a valid object, the return value is undefined.
|
|
||||||
]]
|
|
||||||
return: bool @warn_unused; [[$true if the mouse pointer is inside the object, $false otherwise]]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pointer_coords_inside_get {
|
pointer_coords_inside_get {
|
||||||
[[Returns whether the coords are logically inside the
|
[[Returns whether the coords are logically inside the
|
||||||
object.
|
object.
|
||||||
|
@ -681,5 +616,6 @@ abstract Efl.Canvas.Object (Efl.Object, Efl.Gfx, Efl.Gfx.Stack, Efl.Animator,
|
||||||
Efl.Gfx.scale { set; get; }
|
Efl.Gfx.scale { set; get; }
|
||||||
Efl.Input.Interface.seat_event_filter { get; set; }
|
Efl.Input.Interface.seat_event_filter { get; set; }
|
||||||
Efl.Loop_User.loop { get; }
|
Efl.Loop_User.loop { get; }
|
||||||
|
Efl.Canvas.Pointer.pointer_inside { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3868,7 +3868,7 @@ _efl_canvas_object_pointer_mode_get(Eo *eo_obj, Evas_Object_Protected_Data *obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN Eina_Bool
|
EOLIAN Eina_Bool
|
||||||
_efl_canvas_object_pointer_device_in_get(Eo *eo_obj,
|
_efl_canvas_object_efl_canvas_pointer_pointer_inside_get(Eo *eo_obj,
|
||||||
Evas_Object_Protected_Data *obj,
|
Evas_Object_Protected_Data *obj,
|
||||||
Efl_Input_Device *pointer)
|
Efl_Input_Device *pointer)
|
||||||
{
|
{
|
||||||
|
@ -3880,7 +3880,6 @@ _efl_canvas_object_pointer_device_in_get(Eo *eo_obj,
|
||||||
|
|
||||||
EVAS_OBJECT_DATA_ALIVE_CHECK(obj, EINA_FALSE);
|
EVAS_OBJECT_DATA_ALIVE_CHECK(obj, EINA_FALSE);
|
||||||
|
|
||||||
|
|
||||||
if (!pointer)
|
if (!pointer)
|
||||||
pointer = obj->layer->evas->default_mouse;
|
pointer = obj->layer->evas->default_mouse;
|
||||||
|
|
||||||
|
@ -3893,6 +3892,10 @@ _efl_canvas_object_pointer_device_in_get(Eo *eo_obj,
|
||||||
if (!obj->is_smart)
|
if (!obj->is_smart)
|
||||||
return obj_pdata->mouse_in;
|
return obj_pdata->mouse_in;
|
||||||
|
|
||||||
|
/* This is to keep the legacy APIs evas_object_pointer_inside_by_device_get &
|
||||||
|
* evas_object_pointer_inside_get. */
|
||||||
|
if (obj->is_pointer_inside_legacy) return EINA_FALSE;
|
||||||
|
|
||||||
/* For smart objects, this is a bit expensive obj->mouse_in will not be set.
|
/* For smart objects, this is a bit expensive obj->mouse_in will not be set.
|
||||||
* Alternatively we could count the number of in and out events propagated
|
* Alternatively we could count the number of in and out events propagated
|
||||||
* to the smart object, assuming they always match. */
|
* to the smart object, assuming they always match. */
|
||||||
|
@ -3917,12 +3920,6 @@ _efl_canvas_object_pointer_device_in_get(Eo *eo_obj,
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN Eina_Bool
|
|
||||||
_efl_canvas_object_pointer_in_get(Eo *eo_obj, Evas_Object_Protected_Data *obj)
|
|
||||||
{
|
|
||||||
return _efl_canvas_object_pointer_device_in_get(eo_obj, obj, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
evas_event_refeed_event(Eo *eo_e, void *event_copy, Evas_Callback_Type event_type)
|
evas_event_refeed_event(Eo *eo_e, void *event_copy, Evas_Callback_Type event_type)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2661,19 +2661,6 @@ _efl_canvas_object_precise_is_inside_get(Eo *eo_obj EINA_UNUSED, Evas_Object_Pro
|
||||||
return obj->precise_is_inside;
|
return obj->precise_is_inside;
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static Eina_Bool
|
|
||||||
_efl_canvas_object_pointer_inside_by_device_get(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, Efl_Input_Device *dev)
|
|
||||||
{
|
|
||||||
Evas_Pointer_Data *pdata;
|
|
||||||
Evas_Object_Pointer_Data *obj_pdata;
|
|
||||||
|
|
||||||
if (!obj->layer) return EINA_FALSE;
|
|
||||||
pdata = _evas_pointer_data_by_device_get(obj->layer->evas, dev);
|
|
||||||
if (!pdata) return EINA_FALSE;
|
|
||||||
obj_pdata = _evas_object_pointer_data_get(pdata, obj);
|
|
||||||
return obj_pdata ? obj_pdata->mouse_in : EINA_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
EOLIAN static Eina_Bool
|
EOLIAN static Eina_Bool
|
||||||
_efl_canvas_object_pointer_coords_inside_get(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, Evas_Coord x, Evas_Coord y)
|
_efl_canvas_object_pointer_coords_inside_get(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, Evas_Coord x, Evas_Coord y)
|
||||||
{
|
{
|
||||||
|
@ -2695,12 +2682,6 @@ _efl_canvas_object_pointer_coords_inside_get(Eo *eo_obj EINA_UNUSED, Evas_Object
|
||||||
return RECTS_INTERSECT(x, y, 1, 1, c.x, c.y, c.w, c.h);
|
return RECTS_INTERSECT(x, y, 1, 1, c.x, c.y, c.w, c.h);
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static Eina_Bool
|
|
||||||
_efl_canvas_object_pointer_inside_get(Eo *eo_obj, Evas_Object_Protected_Data *obj)
|
|
||||||
{
|
|
||||||
return _efl_canvas_object_pointer_inside_by_device_get(eo_obj, obj, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_is_frame_flag_set(Evas_Object_Protected_Data *obj, Eina_Bool is_frame)
|
_is_frame_flag_set(Evas_Object_Protected_Data *obj, Eina_Bool is_frame)
|
||||||
{
|
{
|
||||||
|
@ -2980,6 +2961,21 @@ evas_object_scale_get(const Evas_Object *obj)
|
||||||
return efl_gfx_scale_get(obj);
|
return efl_gfx_scale_get(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI Eina_Bool
|
||||||
|
evas_object_pointer_inside_by_device_get(const Evas_Object *eo_obj, Efl_Input_Device *dev)
|
||||||
|
{
|
||||||
|
Evas_Object_Protected_Data *obj = EVAS_OBJ_GET_OR_RETURN(eo_obj, EINA_FALSE);
|
||||||
|
|
||||||
|
obj->is_pointer_inside_legacy = EINA_TRUE;
|
||||||
|
return efl_canvas_pointer_inside_get(eo_obj, dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI Eina_Bool
|
||||||
|
evas_object_pointer_inside_get(const Evas_Object *eo_obj)
|
||||||
|
{
|
||||||
|
return evas_object_pointer_inside_by_device_get(eo_obj, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/* Internal EO APIs and hidden overrides */
|
/* Internal EO APIs and hidden overrides */
|
||||||
|
|
||||||
EOAPI EFL_VOID_FUNC_BODY(efl_canvas_object_legacy_ctor)
|
EOAPI EFL_VOID_FUNC_BODY(efl_canvas_object_legacy_ctor)
|
||||||
|
|
|
@ -1209,6 +1209,7 @@ struct _Evas_Object_Protected_Data
|
||||||
} parent_cache;
|
} parent_cache;
|
||||||
|
|
||||||
Eina_Bool events_filter_enabled : 1;
|
Eina_Bool events_filter_enabled : 1;
|
||||||
|
Eina_Bool is_pointer_inside_legacy : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Evas_Data_Node
|
struct _Evas_Data_Node
|
||||||
|
|
Loading…
Reference in New Issue