Merge branch 'devs/iscaro/locks_and_mods'

This series add support to setting mode and properties
of mouse pointer, enabling key locks and modifiers per device
on Evas.

Also it fixes Ecore Input Evas keeping an evas device
on Ecore_Input_Last struct to separate event sources and
add support to lock / modifiers per seat.

With that, multiseat support should be complete up
to Evas layer.

Patches by Guilherme Iscaro <iscaro@profusion.mobi>
Differential Revision: https://phab.enlightenment.org/D4415

@feature
This commit is contained in:
Bruno Dilly 2016-12-02 09:58:18 -02:00
commit 5fdc93c02e
24 changed files with 1665 additions and 740 deletions

View File

@ -59,6 +59,9 @@ EAPI void ecore_event_window_ignore_events(Ecore_Window id, int ignore_even
EAPI void ecore_event_evas_modifier_lock_update(Evas *e, unsigned int modifiers);
EAPI void ecore_event_evas_seat_modifier_lock_update(Evas *e, unsigned int modifiers,
Evas_Device *seat); /**< @since 1.19 */
#ifdef ECORE_EVAS_INTERNAL
typedef Eina_Bool (*Ecore_Event_Direct_Input_Cb)(void *window, int type, const void *info);
EAPI void _ecore_event_window_direct_cb_set(Ecore_Window id, Ecore_Event_Direct_Input_Cb fptr);

View File

@ -47,6 +47,7 @@ struct _Ecore_Input_Last
{
Ecore_Event_Mouse_Button *ev;
Ecore_Timer *timer;
Evas_Device *evas_device;
unsigned int device;
unsigned int buttons;
@ -122,14 +123,16 @@ _ecore_event_last_check(Ecore_Event_Last *eel, Ecore_Event_Press press)
}
static Ecore_Event_Last *
_ecore_event_evas_lookup(unsigned int device, unsigned int buttons, Ecore_Window win, Eina_Bool create_new)
_ecore_event_evas_lookup(Evas_Device *evas_device, unsigned int device,
unsigned int buttons, Ecore_Window win,
Eina_Bool create_new)
{
Ecore_Event_Last *eel;
Eina_List *l;
//the number of last event is small, simple check is ok.
EINA_LIST_FOREACH(_last_events, l, eel)
if ((eel->device == device) && (eel->buttons == buttons))
if ((eel->device == device) && (eel->buttons == buttons) && (eel->evas_device == evas_device))
return eel;
if (!create_new) return NULL;
eel = malloc(sizeof (Ecore_Event_Last));
@ -142,6 +145,7 @@ _ecore_event_evas_lookup(unsigned int device, unsigned int buttons, Ecore_Window
eel->state = ECORE_INPUT_NONE;
eel->faked = EINA_FALSE;
eel->win = win;
eel->evas_device = evas_device;
_last_events = eina_list_append(_last_events, eel);
return eel;
@ -182,7 +186,7 @@ _ecore_event_evas_push_mouse_button(Ecore_Event_Mouse_Button *e, Ecore_Event_Pre
Ecore_Input_Action action = ECORE_INPUT_CONTINUE;
//_ecore_event_evas_mouse_button already check press or cancel without history
eel = _ecore_event_evas_lookup(e->multi.device, e->buttons, e->window, EINA_TRUE);
eel = _ecore_event_evas_lookup(e->dev, e->multi.device, e->buttons, e->window, EINA_TRUE);
if (!eel) return EINA_FALSE;
INF("dev(%d), button(%d), last_press(%d), press(%d)", e->multi.device, e->buttons, eel->state, press);
@ -274,50 +278,57 @@ _ecore_event_evas_push_mouse_move(Ecore_Event_Mouse_Move *e)
}
EAPI void
ecore_event_evas_modifier_lock_update(Evas *e, unsigned int modifiers)
ecore_event_evas_seat_modifier_lock_update(Evas *e, unsigned int modifiers,
Evas_Device *seat)
{
if (modifiers & ECORE_EVENT_MODIFIER_SHIFT)
evas_key_modifier_on(e, "Shift");
else evas_key_modifier_off(e, "Shift");
evas_seat_key_modifier_on(e, "Shift", seat);
else evas_seat_key_modifier_off(e, "Shift", seat);
if (modifiers & ECORE_EVENT_MODIFIER_CTRL)
evas_key_modifier_on(e, "Control");
else evas_key_modifier_off(e, "Control");
evas_seat_key_modifier_on(e, "Control", seat);
else evas_seat_key_modifier_off(e, "Control", seat);
if (modifiers & ECORE_EVENT_MODIFIER_ALT)
evas_key_modifier_on(e, "Alt");
else evas_key_modifier_off(e, "Alt");
evas_seat_key_modifier_on(e, "Alt", seat);
else evas_seat_key_modifier_off(e, "Alt", seat);
if (modifiers & ECORE_EVENT_MODIFIER_WIN)
{
evas_key_modifier_on(e, "Super");
evas_key_modifier_on(e, "Hyper");
evas_seat_key_modifier_on(e, "Super", seat);
evas_seat_key_modifier_on(e, "Hyper", seat);
}
else
{
evas_key_modifier_off(e, "Super");
evas_key_modifier_off(e, "Hyper");
evas_seat_key_modifier_off(e, "Super", seat);
evas_seat_key_modifier_off(e, "Hyper", seat);
}
if (modifiers & ECORE_EVENT_MODIFIER_ALTGR)
evas_key_modifier_on(e, "AltGr");
else evas_key_modifier_off(e, "AltGr");
evas_seat_key_modifier_on(e, "AltGr", seat);
else evas_seat_key_modifier_off(e, "AltGr", seat);
if (modifiers & ECORE_EVENT_LOCK_SCROLL)
evas_key_lock_on(e, "Scroll_Lock");
else evas_key_lock_off(e, "Scroll_Lock");
evas_seat_key_lock_on(e, "Scroll_Lock", seat);
else evas_seat_key_lock_off(e, "Scroll_Lock", seat);
if (modifiers & ECORE_EVENT_LOCK_NUM)
evas_key_lock_on(e, "Num_Lock");
else evas_key_lock_off(e, "Num_Lock");
evas_seat_key_lock_on(e, "Num_Lock", seat);
else evas_seat_key_lock_off(e, "Num_Lock", seat);
if (modifiers & ECORE_EVENT_LOCK_CAPS)
evas_key_lock_on(e, "Caps_Lock");
else evas_key_lock_off(e, "Caps_Lock");
evas_seat_key_lock_on(e, "Caps_Lock", seat);
else evas_seat_key_lock_off(e, "Caps_Lock", seat);
if (modifiers & ECORE_EVENT_LOCK_SHIFT)
evas_key_lock_on(e, "Shift_Lock");
else evas_key_lock_off(e, "Shift_Lock");
evas_seat_key_lock_on(e, "Shift_Lock", seat);
else evas_seat_key_lock_off(e, "Shift_Lock", seat);
}
EAPI void
ecore_event_evas_modifier_lock_update(Evas *e, unsigned int modifiers)
{
ecore_event_evas_seat_modifier_lock_update(e, modifiers, NULL);
}
EAPI void
@ -408,7 +419,9 @@ _ecore_event_evas_key(Ecore_Event_Key *e, Ecore_Event_Press press)
lookup = _ecore_event_window_match(e->event_window);
if (!lookup) return ECORE_CALLBACK_PASS_ON;
ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers);
ecore_event_evas_seat_modifier_lock_update(lookup->evas,
e->modifiers,
efl_input_device_seat_get(e->dev));
if (press == ECORE_DOWN)
{
if (!lookup->direct ||
@ -491,7 +504,7 @@ _ecore_event_evas_mouse_button(Ecore_Event_Mouse_Button *e, Ecore_Event_Press pr
if (press != ECORE_DOWN)
{
//ECORE_UP or ECORE_CANCEL
eel = _ecore_event_evas_lookup(e->multi.device, e->buttons, e->window, EINA_FALSE);
eel = _ecore_event_evas_lookup(e->dev, e->multi.device, e->buttons, e->window, EINA_FALSE);
if (!eel)
{
WRN("ButtonEvent has no history.");
@ -517,7 +530,9 @@ _ecore_event_evas_mouse_button(Ecore_Event_Mouse_Button *e, Ecore_Event_Press pr
if (e->multi.device == 0)
{
ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers);
ecore_event_evas_seat_modifier_lock_update(lookup->evas,
e->modifiers,
efl_input_device_seat_get(e->dev));
if (press == ECORE_DOWN)
{
if (!lookup->direct ||
@ -597,7 +612,9 @@ ecore_event_evas_mouse_move(void *data EINA_UNUSED, int type EINA_UNUSED, void *
if (e->multi.device == 0)
{
_ecore_event_evas_push_mouse_move(e);
ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers);
ecore_event_evas_seat_modifier_lock_update(lookup->evas,
e->modifiers,
efl_input_device_seat_get(e->dev));
if (!lookup->direct ||
!lookup->direct(lookup->window, ECORE_EVENT_MOUSE_MOVE, e))
{
@ -656,7 +673,9 @@ _ecore_event_evas_mouse_io(Ecore_Event_Mouse_IO *e, Ecore_Event_IO io)
lookup = _ecore_event_window_match(e->event_window);
if (!lookup) return ECORE_CALLBACK_PASS_ON;
ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers);
ecore_event_evas_seat_modifier_lock_update(lookup->evas,
e->modifiers,
efl_input_device_seat_get(e->dev));
switch (io)
{
case ECORE_IN:
@ -702,7 +721,8 @@ ecore_event_evas_mouse_wheel(void *data EINA_UNUSED, int type EINA_UNUSED, void
e = event;
lookup = _ecore_event_window_match(e->event_window);
if (!lookup) return ECORE_CALLBACK_PASS_ON;
ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers);
ecore_event_evas_seat_modifier_lock_update(lookup->evas, e->modifiers,
efl_input_device_seat_get(e->dev));
if (!lookup->direct ||
!lookup->direct(lookup->window, ECORE_EVENT_MOUSE_WHEEL, e))
{

View File

@ -3449,7 +3449,7 @@ EAPI void evas_language_reinit(void);
* @{
*/
/**
* Checks the state of a given modifier key, at the time of the
* Checks the state of a given modifier of the default seat, at the time of the
* call. If the modifier is set, such as shift being pressed, this
* function returns @c Eina_True.
*
@ -3465,11 +3465,35 @@ EAPI void evas_language_reinit(void);
* @see evas_key_modifier_get
* @see evas_key_modifier_on
* @see evas_key_modifier_off
* @see evas_seat_key_modifier_is_set
*/
EAPI Eina_Bool evas_key_modifier_is_set(const Evas_Modifier *m, const char *keyname) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1, 2);
/**
* Checks the state of a given lock key, at the time of the call. If
* Checks the state of a given modifier key of a given seat, at the time of the
* call. If the modifier is set, such as shift being pressed, this
* function returns @c Eina_True.
*
* @param m The current modifiers set, as returned by
* evas_key_modifier_get().
* @param keyname The name of the modifier key to check status for.
* @param seat The seat to check if the lock is set. Use @c NULL for the default seat.
*
* @return @c Eina_True if the modifier key named @p keyname is on, @c
* Eina_False otherwise.
*
* @see evas_key_modifier_add
* @see evas_key_modifier_del
* @see evas_key_modifier_get
* @see evas_key_modifier_on
* @see evas_key_modifier_off
* @see evas_seat_key_modifier_on
* @see evas_seat_key_modifier_off
* @see evas_key_modifier_is_set
* @since 1.19
*/
EAPI Eina_Bool evas_seat_key_modifier_is_set(const Evas_Modifier *m, const char *keyname, const Evas_Device *seat) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1, 2);
/**
* Checks the state of a given lock key of the default seat, at the time of the call. If
* the lock is set, such as caps lock, this function returns @c
* Eina_True.
*
@ -3484,9 +3508,34 @@ EAPI Eina_Bool evas_key_modifier_is_set(const Evas_Modifier *m, const
* @see evas_key_lock_del
* @see evas_key_lock_on
* @see evas_key_lock_off
* @see evas_seat_key_lock_on
* @see evas_seat_key_lock_off
* @see evas_seat_key_lock_is_set
*/
EAPI Eina_Bool evas_key_lock_is_set(const Evas_Lock *l, const char *keyname) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1, 2);
/**
* Checks the state of a given lock key of a given seat, at the time of the call. If
* the lock is set, such as caps lock, this function returns @c
* Eina_True.
*
* @param l The current locks set, as returned by evas_key_lock_get().
* @param keyname The name of the lock key to check status for.
* @param seat The seat to check if the lock is set. Use @c NULL for the default seat.
*
* @return @c Eina_True if the @p keyname lock key is set, @c
* Eina_False otherwise.
*
* @see evas_key_lock_get
* @see evas_key_lock_add
* @see evas_key_lock_del
* @see evas_key_lock_on
* @see evas_key_lock_off
* @see evas_key_lock_is_set
* @since 1.19
*/
EAPI Eina_Bool evas_seat_key_lock_is_set(const Evas_Lock *l, const char *keyname, const Evas_Device *seat) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1, 2);
/**
* @}
*/

View File

@ -21,6 +21,18 @@ abstract Efl.Canvas.Object (Efl.Object, Efl.Gfx, Efl.Gfx.Stack, Efl.Animator,
type: string; [[The type of the object.]]
}
}
@property pointer_mode_by_device {
[[Low-level pointer behaviour by device.
See @.pointer_mode.get and @.pointer_mode.set for more explanation.
@since 1.19
]]
keys {
dev: Efl.Input.Device; [[The pointer device to set/get the mode. Use $null for the default pointer.]]
}
values {
pointer_mode: Efl.Input.Object_Pointer_Mode; [[The pointer mode]]
}
}
@property pointer_mode {
[[Low-level pointer behaviour.
@ -37,6 +49,8 @@ abstract Efl.Canvas.Object (Efl.Object, Efl.Gfx, Efl.Gfx.Stack, Efl.Animator,
will be emitted just when inside this object area.
The default value is @Efl.Input.Object_Pointer_Mode.auto_grab.
See also: @.pointer_mode_by_device.get and @.pointer_mode_by_device.set
Note: This function will only set/get the mode for the default pointer.
]]
values {
pointer_mode: Efl.Input.Object_Pointer_Mode; [[Input pointer mode]]
@ -47,7 +61,7 @@ abstract Efl.Canvas.Object (Efl.Object, Efl.Gfx, Efl.Gfx.Stack, Efl.Animator,
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.
pointer,in in a row. See algo @.pointer_device_in.get
@since 1.19
]]
@ -56,6 +70,23 @@ abstract Efl.Canvas.Object (Efl.Object, Efl.Gfx, Efl.Gfx.Stack, Efl.Animator,
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 {}
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 {
[[Render mode to be used for compositing the Evas object.

View File

@ -242,15 +242,22 @@ _efl_input_key_efl_input_event_device_get(Eo *obj EINA_UNUSED, Efl_Input_Key_Dat
EOLIAN static Eina_Bool
_efl_input_key_efl_input_state_modifier_enabled_get(Eo *obj EINA_UNUSED, Efl_Input_Key_Data *pd, const char * name)
{
Efl_Input_Device *seat;
if (!pd->modifiers) return EINA_FALSE;
return evas_key_modifier_is_set(pd->modifiers, name);
seat = efl_input_device_seat_get(pd->device);
if (!seat) return EINA_FALSE;
return evas_seat_key_modifier_is_set(pd->modifiers, name, seat);
}
EOLIAN static Eina_Bool
_efl_input_key_efl_input_state_lock_enabled_get(Eo *obj EINA_UNUSED, Efl_Input_Key_Data *pd, const char * name)
{
Efl_Input_Device *seat;
if (!pd->locks) return EINA_FALSE;
return evas_key_lock_is_set(pd->locks, name);
seat = efl_input_device_seat_get(pd->device);
if (!seat) return EINA_FALSE;
return evas_seat_key_lock_is_set(pd->locks, name, seat);
}
EOLIAN static Eina_Bool

View File

@ -325,15 +325,23 @@ _efl_input_pointer_tool_set(Eo *obj EINA_UNUSED, Efl_Input_Pointer_Data *pd, int
EOLIAN static Eina_Bool
_efl_input_pointer_efl_input_state_modifier_enabled_get(Eo *obj EINA_UNUSED, Efl_Input_Pointer_Data *pd, const char *name)
{
Efl_Input_Device *seat;
if (!pd->modifiers) return EINA_FALSE;
return evas_key_modifier_is_set(pd->modifiers, name);
seat = efl_input_device_seat_get(pd->device);
if (!seat) return EINA_FALSE;
return evas_seat_key_modifier_is_set(pd->modifiers, name, seat);
}
EOLIAN static Eina_Bool
_efl_input_pointer_efl_input_state_lock_enabled_get(Eo *obj EINA_UNUSED, Efl_Input_Pointer_Data *pd, const char *name)
{
Efl_Input_Device *seat;
if (!pd->locks) return EINA_FALSE;
return evas_key_lock_is_set(pd->locks, name);
seat = efl_input_device_seat_get(pd->device);
if (!seat) return EINA_FALSE;
return evas_seat_key_lock_is_set(pd->locks, name, seat);
}
EOLIAN static void

View File

@ -207,13 +207,24 @@ class Evas.Canvas (Efl.Object, Efl.Canvas, Efl.Animator, Efl.Input.Interface)
]]
return: ptr(const(Evas.Lock)) @warn_unused; [[
An Evas_Lock handle to query Evas' keys subsystem with
\@ref evas_key_lock_is_set, or $null on error.
\@ref evas_key_lock_is_set or \@ref evas_seat_key_lock_is_set, or $null on error.
]]
}
}
@property pointer_canvas_xy_by_device {
[[This function returns the current known default pointer coordinates. @since 1.19]]
get {}
keys {
dev: Efl.Input.Device; [[The pointer device.]]
}
values {
x: Evas.Coord; [[The pointer to a Evas_Coord to be filled in.]]
y: Evas.Coord; [[The pointer to a Evas_Coord to be filled in.]]
}
}
@property pointer_canvas_xy {
get {
[[This function returns the current known pointer coordinates
[[This function returns the current known default pointer coordinates
This function returns the current known canvas unit
coordinates of the mouse pointer and sets the contents of
@ -291,9 +302,20 @@ class Evas.Canvas (Efl.Object, Efl.Canvas, Efl.Animator, Efl.Input.Interface)
return: bool; [[$true if changed, $false otherwise]]
}
}
@property pointer_output_xy_by_device {
[[This function returns the current known pointer coordinates. @since 1.19]]
get {}
keys {
dev: Efl.Input.Device; [[The mouse device.]]
}
values {
x: int; [[The pointer to an integer to be filled in.]]
y: int; [[The pointer to an integer to be filled in.]]
}
}
@property pointer_output_xy {
get {
[[This function returns the current known pointer coordinates.
[[This function returns the current known default pointer coordinates.
This function returns the current known screen/output
coordinates of the mouse pointer and sets the contents of
@ -317,9 +339,20 @@ class Evas.Canvas (Efl.Object, Efl.Canvas, Efl.Animator, Efl.Input.Interface)
y: int; [[The pointer to an integer to be filled in.]]
}
}
@property pointer_inside_by_device {
[[Returns whether the mouse pointer is logically inside the
canvas. @since 1.19]]
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 mouse pointer is logically inside the
[[Returns whether the default mouse pointer is logically inside the
canvas.
When this function is called it will return a value of either
@ -397,17 +430,29 @@ class Evas.Canvas (Efl.Object, Efl.Canvas, Efl.Animator, Efl.Input.Interface)
given time with the \@ref evas_key_modifier_is_set function.
See also @.key_modifier_add, @.key_modifier_del,
@.key_modifier_on, @.key_modifier_off.
@.key_modifier_on, @.key_modifier_off, @.seat_key_modifier_on,
@.seat_key_modifier_off.
]]
return: ptr(const(Evas.Modifier)) @warn_unused; [[
An Evas_Modifier handle to query Evas' keys subsystem
with \@ref evas_key_modifier_is_set, or $null on error.
with \@ref evas_key_modifier_is_set or \@ref evas_seat_key_modifier_is_set, or $null on error.
]]
}
}
@property pointer_button_down_mask_by_device {
[[Returns a bitmask with the mouse buttons currently pressed,
set to 1.]]
keys {
dev: Efl.Input.Device; [[The mouse device.]]
}
get {}
values {
mask: uint; [[A bitmask of the currently depressed buttons on the canvas.]]
}
}
@property pointer_button_down_mask {
get {
[[Returns a bitmask with the mouse buttons currently pressed,
[[Returns a bitmask with the default mouse buttons currently pressed,
set to 1.
Calling this function will return a 32-bit integer with the
@ -463,18 +508,49 @@ class Evas.Canvas (Efl.Object, Efl.Canvas, Efl.Animator, Efl.Input.Interface)
}
key_lock_on {
[[Enables or turns on programmatically the lock key with name
$keyname.
$keyname for the default seat.
The effect will be as if the key was put on its active state
after this call.
See also @.key_lock_add, @.key_lock_del, @.key_lock_del,
@.key_lock_off.
See also @.key_lock_add, @.key_lock_del, @.key_lock_del,
@.key_lock_off, @.seat_key_lock_on, @.seat_key_lock_off.
]]
params {
@in keyname: string @nonull; [[The name of the lock to enable.]]
}
}
seat_key_lock_on {
[[Enables or turns on programmatically the lock key with name
$keyname for a give seat.
The effect will be as if the key was put on its active state
after this call.
See also @.key_lock_add, @.key_lock_del, @.key_lock_del,
@.key_lock_off, @.key_lock_on, @.seat_key_lock_off.
@since 1.19
]]
params {
@in keyname: string @nonull; [[The name of the lock to enable.]]
@in seat: Efl.Input.Device; [[The seat to enable the keylock. A $null seat repesents the default seat.]]
}
}
seat_key_lock_off {
[[Disables or turns off programmatically the lock key with name
$keyname for a given seat.
The effect will be as if the key was put on its inactive state
after this call.
See also @.key_lock_on, @.seat_key_lock_on, @.key_lock_off.
@since 1.19
]]
params {
@in keyname: string @nonull; [[The name of the lock to enable.]]
@in seat: Efl.Input.Device; [[The seat to disable the keylock. A $null seat repesents the default seat.]]
}
}
key_modifier_mask_get @const {
[[Creates a bit mask from the $keyname modifier key. Values
returned from different calls to it may be ORed together,
@ -485,8 +561,8 @@ class Evas.Canvas (Efl.Object, Efl.Canvas, Efl.Animator, Efl.Input.Interface)
Go check their documentation for more information.
See also @.key_modifier_add, \@ref evas_key_modifier_get,
@.key_modifier_on, @.key_modifier_off,
\@ref evas_key_modifier_is_set.
@.key_modifier_on, @.key_modifier_off, @.seat_key_modifier_on, @.seat_key_modifier_off,
\@ref evas_key_modifier_is_set, \@ref evas_seat_key_modifier_is_set..
]]
return: Evas.Modifier_Mask @warn_unused; [[
The bit mask or 0 if the $keyname key wasn't registered as a
@ -524,11 +600,11 @@ class Evas.Canvas (Efl.Object, Efl.Canvas, Efl.Animator, Efl.Input.Interface)
}
key_modifier_off {
[[Disables or turns off programmatically the modifier key with
name $keyname.
name $keyname for the default seat.
See also @.key_modifier_add, \@ref evas_key_modifier_get,
@.key_modifier_on, @.key_modifier_mask_get,
\@ref evas_key_modifier_is_set.
@.key_modifier_on, @.key_modifier_mask_get, @.seat_key_modifier_off,
@.seat_key_modifier_off, \@ref evas_key_modifier_is_set, \@ref evas_seat_key_modifier_is_set.
]]
params {
@in keyname: string @nonull; [[The name of the modifier to disable.]]
@ -644,12 +720,12 @@ class Evas.Canvas (Efl.Object, Efl.Canvas, Efl.Animator, Efl.Input.Interface)
}
key_lock_off {
[[Disables or turns off programmatically the lock key with name
$keyname.
$keyname for the default seat.
The effect will be as if the key was put on its inactive state
after this call.
See also @.key_lock_on.
See also @.key_lock_on, @.seat_key_lock_on, @.seat_key_lock_off.
]]
params {
@in keyname: string @nonull; [[The name of the lock to disable.]]
@ -709,17 +785,48 @@ class Evas.Canvas (Efl.Object, Efl.Canvas, Efl.Animator, Efl.Input.Interface)
}
key_modifier_on {
[[Enables or turns on programmatically the modifier key with name
$keyname.
$keyname for the default seat.
The effect will be as if the key was pressed for the whole time
between this call and a matching evas_key_modifier_off().
See also @.key_modifier_off.
See also @.key_modifier_off, @.seat_key_modifier_on,
@.seat_key_modifier_off.
]]
params {
@in keyname: string @nonull; [[The name of the modifier to enable.]]
}
}
seat_key_modifier_on {
[[Enables or turns on programmatically the modifier key with name
$keyname for a given seat.
The effect will be as if the key was pressed for the whole time
between this call and a matching @.seat_key_modifier_off.
See also @.key_modifier_off, @.seat_key_modifier_on,
@.seat_key_modifier_off.
@since 1.19
]]
params {
@in keyname: string @nonull; [[The name of the lock to enable.]]
@in seat: Efl.Input.Device; [[The seat to enable the modifier. A $null seat repesents the default seat.]]
}
}
seat_key_modifier_off {
[[Disables or turns off programmatically the modifier key with
name $keyname for a given seat.
See also @.key_modifier_add, \@ref evas_key_modifier_get,
@.key_modifier_on, @.key_modifier_mask_get, @.seat_key_modifier_off,
@.seat_key_modifier_off, \@ref evas_key_modifier_is_set, \@ref evas_seat_key_modifier_is_set.
@since 1.19
]]
params {
@in keyname: string @nonull; [[The name of the lock to enable.]]
@in seat: Efl.Input.Device; [[The seat to disable the modifier. A $null seat repesents the default seat.]]
}
}
font_available_list @const {
[[List of available font descriptions known or found by this evas.

View File

@ -396,14 +396,11 @@ _efl_canvas_object_clip_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, Evas_Ob
if ((!obj->is_smart) &&
(!((obj->map->cur.map) && (obj->map->cur.usemap))))
{
if (evas_object_is_in_output_rect(eo_obj, obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1))
evas_event_feed_mouse_move(obj->layer->evas->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
obj->layer->evas->last_timestamp,
NULL);
_evas_canvas_event_pointer_in_rect_mouse_move_feed(obj->layer->evas,
eo_obj,
obj, 1, 1,
EINA_FALSE,
NULL);
}
evas_object_clip_across_check(eo_obj, obj);
}
@ -447,14 +444,11 @@ _clip_unset(Eo *eo_obj, Evas_Object_Protected_Data *obj)
if ((!obj->is_smart) &&
(!((obj->map->cur.map) && (obj->map->cur.usemap))))
{
if (evas_object_is_in_output_rect(eo_obj, obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1))
evas_event_feed_mouse_move(obj->layer->evas->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
obj->layer->evas->last_timestamp,
NULL);
_evas_canvas_event_pointer_in_rect_mouse_move_feed(obj->layer->evas,
eo_obj,
obj, 1, 1,
EINA_FALSE,
NULL);
}
evas_object_clip_across_check(eo_obj, obj);
}

View File

@ -29,8 +29,9 @@ _is_pointer(Evas_Device_Class clas)
{
if (clas == EVAS_DEVICE_CLASS_MOUSE ||
clas == EVAS_DEVICE_CLASS_TOUCH ||
clas == EVAS_DEVICE_CLASS_WAND ||
clas == EVAS_DEVICE_CLASS_PEN)
clas == EVAS_DEVICE_CLASS_PEN ||
clas == EVAS_DEVICE_CLASS_POINTER ||
clas == EVAS_DEVICE_CLASS_WAND)
return EINA_TRUE;
return EINA_FALSE;
}
@ -86,6 +87,9 @@ _del_cb(void *data, const Efl_Event *ev)
else if (e->default_keyboard == ev->object)
e->default_keyboard = _new_default_device_find(e, ev->object);
_evas_pointer_data_remove(e, ev->object);
eina_hash_del_by_key(e->locks.masks, &ev->object);
eina_hash_del_by_key(e->modifiers.masks, &ev->object);
efl_event_callback_call(e->evas, EFL_CANVAS_EVENT_DEVICE_REMOVED,
ev->object);
}
@ -128,8 +132,17 @@ evas_device_add_full(Evas *eo_e, const char *name, const char *desc,
e->default_seat = dev;
else if (!e->default_keyboard && clas == EVAS_DEVICE_CLASS_KEYBOARD)
e->default_keyboard = dev;
else if (!e->default_mouse && _is_pointer(clas))
e->default_mouse = dev;
else if (_is_pointer(clas))
{
if (!_evas_pointer_data_add(e, dev))
{
efl_del(dev);
return NULL;
}
if (!e->default_mouse)
e->default_mouse = dev;
}
e->devices = eina_list_append(e->devices, dev);
efl_event_callback_add(dev, EFL_EVENT_DEL, _del_cb, e);
@ -255,8 +268,19 @@ evas_device_class_set(Evas_Device *dev, Evas_Device_Class clas)
SAFETY_CHECK(dev, EFL_INPUT_DEVICE_CLASS);
Efl_Input_Device_Data *d = efl_data_scope_get(dev, EFL_INPUT_DEVICE_CLASS);
Evas_Public_Data *edata = efl_data_scope_get(d->evas, EVAS_CANVAS_CLASS);
if (d->klass == clas)
return;
if (_is_pointer(d->klass))
_evas_pointer_data_remove(edata, dev);
efl_input_device_type_set(dev, clas);
if (_is_pointer(clas))
_evas_pointer_data_add(edata, dev);
evas_event_callback_call(d->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
}

File diff suppressed because it is too large Load Diff

View File

@ -37,12 +37,16 @@ efl_input_pointer_legacy_info_fill(Evas *eo_evas, Efl_Input_Key *eo_ev, Evas_Cal
{
Efl_Input_Pointer_Data *ev = efl_data_scope_get(eo_ev, EFL_INPUT_POINTER_CLASS);
Evas_Public_Data *evas = efl_data_scope_get(eo_evas, EVAS_CANVAS_CLASS);
Evas_Pointer_Data *pdata;
if (!ev || !evas) return NULL;
#define COORD_DUP(e) do { (e)->output.x = evas->pointer.x; (e)->output.y = evas->pointer.y; } while (0)
#define COORD_DUP_CUR(e) do { (e)->cur.output.x = evas->pointer.x; (e)->cur.output.y = evas->pointer.y; } while (0)
#define COORD_DUP_PREV(e) do { (e)->prev.output.x = evas->pointer.prev.x; (e)->prev.output.y = evas->pointer.prev.y; } while (0)
pdata = _evas_pointer_data_by_device_get(evas, ev->device);
EINA_SAFETY_ON_NULL_RETURN_VAL(pdata, NULL);
#define COORD_DUP(e) do { (e)->output.x = pdata->x; (e)->output.y = pdata->y; } while (0)
#define COORD_DUP_CUR(e) do { (e)->cur.output.x = pdata->x; (e)->cur.output.y = pdata->y; } while (0)
#define COORD_DUP_PREV(e) do { (e)->prev.output.x = pdata->prev.x; (e)->prev.output.y = pdata->prev.y; } while (0)
#define TYPE_CHK(typ) do { if (type != EVAS_CALLBACK_ ## typ) return NULL; } while (0)
switch (ev->action)

View File

@ -43,38 +43,55 @@ _evas_canvas_key_lock_get(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e)
return &(e->locks);
}
EAPI Eina_Bool
evas_key_modifier_is_set(const Evas_Modifier *m, const char *keyname)
static Eina_Bool
_key_is_set(int n, Eina_Hash *masks, const Evas_Device *seat)
{
Evas_Modifier_Mask num;
int n;
Evas_Modifier_Mask num, *seat_mask;
if (!m) return 0;
if (!keyname) return 0;
n = evas_key_modifier_number(m, keyname);
if (n < 0) return 0;
else if (n >= 64) return 0;
num = (Evas_Modifier_Mask)n;
num = 1ULL << num;
if (m->mask & num) return 1;
seat_mask = eina_hash_find(masks, &seat);
if (!seat_mask) return 0;
if (*seat_mask & num) return 1;
return 0;
}
EAPI Eina_Bool
evas_seat_key_modifier_is_set(const Evas_Modifier *m, const char *keyname,
const Evas_Device *seat)
{
if (!seat)
seat = m->e->default_seat;
EINA_SAFETY_ON_NULL_RETURN_VAL(seat, 0);
if (!m) return 0;
if (!keyname) return 0;
return _key_is_set(evas_key_modifier_number(m, keyname), m->masks, seat);
}
EAPI Eina_Bool
evas_key_modifier_is_set(const Evas_Modifier *m, const char *keyname)
{
return evas_seat_key_modifier_is_set(m, keyname, NULL);
}
EAPI Eina_Bool
evas_key_lock_is_set(const Evas_Lock *l, const char *keyname)
{
Evas_Modifier_Mask num;
int n;
return evas_seat_key_lock_is_set(l, keyname, NULL);
}
EAPI Eina_Bool
evas_seat_key_lock_is_set(const Evas_Lock *l, const char *keyname,
const Evas_Device *seat)
{
if (!seat)
seat = l->e->default_seat;
EINA_SAFETY_ON_NULL_RETURN_VAL(seat, 0);
if (!l) return 0;
if (!keyname) return 0;
n = evas_key_lock_number(l, keyname);
if (n < 0) return 0;
else if (n >= 64) return 0;
num = (Evas_Modifier_Mask)n;
num = 1ULL << num;
if (l->mask & num) return 1;
return 0;
return _key_is_set(evas_key_lock_number(l, keyname), l->masks, seat);
}
EOLIAN void
@ -86,7 +103,7 @@ _evas_canvas_key_modifier_add(Eo *eo_e, Evas_Public_Data *e, const char *keyname
e->modifiers.mod.count++;
e->modifiers.mod.list = realloc(e->modifiers.mod.list, e->modifiers.mod.count * sizeof(char *));
e->modifiers.mod.list[e->modifiers.mod.count - 1] = strdup(keyname);
e->modifiers.mask = 0;
eina_hash_free_buckets(e->modifiers.masks);
}
EOLIAN void
@ -105,7 +122,7 @@ _evas_canvas_key_modifier_del(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, const c
e->modifiers.mod.count--;
for (j = i; j < e->modifiers.mod.count; j++)
e->modifiers.mod.list[j] = e->modifiers.mod.list[j + 1];
e->modifiers.mask = 0;
eina_hash_free_buckets(e->modifiers.masks);
return;
}
}
@ -120,7 +137,7 @@ _evas_canvas_key_lock_add(Eo *eo_e, Evas_Public_Data *e, const char *keyname)
e->locks.lock.count++;
e->locks.lock.list = realloc(e->locks.lock.list, e->locks.lock.count * sizeof(char *));
e->locks.lock.list[e->locks.lock.count - 1] = strdup(keyname);
e->locks.mask = 0;
eina_hash_free_buckets(e->locks.masks);
}
EOLIAN void
@ -128,7 +145,6 @@ _evas_canvas_key_lock_del(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, const char
{
int i;
if (!keyname) return;
e->locks.mask = 0;
for (i = 0; i < e->locks.lock.count; i++)
{
if (!strcmp(e->locks.lock.list[i], keyname))
@ -139,58 +155,110 @@ _evas_canvas_key_lock_del(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, const char
e->locks.lock.count--;
for (j = i; j < e->locks.lock.count; j++)
e->locks.lock.list[j] = e->locks.lock.list[j + 1];
e->locks.mask = 0;
eina_hash_free_buckets(e->locks.masks);
return;
}
}
}
EOLIAN void
_evas_canvas_key_modifier_on(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, const char *keyname)
static void
_mask_set(int n, Eina_Hash *masks, Efl_Input_Device *seat, Eina_Bool add)
{
Evas_Modifier_Mask *current_mask;
Evas_Modifier_Mask num;
int n;
n = (Evas_Modifier_Mask)evas_key_modifier_number(&(e->modifiers), keyname);
if (n < 0 || n > 63) return;
num = 1ULL << n;
e->modifiers.mask |= num;
current_mask = eina_hash_find(masks, &seat);
if (add)
{
if (!current_mask)
{
current_mask = calloc(1, sizeof(Evas_Modifier_Mask));
EINA_SAFETY_ON_NULL_RETURN(current_mask);
eina_hash_add(masks, &seat, current_mask);
}
*current_mask |= num;
}
else
{
if (!current_mask) return;
*current_mask &= ~num;
if (!(*current_mask))
eina_hash_del_by_key(masks, &seat);
}
}
EOLIAN void
_evas_canvas_key_modifier_off(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, const char *keyname)
_evas_canvas_seat_key_modifier_on(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e,
const char *keyname, Efl_Input_Device *seat)
{
Evas_Modifier_Mask num;
int n;
n = evas_key_modifier_number(&(e->modifiers), keyname);
if (n < 0 || n > 63) return;
num = 1ULL << n;
e->modifiers.mask &= ~num;
if (!seat)
seat = e->default_seat;
EINA_SAFETY_ON_NULL_RETURN(seat);
if (efl_input_device_type_get(seat) != EFL_INPUT_DEVICE_CLASS_SEAT) return;
_mask_set(evas_key_modifier_number(&(e->modifiers), keyname),
e->modifiers.masks, seat, EINA_TRUE);
}
EOLIAN void
_evas_canvas_key_lock_on(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, const char *keyname)
_evas_canvas_seat_key_modifier_off(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e,
const char *keyname, Efl_Input_Device *seat)
{
Evas_Modifier_Mask num;
int n;
n = evas_key_lock_number(&(e->locks), keyname);
if (n < 0 || n > 63) return;
num = 1ULL << n;
e->locks.mask |= num;
if (!seat)
seat = e->default_seat;
EINA_SAFETY_ON_NULL_RETURN(seat);
_mask_set(evas_key_modifier_number(&(e->modifiers), keyname),
e->modifiers.masks, seat, EINA_FALSE);
}
EOLIAN void
_evas_canvas_key_lock_off(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, const char *keyname)
_evas_canvas_key_modifier_on(Eo *eo_e, Evas_Public_Data *e, const char *keyname)
{
Evas_Modifier_Mask num;
int n;
_evas_canvas_seat_key_modifier_on(eo_e, e, keyname, NULL);
}
n = evas_key_lock_number(&(e->locks), keyname);
if (n < 0 || n > 63) return;
num = 1ULL << n;
e->locks.mask &= ~num;
EOLIAN void
_evas_canvas_key_modifier_off(Eo *eo_e, Evas_Public_Data *e,
const char *keyname)
{
_evas_canvas_seat_key_modifier_off(eo_e, e, keyname, NULL);
}
EOLIAN void
_evas_canvas_seat_key_lock_on(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e,
const char *keyname, Efl_Input_Device *seat)
{
if (!seat)
seat = e->default_seat;
EINA_SAFETY_ON_NULL_RETURN(seat);
if (efl_input_device_type_get(seat) != EFL_INPUT_DEVICE_CLASS_SEAT) return;
_mask_set(evas_key_lock_number(&(e->locks), keyname), e->locks.masks,
seat, EINA_TRUE);
}
EOLIAN void
_evas_canvas_seat_key_lock_off(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e,
const char *keyname, Efl_Input_Device *seat)
{
if (!seat)
seat = e->default_seat;
EINA_SAFETY_ON_NULL_RETURN(seat);
_mask_set(evas_key_lock_number(&(e->locks), keyname), e->locks.masks,
seat, EINA_FALSE);
}
EOLIAN void
_evas_canvas_key_lock_on(Eo *eo_e, Evas_Public_Data *e, const char *keyname)
{
_evas_canvas_seat_key_lock_on(eo_e, e, keyname, NULL);
}
EOLIAN void
_evas_canvas_key_lock_off(Eo *eo_e, Evas_Public_Data *e, const char *keyname)
{
_evas_canvas_seat_key_lock_off(eo_e, e, keyname, NULL);
}
/* errr need to add key grabbing/ungrabbing calls - missing modifier stuff. */

View File

@ -248,18 +248,11 @@ _efl_canvas_object_efl_gfx_stack_layer_set(Eo *eo_obj,
return;
}
evas_object_change(eo_obj, obj);
if (!obj->is_smart)
if (!obj->is_smart && obj->cur->visible)
{
if (evas_object_is_in_output_rect(eo_obj, obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1) &&
obj->cur->visible)
if (eina_list_data_find(obj->layer->evas->pointer.object.in, obj))
evas_event_feed_mouse_move(obj->layer->evas->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
obj->layer->evas->last_timestamp,
NULL);
_evas_canvas_event_pointer_in_rect_mouse_move_feed(obj->layer->evas, eo_obj, obj,
1, 1, EINA_TRUE,
NULL);
}
else
{

View File

@ -191,6 +191,12 @@ evas_new(void)
return eo_obj;
}
static void
_evas_key_mask_free(void *data)
{
free(data);
}
EOLIAN static Eo *
_evas_canvas_efl_object_constructor(Eo *eo_obj, Evas_Public_Data *e)
{
@ -239,6 +245,9 @@ _evas_canvas_efl_object_constructor(Eo *eo_obj, Evas_Public_Data *e)
_evas_canvas_event_init(eo_obj, e);
e->focused_objects = eina_hash_pointer_new(NULL);
e->locks.masks = eina_hash_pointer_new(_evas_key_mask_free);
e->modifiers.masks = eina_hash_pointer_new(_evas_key_mask_free);
e->locks.e = e->modifiers.e = e;
return eo_obj;
}
@ -262,6 +271,7 @@ _evas_canvas_efl_object_destructor(Eo *eo_e, Evas_Public_Data *e)
Evas_Out *evo;
int i;
Eina_Bool del;
Evas_Pointer_Data *pdata;
evas_canvas_async_block(e);
if (e->walking_list == 0) evas_render_idle_flush(eo_e);
@ -320,7 +330,6 @@ _evas_canvas_efl_object_destructor(Eo *eo_e, Evas_Public_Data *e)
e->walking_list--;
evas_font_path_clear(eo_e);
e->pointer.object.in = eina_list_free(e->pointer.object.in);
if (e->name_hash) eina_hash_free(e->name_hash);
e->name_hash = NULL;
@ -378,8 +387,16 @@ _evas_canvas_efl_object_destructor(Eo *eo_e, Evas_Public_Data *e)
_evas_device_cleanup(eo_e);
e->focused_by = eina_list_free(e->focused_by);
EINA_LIST_FREE(e->pointers, pdata)
{
eina_list_free(pdata->object.in);
free(pdata);
}
eina_lock_free(&(e->lock_objects));
eina_spinlock_free(&(e->render.lock));
eina_hash_free(e->locks.masks);
eina_hash_free(e->modifiers.masks);
e->magic = 0;
efl_destructor(efl_super(eo_e, MY_CLASS));
@ -501,29 +518,88 @@ evas_object_image_extension_can_load_fast_get(const char *file)
}
EOLIAN static void
_evas_canvas_pointer_output_xy_get(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, int *x, int *y)
_evas_canvas_pointer_output_xy_by_device_get(Eo *eo_e EINA_UNUSED,
Evas_Public_Data *e,
Efl_Input_Device *dev,
int *x, int *y)
{
if (x) *x = e->pointer.x;
if (y) *y = e->pointer.y;
Evas_Pointer_Data *pdata = _evas_pointer_data_by_device_get(e, dev);
if (!pdata)
{
if (x) *x = 0;
if (y) *y = 0;
}
else
{
if (x) *x = pdata->x;
if (y) *y = pdata->y;
}
}
EOLIAN static void
_evas_canvas_pointer_canvas_xy_get(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, Evas_Coord *x, Evas_Coord *y)
_evas_canvas_pointer_canvas_xy_by_device_get(Eo *eo_e EINA_UNUSED,
Evas_Public_Data *e,
Efl_Input_Device *dev,
int *x, int *y)
{
if (x) *x = e->pointer.x;
if (y) *y = e->pointer.y;
Evas_Pointer_Data *pdata = _evas_pointer_data_by_device_get(e, dev);
if (!pdata)
{
if (x) *x = 0;
if (y) *y = 0;
}
else
{
if (x) *x = pdata->x;
if (y) *y = pdata->y;
}
}
EOLIAN static unsigned int
_evas_canvas_pointer_button_down_mask_get(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e)
_evas_canvas_pointer_button_down_mask_by_device_get(Eo *eo_e EINA_UNUSED,
Evas_Public_Data *e,
Efl_Input_Device *dev)
{
return e->pointer.button;
Evas_Pointer_Data *pdata = _evas_pointer_data_by_device_get(e, dev);
if (!pdata) return 0;
return pdata->button;
}
EOLIAN static Eina_Bool
_evas_canvas_pointer_inside_get(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e)
_evas_canvas_pointer_inside_by_device_get(Eo *eo_e EINA_UNUSED,
Evas_Public_Data *e,
Efl_Input_Device *dev)
{
return e->pointer.inside;
Evas_Pointer_Data *pdata = _evas_pointer_data_by_device_get(e, dev);
if (!pdata) return EINA_FALSE;
return pdata->inside;
}
EOLIAN static void
_evas_canvas_pointer_output_xy_get(Eo *eo_e, Evas_Public_Data *e, int *x, int *y)
{
return _evas_canvas_pointer_output_xy_by_device_get(eo_e, e, NULL, x, y);
}
EOLIAN static void
_evas_canvas_pointer_canvas_xy_get(Eo *eo_e, Evas_Public_Data *e, Evas_Coord *x, Evas_Coord *y)
{
return _evas_canvas_pointer_canvas_xy_by_device_get(eo_e, e, NULL, x, y);
}
EOLIAN static unsigned int
_evas_canvas_pointer_button_down_mask_get(Eo *eo_e, Evas_Public_Data *e)
{
return _evas_canvas_pointer_button_down_mask_by_device_get(eo_e, e, NULL);
}
EOLIAN static Eina_Bool
_evas_canvas_pointer_inside_get(Eo *eo_e, Evas_Public_Data *e)
{
return _evas_canvas_pointer_inside_by_device_get(eo_e, e, NULL);
}
EOLIAN static void
@ -1004,4 +1080,70 @@ evas_output_viewport_get(const Evas *eo_e, Evas_Coord *x, Evas_Coord *y, Evas_Co
if (h) *h = e->viewport.h;
}
Evas_Pointer_Data *
_evas_pointer_data_by_device_get(Evas_Public_Data *edata, Efl_Input_Device *pointer)
{
Eina_List *l;
Evas_Pointer_Data *pdata;
if (!pointer)
pointer = edata->default_mouse;
EINA_LIST_FOREACH(edata->pointers, l, pdata)
{
if (pdata->pointer == pointer)
return pdata;
}
return NULL;
}
Eina_Bool
_evas_pointer_data_add(Evas_Public_Data *edata, Efl_Input_Device *pointer)
{
Evas_Pointer_Data *pdata;
pdata = calloc(1, sizeof(Evas_Pointer_Data));
EINA_SAFETY_ON_NULL_RETURN_VAL(pdata, EINA_FALSE);
pdata->pointer = pointer;
edata->pointers = eina_list_append(edata->pointers, pdata);
return EINA_TRUE;
}
void
_evas_pointer_data_remove(Evas_Public_Data *edata, Efl_Input_Device *pointer)
{
Eina_List *l;
Evas_Pointer_Data *pdata;
EINA_LIST_FOREACH(edata->pointers, l, pdata)
{
if (pdata->pointer == pointer)
{
edata->pointers = eina_list_remove_list(edata->pointers, l);
eina_list_free(pdata->object.in);
free(pdata);
break;
}
}
}
Eina_List *
_evas_pointer_list_in_rect_get(Evas_Public_Data *edata, Evas_Object *obj,
Evas_Object_Protected_Data *obj_data,
int w, int h)
{
Eina_List *l, *list = NULL;
Evas_Pointer_Data *pdata;
EINA_LIST_FOREACH(edata->pointers, l, pdata)
{
if (evas_object_is_in_output_rect(obj, obj_data, pdata->x,
pdata->y, w, h))
list = eina_list_append(list, pdata);
}
return list;
}
#include "canvas/evas_canvas.eo.c"

View File

@ -5,7 +5,6 @@
static void
_evas_map_calc_geom_change(Evas_Object *eo_obj)
{
int is, was = 0;
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
if (!obj) return;
evas_object_change(eo_obj, obj);
@ -13,17 +12,10 @@ _evas_map_calc_geom_change(Evas_Object *eo_obj)
if (!(obj->layer->evas->is_frozen))
{
evas_object_recalc_clippees(obj);
if (!obj->is_smart)
if (!obj->is_smart && obj->cur->visible)
{
is = evas_object_is_in_output_rect(eo_obj, obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
if ((is ^ was) && obj->cur->visible)
evas_event_feed_mouse_move(obj->layer->evas->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
obj->layer->evas->last_timestamp,
NULL);
_evas_canvas_event_pointer_in_list_mouse_move_feed(obj->layer->evas, NULL, eo_obj, obj, 1, 1,
EINA_TRUE, NULL);
}
}
evas_object_inform_call_move(eo_obj, obj);

View File

@ -108,7 +108,7 @@ _evas_line_xy_set(Eo *eo_obj, Evas_Line_Data *_pd, Evas_Coord x1, Evas_Coord y1,
Evas_Line_Data *o = _pd;
Evas_Coord min_x, max_x, min_y, max_y;
int is, was = 0;
Eina_List *was = NULL;
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
return;
@ -127,10 +127,8 @@ _evas_line_xy_set(Eo *eo_obj, Evas_Line_Data *_pd, Evas_Coord x1, Evas_Coord y1,
if (!evas_event_passes_through(eo_obj, obj) &&
!evas_event_freezes_through(eo_obj, obj) &&
!evas_object_is_source_invisible(eo_obj, obj))
was = evas_object_is_in_output_rect(eo_obj, obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
1, 1);
was = _evas_pointer_list_in_rect_get(obj->layer->evas, eo_obj, obj,
1, 1);
}
if (x1 < x2)
{
@ -171,23 +169,13 @@ _evas_line_xy_set(Eo *eo_obj, Evas_Line_Data *_pd, Evas_Coord x1, Evas_Coord y1,
evas_object_change(eo_obj, obj);
evas_object_coords_recalc(eo_obj, obj);
evas_object_clip_dirty(eo_obj, obj);
if (!(obj->layer->evas->is_frozen))
{
is = evas_object_is_in_output_rect(eo_obj, obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
if (!evas_event_passes_through(eo_obj, obj) &&
!evas_event_freezes_through(eo_obj, obj) &&
!evas_object_is_source_invisible(eo_obj, obj))
{
if ((is ^ was) && obj->cur->visible)
evas_event_feed_mouse_move(obj->layer->evas->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
obj->layer->evas->last_timestamp,
NULL);
}
}
if (!(obj->layer->evas->is_frozen) &&
!evas_event_passes_through(eo_obj, obj) &&
!evas_event_freezes_through(eo_obj, obj) &&
!evas_object_is_source_invisible(eo_obj, obj) &&
obj->cur->visible)
_evas_canvas_event_pointer_in_list_mouse_move_feed(obj->layer->evas, was, eo_obj, obj, 1, 1, EINA_TRUE, NULL);
eina_list_free(was);
evas_object_inform_call_move(eo_obj, obj);
evas_object_inform_call_resize(eo_obj);
}

View File

@ -81,6 +81,60 @@ _init_cow(void)
return EINA_TRUE;
}
static void
_evas_device_del_cb(void *data, const Efl_Event *ev)
{
Evas_Object_Protected_Data *obj = data;
eina_hash_del_by_key(obj->pointer_grabs, &ev->object);
}
static void
_evas_object_pointer_grab_del(Evas_Object_Pointer_Data *pdata)
{
if ((pdata->mouse_grabbed > 0) && (pdata->obj->layer) && (pdata->obj->layer->evas))
pdata->evas_pdata->mouse_grabbed -= pdata->mouse_grabbed;
if (((pdata->mouse_in) || (pdata->mouse_grabbed > 0)) &&
(pdata->obj->layer) && (pdata->obj->layer->evas))
pdata->evas_pdata->object.in = eina_list_remove(pdata->evas_pdata->object.in, pdata->obj->object);
efl_event_callback_del(pdata->evas_pdata->pointer, EFL_EVENT_DEL,
_evas_device_del_cb, pdata->obj);
free(pdata);
}
static Evas_Object_Pointer_Data *
_evas_object_pointer_data_add(Evas_Pointer_Data *evas_pdata,
Evas_Object_Protected_Data *obj,
Efl_Input_Device *pointer)
{
Evas_Object_Pointer_Data *pdata;
pdata = calloc(1, sizeof(Evas_Object_Pointer_Data));
EINA_SAFETY_ON_NULL_RETURN_VAL(pdata, NULL);
pdata->pointer_mode = EVAS_OBJECT_POINTER_MODE_AUTOGRAB;
pdata->obj = obj;
pdata->evas_pdata = evas_pdata;
efl_event_callback_priority_add(pointer, EFL_EVENT_DEL,
EFL_CALLBACK_PRIORITY_BEFORE,
_evas_device_del_cb, obj);
eina_hash_add(obj->pointer_grabs, &pointer, pdata);
return pdata;
}
Evas_Object_Pointer_Data *
_evas_object_pointer_data_get(Evas_Pointer_Data *evas_pdata,
Evas_Object_Protected_Data *obj,
Efl_Input_Device *pointer)
{
Evas_Object_Pointer_Data *pdata;
pdata = eina_hash_find(obj->pointer_grabs, &pointer);
//The pointer does not exist yet - create one.
if (!pdata)
return _evas_object_pointer_data_add(evas_pdata, obj, pointer);
return pdata;
}
EOLIAN static Eo *
_efl_canvas_object_efl_object_constructor(Eo *eo_obj, Evas_Object_Protected_Data *obj)
{
@ -108,6 +162,7 @@ _efl_canvas_object_efl_object_constructor(Eo *eo_obj, Evas_Object_Protected_Data
obj->prev = eina_cow_alloc(evas_object_state_cow);
obj->data_3d = eina_cow_alloc(evas_object_3d_cow);
obj->mask = eina_cow_alloc(evas_object_mask_cow);
obj->pointer_grabs = eina_hash_pointer_new(EINA_FREE_CB(_evas_object_pointer_grab_del));
evas_object_inject(eo_obj, obj, evas);
evas_object_callback_init(eo_obj, obj);
@ -855,15 +910,10 @@ _efl_canvas_object_efl_object_destructor(Eo *eo_obj, Evas_Object_Protected_Data
if ((obj->layer) && (obj->layer->evas))
_evas_post_event_callback_call(obj->layer->evas->evas, obj->layer->evas);
}
eina_hash_free(obj->pointer_grabs);
evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_DEL, NULL, _evas_object_event_new(), NULL);
if ((obj->layer) && (obj->layer->evas))
_evas_post_event_callback_call(obj->layer->evas->evas, obj->layer->evas);
if ((obj->mouse_grabbed > 0) && (obj->layer) && (obj->layer->evas))
obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed;
if (((obj->mouse_in) || (obj->mouse_grabbed > 0)) && (obj->layer) && (obj->layer->evas))
obj->layer->evas->pointer.object.in = eina_list_remove(obj->layer->evas->pointer.object.in, eo_obj);
obj->mouse_grabbed = 0;
obj->mouse_in = 0;
if (obj->name) evas_object_name_set(eo_obj, NULL);
if (!obj->layer)
{
@ -953,10 +1003,9 @@ EOLIAN static void
_efl_canvas_object_efl_gfx_position_set(Eo *eo_obj, Evas_Object_Protected_Data *obj,
Evas_Coord x, Evas_Coord y)
{
Eina_Bool is, was = EINA_FALSE;
Eina_Bool pass = EINA_FALSE, freeze = EINA_FALSE;
Eina_Bool source_invisible = EINA_FALSE;
Eina_List *was = NULL;
evas_object_async_block(obj);
if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 1, x, y))
@ -977,9 +1026,8 @@ _efl_canvas_object_efl_gfx_position_set(Eo *eo_obj, Evas_Object_Protected_Data *
freeze = evas_event_freezes_through(eo_obj, obj);
source_invisible = evas_object_is_source_invisible(eo_obj, obj);
if ((!pass) && (!freeze) && (!source_invisible))
was = evas_object_is_in_output_rect(eo_obj, obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
was = _evas_pointer_list_in_rect_get(obj->layer->evas, eo_obj, obj,
1, 1);
}
obj->doing.in_move++;
@ -1003,22 +1051,10 @@ _efl_canvas_object_efl_gfx_position_set(Eo *eo_obj, Evas_Object_Protected_Data *
if (!(obj->layer->evas->is_frozen))
{
evas_object_recalc_clippees(obj);
if (!pass)
{
if (!obj->is_smart)
{
is = evas_object_is_in_output_rect(eo_obj, obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
if ((is ^ was) && obj->cur->visible)
evas_event_feed_mouse_move(obj->layer->evas->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
obj->layer->evas->last_timestamp,
NULL);
}
}
if (!pass && !obj->is_smart && obj->cur->visible)
_evas_canvas_event_pointer_in_list_mouse_move_feed(obj->layer->evas, was, eo_obj, obj, 1, 1, EINA_TRUE, NULL);
}
eina_list_free(was);
evas_object_inform_call_move(eo_obj, obj);
}
@ -1052,9 +1088,9 @@ EOLIAN static void
_efl_canvas_object_efl_gfx_size_set(Eo *eo_obj, Evas_Object_Protected_Data *obj,
Evas_Coord w, Evas_Coord h)
{
Eina_Bool is, was = EINA_FALSE;
Eina_Bool pass = EINA_FALSE, freeze = EINA_FALSE;
Eina_Bool source_invisible = EINA_FALSE;
Eina_List *was = NULL;
if (w < 0) w = 0;
if (h < 0) h = 0;
@ -1068,9 +1104,8 @@ _efl_canvas_object_efl_gfx_size_set(Eo *eo_obj, Evas_Object_Protected_Data *obj,
freeze = evas_event_freezes_through(eo_obj, obj);
source_invisible = evas_object_is_source_invisible(eo_obj, obj);
if ((!pass) && (!freeze) && (!source_invisible))
was = evas_object_is_in_output_rect(eo_obj, obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
was = _evas_pointer_list_in_rect_get(obj->layer->evas, eo_obj,
obj, 1, 1);
}
obj->doing.in_resize++;
@ -1097,22 +1132,10 @@ _efl_canvas_object_efl_gfx_size_set(Eo *eo_obj, Evas_Object_Protected_Data *obj,
evas_object_recalc_clippees(obj);
// if (obj->func->coords_recalc) obj->func->coords_recalc(eo_obj);
if (!pass)
{
if (!obj->is_smart)
{
is = evas_object_is_in_output_rect(eo_obj, obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
if ((is ^ was) && (obj->cur->visible))
evas_event_feed_mouse_move(obj->layer->evas->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
obj->layer->evas->last_timestamp,
NULL);
}
}
if (!pass && !obj->is_smart && obj->cur->visible)
_evas_canvas_event_pointer_in_list_mouse_move_feed(obj->layer->evas, was, eo_obj, obj, 1, 1, EINA_TRUE, NULL);
}
eina_list_free(was);
evas_object_inform_call_resize(eo_obj);
}
@ -1492,14 +1515,11 @@ _show(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
{
if (!obj->is_smart)
{
if (evas_object_is_in_output_rect(eo_obj, obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1))
evas_event_feed_mouse_move(obj->layer->evas->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
obj->layer->evas->last_timestamp,
NULL);
_evas_canvas_event_pointer_in_rect_mouse_move_feed(obj->layer->evas,
eo_obj,
obj, 1, 1,
EINA_FALSE,
NULL);
}
}
}
@ -1554,17 +1574,17 @@ _hide(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
if ((!obj->is_smart) ||
((obj->map->cur.map) && (obj->map->cur.map->count == 4) && (obj->map->cur.usemap)))
{
if (!obj->mouse_grabbed)
Eina_Iterator *itr = eina_hash_iterator_data_new(obj->pointer_grabs);
Evas_Object_Pointer_Data *obj_pdata;
EINA_ITERATOR_FOREACH(itr, obj_pdata)
{
if (evas_object_is_in_output_rect(eo_obj, obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1))
evas_event_feed_mouse_move(obj->layer->evas->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
obj->layer->evas->last_timestamp,
NULL);
if (!obj_pdata->mouse_grabbed &&
evas_object_is_in_output_rect(eo_obj, obj, obj_pdata->evas_pdata->x,
obj_pdata->evas_pdata->y,
1, 1))
_evas_canvas_event_pointer_move_event_dispatch(obj->layer->evas, obj_pdata->evas_pdata, NULL);
}
eina_iterator_free(itr);
/* this is at odds to handling events when an obj is moved out of the mouse
* ore resized out or clipped out. if mouse is grabbed - regardless of
* visibility, mouse move events should keep happening and mouse up.
@ -2019,7 +2039,10 @@ evas_object_top_at_pointer_get(const Evas *eo_e)
Evas_Public_Data *e = efl_isa(eo_e, EVAS_CANVAS_CLASS) ?
efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS) : NULL;
if (!e) return NULL;
return evas_canvas_object_top_at_xy_get((Eo *)eo_e, e->pointer.x, e->pointer.y, EINA_TRUE, EINA_TRUE);
Evas_Pointer_Data *pdata = _evas_pointer_data_by_device_get(e, NULL);
EINA_SAFETY_ON_NULL_RETURN_VAL(pdata, NULL);
return evas_canvas_object_top_at_xy_get((Eo *)eo_e, pdata->x, pdata->y, EINA_TRUE, EINA_TRUE);
}
EOLIAN Evas_Object*

View File

@ -105,7 +105,7 @@ _efl_canvas_polygon_point_add(Eo *eo_obj, Efl_Canvas_Polygon_Data *_pd, Evas_Coo
Efl_Canvas_Polygon_Data *o = _pd;
Efl_Canvas_Polygon_Point *p;
Evas_Coord min_x, max_x, min_y, max_y;
int is, was = 0;
Eina_List *was = NULL;
evas_object_async_block(obj);
if (!obj->layer->evas->is_frozen)
@ -113,10 +113,8 @@ _efl_canvas_polygon_point_add(Eo *eo_obj, Efl_Canvas_Polygon_Data *_pd, Evas_Coo
if (!evas_event_passes_through(eo_obj, obj) &&
!evas_event_freezes_through(eo_obj, obj) &&
!evas_object_is_source_invisible(eo_obj, obj))
was = evas_object_is_in_output_rect(eo_obj, obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
1, 1);
was = _evas_pointer_list_in_rect_get(obj->layer->evas, eo_obj, obj,
1, 1);
}
if (!o->points)
{
@ -184,23 +182,13 @@ _efl_canvas_polygon_point_add(Eo *eo_obj, Efl_Canvas_Polygon_Data *_pd, Evas_Coo
evas_object_change(eo_obj, obj);
evas_object_clip_dirty(eo_obj, obj);
evas_object_coords_recalc(eo_obj, obj);
if (!obj->layer->evas->is_frozen)
{
is = evas_object_is_in_output_rect(eo_obj, obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
if (!evas_event_passes_through(eo_obj, obj) &&
!evas_event_freezes_through(eo_obj, obj) &&
!evas_object_is_source_invisible(eo_obj, obj))
{
if ((is ^ was) && obj->cur->visible)
evas_event_feed_mouse_move(obj->layer->evas->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
obj->layer->evas->last_timestamp,
NULL);
}
}
if (!obj->layer->evas->is_frozen &&
!evas_event_passes_through(eo_obj, obj) &&
!evas_event_freezes_through(eo_obj, obj) &&
!evas_object_is_source_invisible(eo_obj, obj) &&
obj->cur->visible)
_evas_canvas_event_pointer_in_list_mouse_move_feed(obj->layer->evas, was, eo_obj, obj, 1, 1, EINA_TRUE, NULL);
eina_list_free(was);
evas_object_inform_call_move(eo_obj, obj);
evas_object_inform_call_resize(eo_obj);
}
@ -211,12 +199,11 @@ _efl_canvas_polygon_points_clear(Eo *eo_obj, Efl_Canvas_Polygon_Data *_pd)
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
Efl_Canvas_Polygon_Data *o = _pd;
void *list_data;
int is, was;
Eina_List *was;
evas_object_async_block(obj);
was = evas_object_is_in_output_rect(eo_obj, obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
was = _evas_pointer_list_in_rect_get(obj->layer->evas, eo_obj, obj, 1, 1);
EINA_LIST_FREE(o->points, list_data)
{
free(list_data);
@ -236,15 +223,9 @@ _efl_canvas_polygon_points_clear(Eo *eo_obj, Efl_Canvas_Polygon_Data *_pd)
evas_object_change(eo_obj, obj);
evas_object_clip_dirty(eo_obj, obj);
evas_object_coords_recalc(eo_obj, obj);
is = evas_object_is_in_output_rect(eo_obj, obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
if ((is || was) && obj->cur->visible)
evas_event_feed_mouse_move(obj->layer->evas->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
obj->layer->evas->last_timestamp,
NULL);
if (obj->cur->visible)
_evas_canvas_event_pointer_in_list_mouse_move_feed(obj->layer->evas, was, eo_obj, obj, 1, 1, EINA_FALSE, NULL);
eina_list_free(was);
evas_object_inform_call_move(eo_obj, obj);
evas_object_inform_call_resize(eo_obj);
}

View File

@ -422,10 +422,10 @@ EOLIAN static void
_evas_text_efl_text_properties_font_set(Eo *eo_obj, Evas_Text_Data *o, const char *font, Evas_Font_Size size)
{
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
Eina_Bool is, was = EINA_FALSE;
Eina_Bool pass = EINA_FALSE, freeze = EINA_FALSE;
Eina_Bool source_invisible = EINA_FALSE;
Evas_Font_Description *fdesc;
Eina_List *was = NULL;
if ((!font) || (size <= 0)) return;
@ -461,9 +461,8 @@ _evas_text_efl_text_properties_font_set(Eo *eo_obj, Evas_Text_Data *o, const cha
freeze = evas_event_freezes_through(eo_obj, obj);
source_invisible = evas_object_is_source_invisible(eo_obj, obj);
if ((!pass) && (!freeze) && (!source_invisible))
was = evas_object_is_in_output_rect(eo_obj, obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
was = _evas_pointer_list_in_rect_get(obj->layer->evas, eo_obj, obj,
1, 1);
}
/* DO IT */
@ -489,22 +488,9 @@ _evas_text_efl_text_properties_font_set(Eo *eo_obj, Evas_Text_Data *o, const cha
evas_object_change(eo_obj, obj);
evas_object_clip_dirty(eo_obj, obj);
evas_object_coords_recalc(eo_obj, obj);
if (!(obj->layer->evas->is_frozen))
{
if ((!pass) && (!freeze))
{
is = evas_object_is_in_output_rect(eo_obj, obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
1, 1);
if ((is ^ was) && obj->cur->visible)
evas_event_feed_mouse_move(obj->layer->evas->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
obj->layer->evas->last_timestamp,
NULL);
}
}
if (!obj->layer->evas->is_frozen && !pass && !freeze && obj->cur->visible)
_evas_canvas_event_pointer_in_list_mouse_move_feed(obj->layer->evas, was, eo_obj, obj, 1, 1, EINA_TRUE, NULL);
eina_list_free(was);
evas_object_inform_call_resize(eo_obj);
}
@ -1073,8 +1059,9 @@ EOLIAN static void
_evas_text_efl_text_text_set(Eo *eo_obj, Evas_Text_Data *o, const char *_text)
{
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
int is, was, len;
int len;
Eina_Unicode *text;
Eina_List *was = NULL;
if ((o->cur.utf8_text) && (_text) && (!strcmp(o->cur.utf8_text, _text)))
return;
@ -1082,9 +1069,7 @@ _evas_text_efl_text_text_set(Eo *eo_obj, Evas_Text_Data *o, const char *_text)
text = eina_unicode_utf8_to_unicode(_text, &len);
if (!text) text = eina_unicode_strdup(EINA_UNICODE_EMPTY_STRING);
was = evas_object_is_in_output_rect(eo_obj, obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
was = _evas_pointer_list_in_rect_get(obj->layer->evas, eo_obj, obj, 1, 1);
/* DO II */
/*Update bidi_props*/
@ -1102,15 +1087,9 @@ _evas_text_efl_text_text_set(Eo *eo_obj, Evas_Text_Data *o, const char *_text)
evas_object_change(eo_obj, obj);
evas_object_clip_dirty(eo_obj, obj);
evas_object_coords_recalc(eo_obj, obj);
is = evas_object_is_in_output_rect(eo_obj, obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
if ((is || was) && obj->cur->visible)
evas_event_feed_mouse_move(obj->layer->evas->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
obj->layer->evas->last_timestamp,
NULL);
if (obj->cur->visible)
_evas_canvas_event_pointer_in_list_mouse_move_feed(obj->layer->evas, was, eo_obj, obj, 1, 1, EINA_FALSE, NULL);
eina_list_free(was);
evas_object_inform_call_resize(eo_obj);
}
@ -2219,14 +2198,12 @@ _evas_object_text_rehint(Evas_Object *eo_obj)
{
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
Evas_Text_Data *o = efl_data_scope_get(eo_obj, MY_CLASS);
int is, was;
Eina_List *was = NULL;
if (!o->font) return;
evas_font_load_hinting_set(obj->layer->evas->evas, o->font,
obj->layer->evas->hinting);
was = evas_object_is_in_output_rect(eo_obj, obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
was = _evas_pointer_list_in_rect_get(obj->layer->evas, eo_obj, obj, 1, 1);
/* DO II */
_evas_object_text_recalc(eo_obj, o->cur.text);
o->changed = 1;
@ -2235,15 +2212,9 @@ _evas_object_text_rehint(Evas_Object *eo_obj)
evas_object_change(eo_obj, obj);
evas_object_clip_dirty(eo_obj, obj);
evas_object_coords_recalc(eo_obj, obj);
is = evas_object_is_in_output_rect(eo_obj, obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
if ((is || was) && obj->cur->visible)
evas_event_feed_mouse_move(obj->layer->evas->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
obj->layer->evas->last_timestamp,
NULL);
if (obj->cur->visible)
_evas_canvas_event_pointer_in_list_mouse_move_feed(obj->layer->evas, was, eo_obj, obj, 1, 1, EINA_FALSE, NULL);
eina_list_free(was);
evas_object_inform_call_resize(eo_obj);
}

View File

@ -1054,10 +1054,10 @@ _evas_textgrid_efl_text_properties_font_set(Eo *eo_obj,
Evas_Font_Size font_size)
{
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
Eina_Bool is, was = EINA_FALSE;
Eina_Bool pass = EINA_FALSE, freeze = EINA_FALSE;
Eina_Bool source_invisible = EINA_FALSE;
Evas_Font_Description *fdesc;
Eina_List *was = NULL;
if ((!font_name) || (!*font_name) || (font_size <= 0))
return;
@ -1090,10 +1090,8 @@ _evas_textgrid_efl_text_properties_font_set(Eo *eo_obj,
freeze = evas_event_freezes_through(eo_obj, obj);
source_invisible = evas_object_is_source_invisible(eo_obj, obj);
if ((!pass) && (!freeze) && (!source_invisible))
was = evas_object_is_in_output_rect(eo_obj, obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
1, 1);
was = _evas_pointer_list_in_rect_get(obj->layer->evas, eo_obj, obj,
1, 1);
}
if (o->font_normal)
@ -1229,22 +1227,9 @@ _evas_textgrid_efl_text_properties_font_set(Eo *eo_obj,
evas_object_change(eo_obj, obj);
evas_object_clip_dirty(eo_obj, obj);
evas_object_coords_recalc(eo_obj, obj);
if (!(obj->layer->evas->is_frozen))
{
if ((!pass) && (!freeze))
{
is = evas_object_is_in_output_rect(eo_obj, obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
1, 1);
if ((is ^ was) && obj->cur->visible)
evas_event_feed_mouse_move(obj->layer->evas->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
obj->layer->evas->last_timestamp,
NULL);
}
}
if (!obj->layer->evas->is_frozen && !pass && !freeze && obj->cur->visible)
_evas_canvas_event_pointer_in_list_mouse_move_feed(obj->layer->evas, was, eo_obj, obj, 1, 1, EINA_TRUE, NULL);
eina_list_free(was);
evas_object_inform_call_resize(eo_obj);
o->changed = 1;
o->core_change = 1;

View File

@ -75,17 +75,13 @@ _efl_canvas_object_efl_gfx_stack_raise(Eo *eo_obj, Evas_Object_Protected_Data *o
(!evas_event_freezes_through(eo_obj, obj)) &&
(!evas_object_is_source_invisible(eo_obj, obj)))
{
if (!obj->is_smart)
if (!obj->is_smart && obj->cur->visible)
{
if (evas_object_is_in_output_rect(eo_obj, obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
1, 1) && obj->cur->visible)
evas_event_feed_mouse_move(obj->layer->evas->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
obj->layer->evas->last_timestamp,
NULL);
_evas_canvas_event_pointer_in_rect_mouse_move_feed(obj->layer->evas,
eo_obj,
obj, 1, 1,
EINA_FALSE,
NULL);
}
}
}
@ -129,17 +125,13 @@ _efl_canvas_object_efl_gfx_stack_lower(Eo *eo_obj, Evas_Object_Protected_Data *o
(!evas_event_freezes_through(eo_obj, obj)) &&
(!evas_object_is_source_invisible(eo_obj, obj)))
{
if (!obj->is_smart)
if (!obj->is_smart && obj->cur->visible)
{
if (evas_object_is_in_output_rect(eo_obj, obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
1, 1) && obj->cur->visible)
evas_event_feed_mouse_move(obj->layer->evas->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
obj->layer->evas->last_timestamp,
NULL);
_evas_canvas_event_pointer_in_rect_mouse_move_feed(obj->layer->evas,
eo_obj,
obj, 1, 1,
EINA_FALSE,
NULL);
}
}
}
@ -211,17 +203,13 @@ _efl_canvas_object_efl_gfx_stack_stack_above(Eo *eo_obj, Evas_Object_Protected_D
(!evas_event_freezes_through(eo_obj, obj)) &&
(!evas_object_is_source_invisible(eo_obj, obj)))
{
if (!obj->is_smart)
if (!obj->is_smart && obj->cur->visible)
{
if (evas_object_is_in_output_rect(eo_obj, obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
1, 1) && obj->cur->visible)
evas_event_feed_mouse_move(obj->layer->evas->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
obj->layer->evas->last_timestamp,
NULL);
_evas_canvas_event_pointer_in_rect_mouse_move_feed(obj->layer->evas,
eo_obj,
obj, 1, 1,
EINA_FALSE,
NULL);
}
}
}
@ -293,17 +281,13 @@ _efl_canvas_object_efl_gfx_stack_stack_below(Eo *eo_obj, Evas_Object_Protected_D
(!evas_event_freezes_through(eo_obj, obj)) &&
(!evas_object_is_source_invisible(eo_obj, obj)))
{
if (!obj->is_smart)
if (!obj->is_smart && obj->cur->visible)
{
if (evas_object_is_in_output_rect(eo_obj, obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
1, 1) && obj->cur->visible)
evas_event_feed_mouse_move(obj->layer->evas->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
obj->layer->evas->last_timestamp,
NULL);
_evas_canvas_event_pointer_in_rect_mouse_move_feed(obj->layer->evas,
eo_obj,
obj, 1, 1,
EINA_FALSE,
NULL);
}
}
}

View File

@ -84,6 +84,7 @@ typedef struct _Evas_Object_Map_Data Evas_Object_Map_Data;
typedef struct _Evas_Proxy_Render_Data Evas_Proxy_Render_Data;
typedef struct _Evas_Object_3D_Data Evas_Object_3D_Data;
typedef struct _Evas_Object_Mask_Data Evas_Object_Mask_Data;
typedef struct _Evas_Object_Pointer_Data Evas_Object_Pointer_Data;
typedef struct _Evas_Smart_Data Evas_Smart_Data;
@ -93,6 +94,7 @@ typedef struct _Evas_Object_Protected_Data Evas_Object_Protected_Data;
typedef struct _Evas_Filter_Program Evas_Filter_Program;
typedef struct _Evas_Object_Filter_Data Evas_Object_Filter_Data;
typedef struct _Evas_Filter_Data_Binding Evas_Filter_Data_Binding;
typedef struct _Evas_Pointer_Data Evas_Pointer_Data;
// 3D stuff
@ -767,7 +769,8 @@ struct _Evas_Modifier
int count;
char **list;
} mod;
Evas_Modifier_Mask mask; /* ok we have a max of 64 modifiers */
Eina_Hash *masks; /* we have a max of 64 modifiers per seat */
Evas_Public_Data *e;
};
struct _Evas_Lock
@ -776,7 +779,8 @@ struct _Evas_Lock
int count;
char **list;
} lock;
Evas_Modifier_Mask mask; /* we have a max of 64 locks */
Eina_Hash *masks; /* we have a max of 64 locks per seat */
Evas_Public_Data *e;
};
struct _Evas_Post_Callback
@ -798,6 +802,21 @@ typedef struct
Evas_Object_Protected_Data *obj;
} Evas_Active_Entry;
struct _Evas_Pointer_Data
{
Evas_Device *pointer;
struct {
Eina_List *in;
} object;
DATA32 button;
Evas_Coord x, y;
Evas_Point prev;
int mouse_grabbed;
int downs;
int nogrep;
unsigned char inside : 1;
};
struct _Evas_Public_Data
{
EINA_INLIST;
@ -805,18 +824,7 @@ struct _Evas_Public_Data
DATA32 magic;
Evas *evas;
struct {
unsigned char inside : 1;
int mouse_grabbed;
int downs;
DATA32 button;
Evas_Coord x, y;
Evas_Point prev;
int nogrep;
struct {
Eina_List *in;
} object;
} pointer;
Eina_List *pointers;
struct {
Evas_Coord x, y, w, h;
@ -1083,6 +1091,14 @@ struct _Evas_Object_Protected_State
Eina_Bool snapshot : 1;
};
struct _Evas_Object_Pointer_Data {
Evas_Object_Protected_Data *obj;
Evas_Pointer_Data *evas_pdata;
Evas_Object_Pointer_Mode pointer_mode;
int mouse_grabbed;
Eina_Bool mouse_in;
};
struct _Evas_Object_Protected_Data
{
EINA_INLIST;
@ -1123,6 +1139,7 @@ struct _Evas_Object_Protected_Data
const Evas_Object_3D_Data *data_3d;
const Evas_Object_Mask_Data *mask;
Eina_List *focused_by_seats;
Eina_Hash *pointer_grabs;
// Pointer to the Evas_Object itself
Evas_Object *object;
@ -1131,7 +1148,6 @@ struct _Evas_Object_Protected_Data
int last_mouse_down_counter;
int last_mouse_up_counter;
int mouse_grabbed;
// Daniel: Added because the destructor can't take parameters, at least for the moment
int clean_layer;
@ -1152,6 +1168,7 @@ struct _Evas_Object_Protected_Data
Eina_Bool render_pre : 1;
Eina_Bool rect_del : 1;
Eina_Bool is_active : 1;
Eina_Bool changed : 1;
Eina_Bool restack : 1;
@ -1173,8 +1190,6 @@ struct _Evas_Object_Protected_Data
Eina_Bool pre_render_done : 1;
Eina_Bool precise_is_inside : 1;
Eina_Bool is_static_clip : 1;
Eina_Bool mouse_in : 1;
Evas_Object_Pointer_Mode pointer_mode : 2;
Eina_Bool in_layer : 1;
Eina_Bool is_frame : 1;
@ -1576,6 +1591,7 @@ void evas_object_render_pre_clipper_change(Eina_Array *rects, Evas_Object *obj);
void evas_object_render_pre_prev_cur_add(Eina_Array *rects, Evas_Object *obj, Evas_Object_Protected_Data *pd);
void evas_object_render_pre_effect_updates(Eina_Array *rects, Evas_Object *obj, int is_v, int was_v);
void evas_rects_return_difference_rects(Eina_Array *rects, int x, int y, int w, int h, int xx, int yy, int ww, int hh);
Evas_Object_Pointer_Data *_evas_object_pointer_data_get(Evas_Pointer_Data *evas_pdata, Evas_Object_Protected_Data *obj, Efl_Input_Device *pointer);
void evas_object_clip_dirty(Evas_Object *obj, Evas_Object_Protected_Data *pd);
void evas_object_recalc_clippees(Evas_Object_Protected_Data *pd);
@ -1904,7 +1920,22 @@ struct _Evas_Proxy_Render_Data
void _evas_canvas_event_init(Evas *eo_e, Evas_Public_Data *e);
void _evas_canvas_event_shutdown(Evas *eo_e, Evas_Public_Data *e);
void _evas_canvas_event_pointer_in_rect_mouse_move_feed(Evas_Public_Data *edata,
Evas_Object *obj,
Evas_Object_Protected_Data *obj_data,
int w, int h,
Eina_Bool in_objects_list,
void *data);
void _evas_canvas_event_pointer_in_list_mouse_move_feed(Evas_Public_Data *edata,
Eina_List *was,
Evas_Object *obj,
Evas_Object_Protected_Data *obj_data,
int w, int h,
Eina_Bool xor_rule,
void *data);
void _evas_canvas_event_pointer_move_event_dispatch(Evas_Public_Data *edata,
Evas_Pointer_Data *pdata,
void *data);
int evas_async_events_init(void);
int evas_async_events_shutdown(void);
int evas_async_target_del(const void *target);
@ -1969,6 +2000,13 @@ Eina_Bool _evas_image_proxy_source_clip_get(const Eo *eo_obj);
void _evas_focus_dispatch_event(Evas_Object_Protected_Data *obj,
Efl_Input_Device *seat, Eina_Bool in);
Evas_Pointer_Data *_evas_pointer_data_by_device_get(Evas_Public_Data *edata, Efl_Input_Device *pointer);
Eina_Bool _evas_pointer_data_add(Evas_Public_Data *edata, Efl_Input_Device *pointer);
void _evas_pointer_data_remove(Evas_Public_Data *edata, Efl_Input_Device *pointer);
Eina_List *_evas_pointer_list_in_rect_get(Evas_Public_Data *edata,
Evas_Object *obj,
Evas_Object_Protected_Data *obj_data,
int w, int h);
extern Eina_Cow *evas_object_proxy_cow;
extern Eina_Cow *evas_object_map_cow;

View File

@ -168,7 +168,7 @@ _ecore_evas_wl_common_cb_mouse_in(void *data EINA_UNUSED, int type EINA_UNUSED,
if (_ecore_evas_mouse_in_check(ee, ev->dev)) return ECORE_CALLBACK_PASS_ON;
_ecore_evas_mouse_inout_set(ee, ev->dev, EINA_TRUE, EINA_FALSE);
ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers);
ecore_event_evas_seat_modifier_lock_update(ee->evas, ev->modifiers, ev->dev);
evas_event_feed_mouse_in(ee->evas, ev->timestamp, NULL);
_ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp);
return ECORE_CALLBACK_PASS_ON;
@ -188,7 +188,8 @@ _ecore_evas_wl_common_cb_mouse_out(void *data EINA_UNUSED, int type EINA_UNUSED,
if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
if (!_ecore_evas_mouse_in_check(ee, ev->dev)) return ECORE_CALLBACK_PASS_ON;
ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers);
ecore_event_evas_seat_modifier_lock_update(ee->evas,
ev->modifiers, ev->dev);
_ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp);
evas_event_feed_mouse_out(ee->evas, ev->timestamp, NULL);
_ecore_evas_mouse_inout_set(ee, ev->dev, EINA_FALSE, EINA_FALSE);

View File

@ -279,8 +279,9 @@ _ecore_evas_vnc_server_client_connection_new(rfbClientRec *client)
}
static unsigned int
_ecore_evas_vnc_server_modifier_to_ecore_modifier(int mod)
_ecore_evas_vnc_server_modifier_to_ecore_modifier(int mod, Eina_Bool *is_lock)
{
*is_lock = EINA_FALSE;
if (mod == XK_Shift_L || mod == XK_Shift_R)
return ECORE_EVENT_MODIFIER_SHIFT;
if (mod == XK_Control_L || mod == XK_Control_R)
@ -290,13 +291,25 @@ _ecore_evas_vnc_server_modifier_to_ecore_modifier(int mod)
if (mod == XK_Super_L || mod == XK_Super_R)
return ECORE_EVENT_MODIFIER_WIN;
if (mod == XK_Scroll_Lock)
return ECORE_EVENT_LOCK_SCROLL;
{
*is_lock = EINA_TRUE;
return ECORE_EVENT_LOCK_SCROLL;
}
if (mod == XK_Num_Lock)
return ECORE_EVENT_LOCK_NUM;
{
*is_lock = EINA_TRUE;
return ECORE_EVENT_LOCK_NUM;
}
if (mod == XK_Caps_Lock)
return ECORE_EVENT_LOCK_CAPS;
{
*is_lock = EINA_TRUE;
return ECORE_EVENT_LOCK_CAPS;
}
if (mod == XK_Shift_Lock)
return ECORE_EVENT_LOCK_SHIFT;
{
*is_lock = EINA_TRUE;
return ECORE_EVENT_LOCK_SHIFT;
}
return 0;
}
@ -360,11 +373,18 @@ _ecore_evas_vnc_server_client_keyboard_event(rfbBool down,
if (key >= XK_Shift_L && key <= XK_Hyper_R)
{
int mod = _ecore_evas_vnc_server_modifier_to_ecore_modifier(key);
Eina_Bool is_lock;
int mod = _ecore_evas_vnc_server_modifier_to_ecore_modifier(key,
&is_lock);
if (down)
cdata->key_modifiers |= mod;
else
{
if (!is_lock || !(cdata->key_modifiers & mod))
cdata->key_modifiers |= mod;
else
cdata->key_modifiers &= ~mod;
}
else if (!is_lock)
cdata->key_modifiers &= ~mod;
}