This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository enlightenment.
View the commit online.
commit 8c184e7ef0bdcebe4b775577d590a3837b0c1248
Author: rafspiny <rafsp...@gmail.com>
AuthorDate: Sat Aug 19 20:28:51 2023 +0200
Address shadowing warnings
---
src/modules/convertible/dbus_acceleration.c | 313 +++++++++++++------------
src/modules/convertible/e-gadget-convertible.c | 13 -
src/modules/convertible/e_mod_main.c | 17 +-
3 files changed, 166 insertions(+), 177 deletions(-)
diff --git a/src/modules/convertible/dbus_acceleration.c b/src/modules/convertible/dbus_acceleration.c
index 4d41d0d04..2be8ea95f 100644
--- a/src/modules/convertible/dbus_acceleration.c
+++ b/src/modules/convertible/dbus_acceleration.c
@@ -11,6 +11,164 @@
static DbusAccelerometer* accelerometer_dbus;
+static int
+_convertible_rotation_get(const enum screen_rotation orientation)
+{
+ switch (orientation)
+ {
+ case NORMAL: return 0;
+ case LEFT_UP: return 90;
+ case FLIPPED: return 180;
+ case RIGHT_UP: return 270;
+
+ default: return 0;
+ }
+}
+
+static const float *
+_get_matrix_rotation_transformation(int rotation)
+{
+ const float *transformation;
+ switch (rotation) {
+ case 90:
+ transformation = MATRIX_ROTATION_90;
+ break;
+ case 180:
+ transformation = MATRIX_ROTATION_180;
+ break;
+ case 270:
+ transformation = MATRIX_ROTATION_270;
+ break;
+ default:
+ transformation = MATRIX_ROTATION_IDENTITY;
+ }
+ return transformation;
+}
+
+
+static int
+_is_device_a_touch_pointer(int dev_counter, int num_properties, char **iterator)
+{
+ // Looking for a device with either a libinput property for calibration or the old evdev Axlis labels property.
+ int is_correct_device = EINA_FALSE;
+ for (int i = 0; i < num_properties; i++)
+ {
+ if (strstr(*iterator, "libinput Calibration Matrix"))
+ is_correct_device = EINA_TRUE;
+ if (strstr(*iterator, "Axis Labels"))
+ {
+ int num_ret, unit_size_ret;
+ Ecore_X_Atom format_ret;
+ char *result = ecore_x_input_device_property_get(dev_counter, *iterator, &num_ret, &format_ret, &unit_size_ret);
+ if (result) {
+ // TODO Shall check for the value "Abs MT Position"
+ }
+ DBG("Looks like I found a device with calibration capabilities");
+ is_correct_device = EINA_TRUE;
+ }
+ iterator++;
+ }
+ return is_correct_device;
+}
+
+
+static int
+_fetch_X_device_input_number(void)
+{
+ // I should get the touchscreen associated with the screen probably by looking at the classes of the input devices
+ // I need to submit my patch to add getters for other XIDeviceInfo fields, like raster mentioned in his commit.
+ const char *dev_name;
+ char **property_name;
+ int dev_num = ecore_x_input_device_num_get();
+ int dev_number = -1;
+
+ for (int dev_counter = 0; dev_counter < dev_num; dev_counter++)
+ {
+ dev_name = ecore_x_input_device_name_get(dev_counter);
+ // Less horrible hack that relies on the presence of a property containing the work Calibration
+ DBG("Found device with name %s", dev_name);
+ int num_properties;
+ property_name = ecore_x_input_device_properties_list(dev_counter, &num_properties);
+ DBG("Found %d properties", num_properties);
+ char **iterator = property_name;
+ int is_correct_device = _is_device_a_touch_pointer(dev_counter, num_properties, iterator);
+ if (is_correct_device == EINA_FALSE)
+ continue;
+ iterator = property_name;
+ for (int i = 0; i < num_properties; i++)
+ {
+ if (!strcmp(*iterator, CTM_name))
+ {
+ dev_number = dev_counter;
+ DBG("Setting device: %d", dev_number);
+ }
+ iterator++;
+ }
+ }
+
+ return dev_number;
+}
+
+
+/**
+ * Fetch a screen from its ID and rotate it according to the rotation parameter
+ * @param randr_id The randr2 id
+ * @param rotation The expected rotation
+ */
+static void
+_fetch_and_rotate_screen(const char* randr_id, enum screen_rotation orientation)
+{
+ DBG("Working on screen %s", randr_id);
+ E_Randr2_Screen *rotatable_screen = e_randr2_screen_id_find(randr_id);
+ E_Config_Randr2_Screen *screen_randr_cfg = e_randr2_config_screen_find(rotatable_screen, e_randr2_cfg);
+ int rotation = _convertible_rotation_get(orientation);
+ DBG("Screen %s is going to be rotated to %d", randr_id, rotation);
+
+ if (rotation == screen_randr_cfg->rotation)
+ {
+ WARN("Screen %s is already rotated to %d degrees", randr_id, rotation);
+ } else {
+ screen_randr_cfg->rotation = rotation;
+ e_randr2_config_apply();
+ DBG("Screen %s rotated to %d", randr_id, rotation);
+
+ int x_dev_num = _fetch_X_device_input_number();
+ if (x_dev_num == -1) {
+ ERR("Unable to find a pointer device with coordinate transformation capabilities");
+ return;
+ }
+ DBG("Rotating input number %d", x_dev_num);
+
+ int num_ret, unit_size_ret;
+ Ecore_X_Atom format_ret;
+ char *result = NULL;
+ TransformationMatrix *matrix = calloc(1, sizeof(TransformationMatrix));
+ if (matrix == NULL)
+ {
+ ERR("Unable to allocate memory for the transformation matrix");
+ return;
+ }
+
+ result = ecore_x_input_device_property_get(x_dev_num, CTM_name, &num_ret, &format_ret, &unit_size_ret);
+ if (result)
+ {
+ DBG("Device with coordinates transformation matrix");
+ // format_ret of 116 -> ECORE_X_ATOM_FLOAT
+ // num_ret of 9 -> 9 (float) to read
+ // unit_size_ret of 32 -> each float is 32 bits
+ memcpy(matrix->values, result, sizeof(matrix->values));
+ const float * rotation_matrix_2d = _get_matrix_rotation_transformation(rotation);
+ memcpy(matrix->values, rotation_matrix_2d, 6 * sizeof(*rotation_matrix_2d));
+ ecore_x_input_device_property_set(x_dev_num, CTM_name, matrix->values, num_ret, format_ret, unit_size_ret);
+
+ DBG("Input device %d rotated to %d", x_dev_num, rotation);
+ } else {
+ ERR("Unable to fetch coordinates transformation matrix for device %d", x_dev_num);
+ }
+ free(matrix);
+ }
+}
+
/**
* Helper to get the interface
* */
@@ -224,9 +382,6 @@ sensor_proxy_shutdown(void)
int
_convertible_rotation_get(const enum screen_rotation orientation);
-int
-_is_device_a_touch_pointer(int dev_counter, int num_properties, char **iterator);
-
/**
* Helper function to extract ta string property from the message
* @param msg The message coming from the get property invocation
@@ -326,155 +481,3 @@ on_accelerometer_orientation(void *data, const Eldbus_Message *msg, Eldbus_Pendi
}
}
-int
-_convertible_rotation_get(const enum screen_rotation orientation)
-{
- switch (orientation)
- {
- case NORMAL: return 0;
- case LEFT_UP: return 90;
- case FLIPPED: return 180;
- case RIGHT_UP: return 270;
-
- default: return 0;
- }
-}
-
-const float *
-_get_matrix_rotation_transformation(int rotation)
-{
- const float *transformation;
- switch (rotation) {
- case 90:
- transformation = MATRIX_ROTATION_90;
- break;
- case 180:
- transformation = MATRIX_ROTATION_180;
- break;
- case 270:
- transformation = MATRIX_ROTATION_270;
- break;
- default:
- transformation = MATRIX_ROTATION_IDENTITY;
- }
- return transformation;
-}
-
-int
-_fetch_X_device_input_number(void)
-{
- // I should get the touchscreen associated with the screen probably by looking at the classes of the input devices
- // I need to submit my patch to add getters for other XIDeviceInfo fields, like raster mentioned in his commit.
- const char *dev_name;
- char **property_name;
- int dev_num = ecore_x_input_device_num_get();
- int dev_number = -1;
-
- for (int dev_counter = 0; dev_counter < dev_num; dev_counter++)
- {
- dev_name = ecore_x_input_device_name_get(dev_counter);
- // Less horrible hack that relies on the presence of a property containing the work Calibration
- DBG("Found device with name %s", dev_name);
- int num_properties;
- property_name = ecore_x_input_device_properties_list(dev_counter, &num_properties);
- DBG("Found %d properties", num_properties);
- char **iterator = property_name;
- int is_correct_device = _is_device_a_touch_pointer(dev_counter, num_properties, iterator);
- if (is_correct_device == EINA_FALSE)
- continue;
- iterator = property_name;
- for (int i = 0; i < num_properties; i++)
- {
- if (!strcmp(*iterator, CTM_name))
- {
- dev_number = dev_counter;
- DBG("Setting device: %d", dev_number);
- }
- iterator++;
- }
- }
-
- return dev_number;
-}
-
-int
-_is_device_a_touch_pointer(int dev_counter, int num_properties, char **iterator)
-{
- // Looking for a device with either a libinput property for calibration or the old evdev Axlis labels property.
- int is_correct_device = EINA_FALSE;
- for (int i = 0; i < num_properties; i++)
- {
- if (strstr(*iterator, "libinput Calibration Matrix"))
- is_correct_device = EINA_TRUE;
- if (strstr(*iterator, "Axis Labels"))
- {
- int num_ret, unit_size_ret;
- Ecore_X_Atom format_ret;
- char *result = ecore_x_input_device_property_get(dev_counter, *iterator, &num_ret, &format_ret, &unit_size_ret);
- if (result) {
- // TODO Shall check for the value "Abs MT Position"
- }
- DBG("Looks like I found a device with calibration capabilities");
- is_correct_device = EINA_TRUE;
- }
- iterator++;
- }
- return is_correct_device;
-}
-
-/**
- * Fetch a screen from its ID and rotate it according to the rotation parameter
- * @param randr_id The randr2 id
- * @param rotation The expected rotation
- */
-void
-_fetch_and_rotate_screen(const char* randr_id, enum screen_rotation orientation)
-{
- DBG("Working on screen %s", randr_id);
- E_Randr2_Screen *rotatable_screen = e_randr2_screen_id_find(randr_id);
- E_Config_Randr2_Screen *screen_randr_cfg = e_randr2_config_screen_find(rotatable_screen, e_randr2_cfg);
- int rotation = _convertible_rotation_get(orientation);
- DBG("Screen %s is going to be rotated to %d", randr_id, rotation);
-
- if (rotation == screen_randr_cfg->rotation)
- {
- WARN("Screen %s is already rotated to %d degrees", randr_id, rotation);
- } else
- {
- screen_randr_cfg->rotation = rotation;
- e_randr2_config_apply();
- DBG("Screen %s rotated to %d", randr_id, rotation);
-
- int x_dev_num = _fetch_X_device_input_number();
- if (x_dev_num == -1)
- {
- ERR("Unable to find a pointer device with coordinate transformation capabilities");
- return;
- }
- DBG("Rotating input number %d", x_dev_num);
-
- int num_ret, unit_size_ret;
- Ecore_X_Atom format_ret;
- char *result = NULL;
- TransformationMatrix *matrix = calloc(1, sizeof(TransformationMatrix));
- EINA_SAFETY_ON_NULL_RETURN_VAL(matrix, NULL);
- result = ecore_x_input_device_property_get(x_dev_num, CTM_name, &num_ret, &format_ret, &unit_size_ret);
- if (result)
- {
-
- DBG("Device with coordinates transformation matrix");
- // format_ret of 116 -> ECORE_X_ATOM_FLOAT
- // num_ret of 9 -> 9 (float) to read
- // unit_size_ret of 32 -> each float is 32 bits
- memcpy(matrix->values, result, sizeof(matrix->values));
- const float * rotation_matrix_2d = _get_matrix_rotation_transformation(rotation);
- memcpy(matrix->values, rotation_matrix_2d, 6 * sizeof(*rotation_matrix_2d));
- ecore_x_input_device_property_set(x_dev_num, CTM_name, matrix->values, num_ret, format_ret, unit_size_ret);
-
- DBG("Input device %d rotated to %d", x_dev_num, rotation);
- } else {
- ERR("Unable to fetch coordinates transformation matrix for device %d", x_dev_num);
- }
- free(matrix);
- }
-}
diff --git a/src/modules/convertible/e-gadget-convertible.c b/src/modules/convertible/e-gadget-convertible.c
index 03e5f4572..051809d19 100644
--- a/src/modules/convertible/e-gadget-convertible.c
+++ b/src/modules/convertible/e-gadget-convertible.c
@@ -46,19 +46,6 @@ _keyboard_signal_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, const
DBG("Keyboard: Signal %s received from %s", sig, src);
}
-
-/**
- * Callback for gadget creation
- * */
-static void
-_gadget_created(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
-{
- DBG("Inside gadget created");
- // do_orient(inst, e_gadget_site_orient_get(obj), e_gadget_site_anchor_get(obj));
- evas_object_smart_callback_del_full(obj, "gadget_created", _gadget_created, NULL);
-}
-
-
void
update_instances(Eina_List *new_instances) {
instances = new_instances;
diff --git a/src/modules/convertible/e_mod_main.c b/src/modules/convertible/e_mod_main.c
index 892a7b3eb..5e69941e4 100644
--- a/src/modules/convertible/e_mod_main.c
+++ b/src/modules/convertible/e_mod_main.c
@@ -119,12 +119,11 @@ _gc_shutdown(E_Gadcon_Client *gcc)
static void
_gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient)
{
- Instance *inst;
Evas_Coord mw, mh;
char buf[4096];
const char *s = "float";
- inst = gcc->data;
+ Instance *instance = gcc->data;
switch (orient)
{
case E_GADCON_ORIENT_FLOAT:
@@ -191,13 +190,13 @@ _gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient)
break;
}
snprintf(buf, sizeof(buf), "e,state,orientation,%s", s);
- edje_object_signal_emit(inst->o_button, buf, "e");
- edje_object_message_signal_process(inst->o_button);
+ edje_object_signal_emit(instance->o_button, buf, "e");
+ edje_object_message_signal_process(instance->o_button);
mw = 0, mh = 0;
- edje_object_size_min_get(inst->o_button, &mw, &mh);
+ edje_object_size_min_get(instance->o_button, &mw, &mh);
if ((mw < 1) || (mh < 1))
- edje_object_size_min_calc(inst->o_button, &mw, &mh);
+ edje_object_size_min_calc(instance->o_button, &mw, &mh);
if (mw < 4) mw = 4;
if (mh < 4) mh = 4;
e_gadcon_client_aspect_set(gcc, mw, mh);
@@ -239,16 +238,16 @@ _gc_id_new(const E_Gadcon_Client_Class *client_class EINA_UNUSED)
static void
_cb_properties_changed(void *data, const Eldbus_Message *msg)
{
- Instance *inst = (Instance *) data;
+ Instance *instance = (Instance *) data;
Eldbus_Message_Iter *array, *invalidate;
char *iface;
if (!eldbus_message_arguments_get(msg, "sa{sv}as", &iface, &array, &invalidate))
ERR("Error getting data from properties changed signal.");
// Given that the property changed, let's get the new value
- Eldbus_Pending *pending_operation = eldbus_proxy_property_get(inst->accelerometer->sensor_proxy,
+ Eldbus_Pending *pending_operation = eldbus_proxy_property_get(instance->accelerometer->sensor_proxy,
"AccelerometerOrientation",
- on_accelerometer_orientation, inst);
+ on_accelerometer_orientation, instance);
if (!pending_operation)
ERR("Error: could not get property AccelerometerOrientation");
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.