forked from enlightenment/efl
atspi: AtspiValue interface added.
Summary: Enables remote value changing on accessible widgets. Added sample interface implementation for elm_slider widget. Test Plan: build&install Reviewers: raster, seoz Differential Revision: https://phab.enlightenment.org/D784
This commit is contained in:
parent
3c82b3c174
commit
21aafc3f2d
|
@ -450,6 +450,7 @@ elm_index.c \
|
||||||
elm_interface_atspi_accessible.c \
|
elm_interface_atspi_accessible.c \
|
||||||
elm_interface_atspi_action.c \
|
elm_interface_atspi_action.c \
|
||||||
elm_interface_atspi_component.c \
|
elm_interface_atspi_component.c \
|
||||||
|
elm_interface_atspi_value.c \
|
||||||
elm_interface_atspi_widget.c \
|
elm_interface_atspi_widget.c \
|
||||||
elm_interface_atspi_widget_action.c \
|
elm_interface_atspi_widget_action.c \
|
||||||
elm_interface_atspi_window.c \
|
elm_interface_atspi_window.c \
|
||||||
|
@ -646,6 +647,8 @@ BUILT_SOURCES = \
|
||||||
elm_interface_atspi_action.eo.h \
|
elm_interface_atspi_action.eo.h \
|
||||||
elm_interface_atspi_component.eo.c \
|
elm_interface_atspi_component.eo.c \
|
||||||
elm_interface_atspi_component.eo.h \
|
elm_interface_atspi_component.eo.h \
|
||||||
|
elm_interface_atspi_value.eo.c \
|
||||||
|
elm_interface_atspi_value.eo.h \
|
||||||
elm_interface_atspi_widget.eo.c \
|
elm_interface_atspi_widget.eo.c \
|
||||||
elm_interface_atspi_widget.eo.h \
|
elm_interface_atspi_widget.eo.h \
|
||||||
elm_interface_atspi_widget_action.eo.c \
|
elm_interface_atspi_widget_action.eo.c \
|
||||||
|
@ -743,6 +746,7 @@ EXTRA_DIST += \
|
||||||
elm_interface_atspi_accessible.eo \
|
elm_interface_atspi_accessible.eo \
|
||||||
elm_interface_atspi_action.eo \
|
elm_interface_atspi_action.eo \
|
||||||
elm_interface_atspi_component.eo \
|
elm_interface_atspi_component.eo \
|
||||||
|
elm_interface_atspi_value.eo \
|
||||||
elm_interface_atspi_widget.eo \
|
elm_interface_atspi_widget.eo \
|
||||||
elm_interface_atspi_widget_action.eo \
|
elm_interface_atspi_widget_action.eo \
|
||||||
elm_interface_atspi_window.eo \
|
elm_interface_atspi_window.eo \
|
||||||
|
@ -831,6 +835,7 @@ nodist_includesunstable_HEADERS = \
|
||||||
elm_interface_atspi_accessible.eo.h \
|
elm_interface_atspi_accessible.eo.h \
|
||||||
elm_interface_atspi_action.eo.h \
|
elm_interface_atspi_action.eo.h \
|
||||||
elm_interface_atspi_component.eo.h \
|
elm_interface_atspi_component.eo.h \
|
||||||
|
elm_interface_atspi_value.eo.h \
|
||||||
elm_interface_atspi_widget.eo.h \
|
elm_interface_atspi_widget.eo.h \
|
||||||
elm_interface_atspi_widget_action.eo.h \
|
elm_interface_atspi_widget_action.eo.h \
|
||||||
elm_interface_atspi_window.eo.h \
|
elm_interface_atspi_window.eo.h \
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#define ELM_INTERFACE_ATSPI_COMPONENT_PROTECTED
|
#define ELM_INTERFACE_ATSPI_COMPONENT_PROTECTED
|
||||||
#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
|
#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
|
||||||
#define ELM_INTERFACE_ATSPI_ACTION_PROTECTED
|
#define ELM_INTERFACE_ATSPI_ACTION_PROTECTED
|
||||||
|
#define ELM_INTERFACE_ATSPI_VALUE_PROTECTED
|
||||||
#include "atspi/atspi-constants.h"
|
#include "atspi/atspi-constants.h"
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
@ -17,6 +18,7 @@
|
||||||
#include "elm_interface_atspi_component.eo.h"
|
#include "elm_interface_atspi_component.eo.h"
|
||||||
#include "elm_interface_atspi_window.eo.h"
|
#include "elm_interface_atspi_window.eo.h"
|
||||||
#include "elm_interface_atspi_action.eo.h"
|
#include "elm_interface_atspi_action.eo.h"
|
||||||
|
#include "elm_interface_atspi_value.eo.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Accessibility Bus info not defined in atspi-constants.h
|
* Accessibility Bus info not defined in atspi-constants.h
|
||||||
|
@ -808,6 +810,71 @@ _action_property_get(const Eldbus_Service_Interface *interface, const char *prop
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Eldbus_Message*
|
||||||
|
_value_properties_set(const Eldbus_Service_Interface *interface, const char *property,
|
||||||
|
Eldbus_Message_Iter *iter, const Eldbus_Message *request_msg)
|
||||||
|
{
|
||||||
|
double value;
|
||||||
|
Eina_Bool ret;
|
||||||
|
const char *obj_path = eldbus_service_object_path_get(interface);
|
||||||
|
Eo *obj = _access_object_from_path(obj_path);
|
||||||
|
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
|
||||||
|
|
||||||
|
if (!eldbus_message_iter_arguments_get(iter, "d", &value))
|
||||||
|
{
|
||||||
|
return eldbus_message_error_new(request_msg, "org.freedesktop.DBus.Error.InvalidArgs", "Expected value of type: double.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!strcmp(property, "CurrentValue"))
|
||||||
|
{
|
||||||
|
eo_do(obj, ret = elm_interface_atspi_value_value_and_text_set(value, NULL));
|
||||||
|
Eldbus_Message *answer = eldbus_message_method_return_new(request_msg);
|
||||||
|
eldbus_message_arguments_append(answer, "b", ret);
|
||||||
|
return answer;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_value_properties_get(const Eldbus_Service_Interface *interface, const char *property,
|
||||||
|
Eldbus_Message_Iter *iter, const Eldbus_Message *request_msg EINA_UNUSED,
|
||||||
|
Eldbus_Message **error EINA_UNUSED)
|
||||||
|
{
|
||||||
|
double value;
|
||||||
|
const char *obj_path = eldbus_service_object_path_get(interface);
|
||||||
|
Eo *obj = _access_object_from_path(obj_path);
|
||||||
|
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
|
||||||
|
|
||||||
|
if (!strcmp(property, "CurrentValue"))
|
||||||
|
{
|
||||||
|
eo_do(obj, elm_interface_atspi_value_value_and_text_get(&value, NULL));
|
||||||
|
eldbus_message_iter_basic_append(iter, 'd', value);
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
if (!strcmp(property, "MinimumValue"))
|
||||||
|
{
|
||||||
|
eo_do(obj, elm_interface_atspi_value_range_get(&value, NULL, NULL));
|
||||||
|
eldbus_message_iter_basic_append(iter, 'd', value);
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
if (!strcmp(property, "MaximumValue"))
|
||||||
|
{
|
||||||
|
eo_do(obj, elm_interface_atspi_value_range_get(NULL, &value, NULL));
|
||||||
|
eldbus_message_iter_basic_append(iter, 'd', value);
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
if (!strcmp(property, "MinimumIncrement"))
|
||||||
|
{
|
||||||
|
eo_do(obj, value = elm_interface_atspi_value_increment_get());
|
||||||
|
eldbus_message_iter_basic_append(iter, 'd', value);
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static const Eldbus_Property accessible_properties[] = {
|
static const Eldbus_Property accessible_properties[] = {
|
||||||
{ "Name", "s", _accessible_property_get, NULL, 0 },
|
{ "Name", "s", _accessible_property_get, NULL, 0 },
|
||||||
{ "Description", "s", _accessible_property_get, NULL, 0 },
|
{ "Description", "s", _accessible_property_get, NULL, 0 },
|
||||||
|
@ -821,6 +888,14 @@ static const Eldbus_Property action_properties[] = {
|
||||||
{ NULL, NULL, NULL, NULL, 0 }
|
{ NULL, NULL, NULL, NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const Eldbus_Property value_properties[] = {
|
||||||
|
{ "MinimumValue", "d", NULL, NULL, 0 },
|
||||||
|
{ "MaximumValue", "d", NULL, NULL, 0 },
|
||||||
|
{ "MinimumIncrement", "d", NULL, NULL, 0 },
|
||||||
|
{ "CurrentValue", "d", NULL, NULL, 0 },
|
||||||
|
{ NULL, NULL, NULL, NULL, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
static const Eldbus_Service_Interface_Desc accessible_iface_desc = {
|
static const Eldbus_Service_Interface_Desc accessible_iface_desc = {
|
||||||
ATSPI_DBUS_INTERFACE_ACCESSIBLE, accessible_methods, NULL, accessible_properties, _accessible_property_get, NULL
|
ATSPI_DBUS_INTERFACE_ACCESSIBLE, accessible_methods, NULL, accessible_properties, _accessible_property_get, NULL
|
||||||
};
|
};
|
||||||
|
@ -837,6 +912,10 @@ static const Eldbus_Service_Interface_Desc action_iface_desc = {
|
||||||
ATSPI_DBUS_INTERFACE_ACTION, action_methods, NULL, action_properties, NULL, NULL
|
ATSPI_DBUS_INTERFACE_ACTION, action_methods, NULL, action_properties, NULL, NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const Eldbus_Service_Interface_Desc value_iface_desc = {
|
||||||
|
ATSPI_DBUS_INTERFACE_VALUE, NULL, NULL, value_properties, _value_properties_get, _value_properties_set
|
||||||
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_object_append_reference(Eldbus_Message_Iter *iter, Eo *obj)
|
_object_append_reference(Eldbus_Message_Iter *iter, Eo *obj)
|
||||||
{
|
{
|
||||||
|
@ -913,6 +992,8 @@ _append_item_fn(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED,
|
||||||
eldbus_message_iter_basic_append(iter_sub_array, 's', ATSPI_DBUS_INTERFACE_COMPONENT);
|
eldbus_message_iter_basic_append(iter_sub_array, 's', ATSPI_DBUS_INTERFACE_COMPONENT);
|
||||||
if (eo_isa(data, ELM_INTERFACE_ATSPI_ACTION_CLASS))
|
if (eo_isa(data, ELM_INTERFACE_ATSPI_ACTION_CLASS))
|
||||||
eldbus_message_iter_basic_append(iter_sub_array, 's', ATSPI_DBUS_INTERFACE_ACTION);
|
eldbus_message_iter_basic_append(iter_sub_array, 's', ATSPI_DBUS_INTERFACE_ACTION);
|
||||||
|
if (eo_isa(data, ELM_INTERFACE_ATSPI_VALUE_CLASS))
|
||||||
|
eldbus_message_iter_basic_append(iter_sub_array, 's', ATSPI_DBUS_INTERFACE_VALUE);
|
||||||
|
|
||||||
eldbus_message_iter_container_close(iter_struct, iter_sub_array);
|
eldbus_message_iter_container_close(iter_struct, iter_sub_array);
|
||||||
|
|
||||||
|
@ -1804,6 +1885,8 @@ static void _object_register(Eo *obj, char *path)
|
||||||
}
|
}
|
||||||
if (eo_isa(obj, ELM_INTERFACE_ATSPI_ACTION_CLASS))
|
if (eo_isa(obj, ELM_INTERFACE_ATSPI_ACTION_CLASS))
|
||||||
eldbus_service_interface_register(_a11y_bus, path, &action_iface_desc);
|
eldbus_service_interface_register(_a11y_bus, path, &action_iface_desc);
|
||||||
|
if (eo_isa(obj, ELM_INTERFACE_ATSPI_VALUE_CLASS))
|
||||||
|
eldbus_service_interface_register(_a11y_bus, path, &value_iface_desc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "elementary_config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <Elementary.h>
|
||||||
|
#include "elm_widget.h"
|
||||||
|
#include "elm_priv.h"
|
||||||
|
|
||||||
|
#define ELM_INTERFACE_ATSPI_VALUE_PROTECTED
|
||||||
|
|
||||||
|
#include "elm_interface_atspi_value.eo.h"
|
||||||
|
#include "elm_interface_atspi_value.eo.c"
|
|
@ -0,0 +1,46 @@
|
||||||
|
interface Elm_Interface_Atspi_Value ()
|
||||||
|
{
|
||||||
|
legacy_prefix: null;
|
||||||
|
eo_prefix: elm_interface_atspi_value;
|
||||||
|
data: null;
|
||||||
|
properties {
|
||||||
|
protected value_and_text {
|
||||||
|
get {
|
||||||
|
/*@ Gets value displayed by a accessible widget. */
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
return Eina_Bool; /*@ EINA_TRUE if setting widgets value has
|
||||||
|
successed, EINA_FALSE otherwise. */
|
||||||
|
}
|
||||||
|
values {
|
||||||
|
double value; /*@ Value of widget casted to floating point number. */
|
||||||
|
const char *text; /*@ string describing value in given context
|
||||||
|
eg. small, enough */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
protected range {
|
||||||
|
get {
|
||||||
|
/* Gets a range of all possible values and its description */
|
||||||
|
}
|
||||||
|
values {
|
||||||
|
double lower_limit;
|
||||||
|
double upper_limit;
|
||||||
|
const char *description;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
protected increment {
|
||||||
|
get {
|
||||||
|
/* Gets an minimal incrementation value */
|
||||||
|
}
|
||||||
|
values {
|
||||||
|
double increment;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
implements {
|
||||||
|
virtual::value_and_text::get;
|
||||||
|
virtual::value_and_text::set;
|
||||||
|
virtual::range::get;
|
||||||
|
virtual::increment::get;
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,6 +8,9 @@
|
||||||
#include "elm_widget_slider.h"
|
#include "elm_widget_slider.h"
|
||||||
#include "elm_widget_layout.h"
|
#include "elm_widget_layout.h"
|
||||||
|
|
||||||
|
#define ELM_INTERFACE_ATSPI_VALUE_PROTECTED
|
||||||
|
#include "elm_interface_atspi_value.eo.h"
|
||||||
|
|
||||||
#define MY_CLASS ELM_OBJ_SLIDER_CLASS
|
#define MY_CLASS ELM_OBJ_SLIDER_CLASS
|
||||||
|
|
||||||
#define MY_CLASS_NAME "Elm_Slider"
|
#define MY_CLASS_NAME "Elm_Slider"
|
||||||
|
@ -1186,4 +1189,47 @@ _elm_slider_class_constructor(Eo_Class *klass)
|
||||||
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
|
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A11Y Accessibility
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_elm_slider_elm_interface_atspi_value_value_and_text_get(Eo *obj EINA_UNUSED, Elm_Slider_Data *sd, double *value, const char **text)
|
||||||
|
{
|
||||||
|
if (value) *value = sd->val;
|
||||||
|
if (text) *text = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static Eina_Bool
|
||||||
|
_elm_slider_elm_interface_atspi_value_value_and_text_set(Eo *obj, Elm_Slider_Data *sd, double value, const char *text EINA_UNUSED)
|
||||||
|
{
|
||||||
|
double oldval = sd->val;
|
||||||
|
|
||||||
|
if (sd->val_min > value) return EINA_FALSE;
|
||||||
|
if (sd->val_max < value) return EINA_FALSE;
|
||||||
|
|
||||||
|
evas_object_smart_callback_call(obj, SIG_DRAG_START, NULL);
|
||||||
|
sd->val = value;
|
||||||
|
_visuals_refresh(obj);
|
||||||
|
sd->val = oldval;
|
||||||
|
_slider_update(obj, EINA_TRUE);
|
||||||
|
evas_object_smart_callback_call(obj, SIG_DRAG_STOP, NULL);
|
||||||
|
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_elm_slider_elm_interface_atspi_value_range_get(Eo *obj EINA_UNUSED, Elm_Slider_Data *sd, double *lower, double *upper, const char **descr)
|
||||||
|
{
|
||||||
|
if (lower) *lower = sd->val_min;
|
||||||
|
if (upper) *upper = sd->val_max;
|
||||||
|
if (descr) *descr = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static double
|
||||||
|
_elm_slider_elm_interface_atspi_value_increment_get(Eo *obj EINA_UNUSED, Elm_Slider_Data *sd)
|
||||||
|
{
|
||||||
|
return sd->step;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A11Y Accessibility - END
|
||||||
|
|
||||||
#include "elm_slider.eo.c"
|
#include "elm_slider.eo.c"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class Elm_Slider (Elm_Layout)
|
class Elm_Slider (Elm_Layout, Elm_Interface_Atspi_Value)
|
||||||
{
|
{
|
||||||
eo_prefix: elm_obj_slider;
|
eo_prefix: elm_obj_slider;
|
||||||
properties {
|
properties {
|
||||||
|
@ -375,6 +375,10 @@ class Elm_Slider (Elm_Layout)
|
||||||
Elm_Layout::text_aliases::get;
|
Elm_Layout::text_aliases::get;
|
||||||
Elm_Layout::content_aliases::get;
|
Elm_Layout::content_aliases::get;
|
||||||
Elm_Layout::sizing_eval;
|
Elm_Layout::sizing_eval;
|
||||||
|
Elm_Interface_Atspi_Value::value_and_text::get;
|
||||||
|
Elm_Interface_Atspi_Value::value_and_text::set;
|
||||||
|
Elm_Interface_Atspi_Value::range::get;
|
||||||
|
Elm_Interface_Atspi_Value::increment::get;
|
||||||
}
|
}
|
||||||
events {
|
events {
|
||||||
changed;
|
changed;
|
||||||
|
|
Loading…
Reference in New Issue