forked from enlightenment/efl
efl.canvas: Add "seat" (by id) and "device" (by name) properties
See d47197e65b
@feature
This commit is contained in:
parent
e8f9f109a6
commit
e8b69bed83
|
@ -115,6 +115,10 @@ typedef Efl_Gfx_Path_Command_Type Efl_Gfx_Path_Command;
|
||||||
#include "interfaces/efl_gfx_filter.eo.h"
|
#include "interfaces/efl_gfx_filter.eo.h"
|
||||||
#include "interfaces/efl_gfx_size_hint.eo.h"
|
#include "interfaces/efl_gfx_size_hint.eo.h"
|
||||||
|
|
||||||
|
/* Input events */
|
||||||
|
#include "interfaces/efl_input_types.eot.h"
|
||||||
|
#include "interfaces/efl_input_device.eo.h"
|
||||||
|
|
||||||
/* Canvas & UI */
|
/* Canvas & UI */
|
||||||
#include "interfaces/efl_canvas.eo.h"
|
#include "interfaces/efl_canvas.eo.h"
|
||||||
#include "interfaces/efl_ui_view.eo.h"
|
#include "interfaces/efl_ui_view.eo.h"
|
||||||
|
@ -133,10 +137,6 @@ typedef Efl_Gfx_Path_Command_Type Efl_Gfx_Path_Command;
|
||||||
#include "interfaces/efl_pack_linear.eo.h"
|
#include "interfaces/efl_pack_linear.eo.h"
|
||||||
#include "interfaces/efl_pack_grid.eo.h"
|
#include "interfaces/efl_pack_grid.eo.h"
|
||||||
|
|
||||||
/* Input events */
|
|
||||||
#include "interfaces/efl_input_types.eot.h"
|
|
||||||
#include "interfaces/efl_input_device.eo.h"
|
|
||||||
|
|
||||||
/* Input and Output */
|
/* Input and Output */
|
||||||
#include "interfaces/efl_io_closer.eo.h"
|
#include "interfaces/efl_io_closer.eo.h"
|
||||||
#include "interfaces/efl_io_reader.eo.h"
|
#include "interfaces/efl_io_reader.eo.h"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import efl_input_device;
|
||||||
|
|
||||||
interface Efl.Canvas ()
|
interface Efl.Canvas ()
|
||||||
{
|
{
|
||||||
[[Common interface for window and some internal classes in EFL.]]
|
[[Common interface for window and some internal classes in EFL.]]
|
||||||
|
@ -158,6 +160,47 @@ interface Efl.Canvas ()
|
||||||
]]
|
]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
seats {
|
||||||
|
[[Iterate over the input device seats.
|
||||||
|
|
||||||
|
@since 1.20
|
||||||
|
]]
|
||||||
|
return: own(free(iterator<Efl.Input.Device>, eina_iterator_free));
|
||||||
|
[[An iterator over the attached seats.]]
|
||||||
|
}
|
||||||
|
@property device {
|
||||||
|
[[An input device attached to this canvas, found by name.
|
||||||
|
|
||||||
|
Note: This function is meant to find seats and not individual
|
||||||
|
input devices.
|
||||||
|
|
||||||
|
See also @.seat to find a seat by id instead of by name.
|
||||||
|
]]
|
||||||
|
get {
|
||||||
|
[[Get a device by name.]]
|
||||||
|
}
|
||||||
|
keys {
|
||||||
|
name: string; [[The name of the seat to find.]]
|
||||||
|
}
|
||||||
|
values {
|
||||||
|
seat: Efl.Input.Device; [[The device or seat, $null if not found.]]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@property seat {
|
||||||
|
[[A seat attached to this canvas, found by id.
|
||||||
|
|
||||||
|
See also @.device to find a seat by name instead of by id.
|
||||||
|
]]
|
||||||
|
get {
|
||||||
|
[[Get a seat by id.]]
|
||||||
|
}
|
||||||
|
keys {
|
||||||
|
id: int; [[The id of the seat to find.]]
|
||||||
|
}
|
||||||
|
values {
|
||||||
|
seat: Efl.Input.Device; [[The seat or $null if not found.]]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
events {
|
events {
|
||||||
focus,in: Efl.Input.Focus; [[Called when canvas got focus]]
|
focus,in: Efl.Input.Focus; [[Called when canvas got focus]]
|
||||||
|
|
|
@ -1118,7 +1118,8 @@ class Evas.Canvas (Efl.Object, Efl.Canvas, Efl.Animator, Efl.Input.Interface,
|
||||||
}
|
}
|
||||||
@property default_device {
|
@property default_device {
|
||||||
[[Return the default device of a given type.
|
[[Return the default device of a given type.
|
||||||
\@note Currently Evas only creates a seat, mouse and keyboard.
|
|
||||||
|
Note: Currently EFL only creates a seat, mouse and keyboard.
|
||||||
@since 1.19
|
@since 1.19
|
||||||
]]
|
]]
|
||||||
get {}
|
get {}
|
||||||
|
@ -1162,5 +1163,8 @@ class Evas.Canvas (Efl.Object, Efl.Canvas, Efl.Animator, Efl.Input.Interface,
|
||||||
Efl.Object.event_freeze;
|
Efl.Object.event_freeze;
|
||||||
Efl.Object.provider_find;
|
Efl.Object.provider_find;
|
||||||
Efl.Loop_User.loop { get; }
|
Efl.Loop_User.loop { get; }
|
||||||
|
//Efl.Canvas.seats;
|
||||||
|
Efl.Canvas.device { get; }
|
||||||
|
Efl.Canvas.seat { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,20 +95,14 @@ _del_cb(void *data, const Efl_Event *ev)
|
||||||
ev->object);
|
ev->object);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Evas_Device *
|
EOLIAN Efl_Input_Device *
|
||||||
evas_device_get(Evas *eo_e, const char *name)
|
_evas_canvas_efl_canvas_device_get(Evas *eo_e EINA_UNUSED, Evas_Public_Data *e, const char *name)
|
||||||
{
|
{
|
||||||
const char *dev_name;
|
const char *dev_name;
|
||||||
Evas_Public_Data *e;
|
|
||||||
Evas_Device *dev;
|
Evas_Device *dev;
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
|
|
||||||
SAFETY_CHECK(eo_e, EVAS_CANVAS_CLASS, NULL);
|
if (!name) return NULL;
|
||||||
|
|
||||||
if (!name)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
|
|
||||||
|
|
||||||
EINA_LIST_FOREACH(e->devices, l, dev)
|
EINA_LIST_FOREACH(e->devices, l, dev)
|
||||||
{
|
{
|
||||||
|
@ -122,28 +116,35 @@ evas_device_get(Evas *eo_e, const char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Evas_Device *
|
EAPI Evas_Device *
|
||||||
evas_device_get_by_seat_id(Evas *eo_e, unsigned int id)
|
evas_device_get(Evas *eo_e, const char *name)
|
||||||
|
{
|
||||||
|
return efl_canvas_device_get(eo_e, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN Efl_Input_Device *
|
||||||
|
_evas_canvas_efl_canvas_seat_get(Evas *eo_e EINA_UNUSED, Evas_Public_Data *e, unsigned int id)
|
||||||
{
|
{
|
||||||
unsigned int seat_id;
|
|
||||||
Evas_Public_Data *e;
|
|
||||||
Evas_Device *dev;
|
Evas_Device *dev;
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
|
|
||||||
SAFETY_CHECK(eo_e, EVAS_CANVAS_CLASS, NULL);
|
|
||||||
|
|
||||||
e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
|
|
||||||
|
|
||||||
EINA_LIST_FOREACH(e->devices, l, dev)
|
EINA_LIST_FOREACH(e->devices, l, dev)
|
||||||
{
|
{
|
||||||
seat_id = efl_input_device_seat_id_get(dev);
|
if (efl_input_device_type_get(dev) != EFL_INPUT_DEVICE_TYPE_SEAT)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (seat_id == id)
|
if (efl_input_device_seat_id_get(dev) == id)
|
||||||
return dev;
|
return dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI Evas_Device *
|
||||||
|
evas_device_get_by_seat_id(Evas *eo_e, unsigned int id)
|
||||||
|
{
|
||||||
|
return efl_canvas_seat_get(eo_e, id);
|
||||||
|
}
|
||||||
|
|
||||||
EAPI Evas_Device *
|
EAPI Evas_Device *
|
||||||
evas_device_add(Evas *eo_e)
|
evas_device_add(Evas *eo_e)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue