This is an automated email from the git hooks/post-receive script.
git pushed a commit to reference refs/pull/49/head
in repository enlightenment.
View the commit online.
commit f39cc2d830e9e27dbd0a9917f4853cdfc501b691
Author: rafspiny <rafsp...@gmail.com>
AuthorDate: Sun Dec 31 14:03:56 2023 +0100
Rebase
---
src/modules/convertible/dbus_acceleration.c | 62 +++++++++++++++-----------
src/modules/convertible/dbus_acceleration.h | 6 ++-
src/modules/convertible/e-gadget-convertible.c | 2 +-
src/modules/convertible/e_mod_main.c | 53 +++++++++-------------
4 files changed, 62 insertions(+), 61 deletions(-)
diff --git a/src/modules/convertible/dbus_acceleration.c b/src/modules/convertible/dbus_acceleration.c
index 2be8ea95f..1483d984d 100644
--- a/src/modules/convertible/dbus_acceleration.c
+++ b/src/modules/convertible/dbus_acceleration.c
@@ -65,6 +65,7 @@ _is_device_a_touch_pointer(int dev_counter, int num_properties, char **iterator)
}
DBG("Looks like I found a device with calibration capabilities");
is_correct_device = EINA_TRUE;
+ free(result);
}
iterator++;
}
@@ -101,6 +102,7 @@ _fetch_X_device_input_number(void)
{
dev_number = dev_counter;
DBG("Setting device: %d", dev_number);
+ break;
}
iterator++;
}
@@ -120,7 +122,18 @@ _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);
+ if (rotatable_screen == NULL)
+ {
+ DBG("Failed to load screen for id %s", randr_id);
+ return;
+ }
+
E_Config_Randr2_Screen *screen_randr_cfg = e_randr2_config_screen_find(rotatable_screen, e_randr2_cfg);
+ if (screen_randr_cfg == NULL)
+ {
+ DBG("Failed to load screen configuration for id %s", randr_id);
+ return;
+ }
int rotation = _convertible_rotation_get(orientation);
DBG("Screen %s is going to be rotated to %d", randr_id, rotation);
@@ -165,6 +178,7 @@ _fetch_and_rotate_screen(const char* randr_id, enum screen_rotation orientation)
} else {
ERR("Unable to fetch coordinates transformation matrix for device %d", x_dev_num);
}
+ free(result);
free(matrix);
}
}
@@ -173,7 +187,7 @@ _fetch_and_rotate_screen(const char* randr_id, enum screen_rotation orientation)
* Helper to get the interface
* */
static Eldbus_Proxy *
-get_dbus_interface(const char *IFACE)
+_get_dbus_interface(const char *IFACE)
{
DBG("Working on interface: %s", IFACE);
Eldbus_Connection *conn;
@@ -228,16 +242,19 @@ _access_bool_property(const Eldbus_Message *msg, Eldbus_Message_Iter **variant,
return res;
}
- if (type[1])
+ if (type[0] != 'b')
{
- WARN("It is a complex type, not handle yet.");
+ WARN("Expected type is int.");
res = EINA_FALSE;
+ free(type);
+ return res;
}
- if (type[0] != 'b')
+ if (type[1])
{
- WARN("Expected type is int.");
+ WARN("It is a complex type, not handle yet.");
res = EINA_FALSE;
}
+
if (!eldbus_message_iter_arguments_get((*variant), "b", boolean_property_value))
{
WARN("error in eldbus_message_iter_arguments_get()");
@@ -379,16 +396,13 @@ sensor_proxy_shutdown(void)
eldbus_shutdown();
}
-int
-_convertible_rotation_get(const enum screen_rotation orientation);
-
/**
* Helper function to extract ta string property from the message
* @param msg The message coming from the get property invocation
* @param variant
* @return Enum specifying the orientation. UNDEFINED by default
*/
-enum screen_rotation
+static enum screen_rotation
_access_string_property(const Eldbus_Message *msg, Eldbus_Message_Iter **variant)
{
enum screen_rotation rotation = UNDEFINED;
@@ -404,34 +418,33 @@ _access_string_property(const Eldbus_Message *msg, Eldbus_Message_Iter **variant
WARN("Unable to get the type.");
return rotation;
}
-
- type = eldbus_message_iter_signature_get((*variant));
- if (type[1])
- {
- WARN("It is a complex type, not handle yet.");
- }
if (type[0] != 's')
{
WARN("Expected type is string(s).");
+ free(type);
+ return rotation;
}
- const char **string_property_value = calloc(PATH_MAX, sizeof(char));
- EINA_SAFETY_ON_NULL_RETURN_VAL(string_property_value, EINA_FALSE);
- if (!eldbus_message_iter_arguments_get((*variant), "s", string_property_value))
+ if (type[1])
+ {
+ WARN("It is a complex type, not handle yet.");
+ }
+
+ const char *string_property_value;
+ if (!eldbus_message_iter_arguments_get(variant, "s", &string_property_value))
{
WARN("error in eldbus_message_iter_arguments_get()");
}
- if (!strcmp(ACCELEROMETER_ORIENTATION_RIGHT, *string_property_value))
+ if (strcmp(ACCELEROMETER_ORIENTATION_RIGHT, string_property_value) == 0)
rotation = RIGHT_UP;
- if (!strcmp(ACCELEROMETER_ORIENTATION_LEFT, *string_property_value))
+ if (strcmp(ACCELEROMETER_ORIENTATION_LEFT, string_property_value) == 0)
rotation = LEFT_UP;
- if (!strcmp(ACCELEROMETER_ORIENTATION_BOTTOM, *string_property_value))
+ if (strcmp(ACCELEROMETER_ORIENTATION_BOTTOM, string_property_value) == 0)
rotation = FLIPPED;
- if (!strcmp(ACCELEROMETER_ORIENTATION_NORMAL, *string_property_value))
+ if (strcmp(ACCELEROMETER_ORIENTATION_NORMAL, string_property_value) == 0)
rotation = NORMAL;
free(type);
- free(string_property_value);
return rotation;
}
@@ -439,7 +452,7 @@ void
on_accelerometer_orientation(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED)
{
INF("New orientation received");
- Instance *inst = (Instance *) data;
+ Instance *inst = data;
if (inst->locked_position == EINA_TRUE)
{
@@ -447,7 +460,6 @@ on_accelerometer_orientation(void *data, const Eldbus_Message *msg, Eldbus_Pendi
return;
}
-
const char *errname, *errmsg;
enum screen_rotation orientation;
Eldbus_Message_Iter *variant = NULL;
diff --git a/src/modules/convertible/dbus_acceleration.h b/src/modules/convertible/dbus_acceleration.h
index 2724c1914..c2f864702 100644
--- a/src/modules/convertible/dbus_acceleration.h
+++ b/src/modules/convertible/dbus_acceleration.h
@@ -26,11 +26,13 @@ struct _DbusAccelerometer
/**
* Fetch the DBUS interfaces and fill the DbusAccelerometer struct
* */
-DbusAccelerometer* sensor_proxy_init(void);
+DbusAccelerometer* sensor_proxy_init();
+void sensor_proxy_shutdown();
+
void
-sensor_proxy_shutdown(void);
+on_has_accelerometer(void *data EINA_UNUSED, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED);
/**
* Callback definition to handle the request of the accelerometer property of DBUS interface net.hadess.SensorProxy
diff --git a/src/modules/convertible/e-gadget-convertible.c b/src/modules/convertible/e-gadget-convertible.c
index 051809d19..a00edefef 100644
--- a/src/modules/convertible/e-gadget-convertible.c
+++ b/src/modules/convertible/e-gadget-convertible.c
@@ -12,7 +12,7 @@ static void
_update_instances(const Instance *current_instance)
{
Eina_List *l;
- Instance *instance = NULL;
+ Instance *instance;
EINA_LIST_FOREACH(instances, l, instance)
{
if (current_instance != instance)
diff --git a/src/modules/convertible/e_mod_main.c b/src/modules/convertible/e_mod_main.c
index d8126c7f5..c1d13abac 100644
--- a/src/modules/convertible/e_mod_main.c
+++ b/src/modules/convertible/e_mod_main.c
@@ -17,9 +17,8 @@ E_Module *convertible_module;
Instance *inst;
// Configuration
-extern Convertible_Config *convertible_config = NULL;
-static E_Config_DD *conf_edd = NULL;
-Convertible_Config *conf = NULL;
+extern Convertible_Config *convertible_config;
+extern E_Config_DD *edd;
// Logger
int _convertible_log_dom;
@@ -35,9 +34,6 @@ E_API E_Module_Api e_modapi =
/* LIST OF INSTANCES */
static Eina_List *instances = NULL;
-/* Other functions for configuration */
-static void _conf_new(void);
-static void _conf_free(void);
/* gadcon requirements */
static E_Gadcon_Client *_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style);
@@ -124,10 +120,10 @@ static void
_gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient)
{
Evas_Coord mw, mh;
- char buf[4096];
+ char buf[PATH_MAX];
const char *s = "float";
- Instance *instance = gcc->data;
+ Instance *current_instance = gcc->data;
switch (orient)
{
case E_GADCON_ORIENT_FLOAT:
@@ -194,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(instance->o_button, buf, "e");
- edje_object_message_signal_process(instance->o_button);
+ edje_object_signal_emit(current_instance->o_button, buf, "e");
+ edje_object_message_signal_process(current_instance->o_button);
mw = 0, mh = 0;
- edje_object_size_min_get(instance->o_button, &mw, &mh);
+ edje_object_size_min_get(current_instance->o_button, &mw, &mh);
if ((mw < 1) || (mh < 1))
- edje_object_size_min_calc(instance->o_button, &mw, &mh);
+ edje_object_size_min_calc(current_instance->o_button, &mw, &mh);
if (mw < 4) mw = 4;
if (mh < 4) mh = 4;
e_gadcon_client_aspect_set(gcc, mw, mh);
@@ -228,7 +224,7 @@ _gc_icon(const E_Gadcon_Client_Class *client_class EINA_UNUSED, Evas *evas)
static const char *
_gc_id_new(const E_Gadcon_Client_Class *client_class EINA_UNUSED)
{
- static char buf[4096];
+ static char buf[PATH_MAX];
snprintf(buf, sizeof(buf), "%s.%d", client_class->name,
eina_list_count(instances) + 1);
@@ -242,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 *instance = (Instance *) data;
+ Instance *current_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(instance->accelerometer->sensor_proxy,
+ Eldbus_Pending *pending_operation = eldbus_proxy_property_get(current_instance->accelerometer->sensor_proxy,
"AccelerometerOrientation",
- on_accelerometer_orientation, instance);
+ on_accelerometer_orientation, current_instance);
if (!pending_operation)
ERR("Error: could not get property AccelerometerOrientation");
}
@@ -305,14 +301,15 @@ e_modapi_init(E_Module *m)
E_Randr2_Screen *screen = e_randr2_screen_id_find(zone->randr2_id);
DBG("name randr2 id %s", zone->randr2_id);
DBG("rot_90 %i", screen->info.can_rot_90);
+
// Arbitrarily chosen a condition to check that rotation is enabled
if (screen->info.can_rot_90 == EINA_TRUE)
{
char *randr2_id = strdup(zone->randr2_id);
if (randr2_id == NULL)
ERR("Can't copy the screen name");
-
- inst->randr2_ids = eina_list_append(inst->randr2_ids, randr2_id);
+ else
+ inst->randr2_ids = eina_list_append(inst->randr2_ids, randr2_id);
if (eina_error_get())
ERR("Memory is low. List allocation failed.");
}
@@ -326,12 +323,10 @@ e_modapi_init(E_Module *m)
e_gadcon_provider_register(&_gadcon_class);
INF("Creating menu entries for settings");
- /* create Screen configuration category
- *
- * NB: If the category already exists, this function just returns */
- e_configure_registry_category_add("screen", 30, _("Screen"), NULL, "preferences-desktop-display");
- e_configure_registry_item_add("screen/convertible", 30, "convertible", NULL,
- theme_overlay_path, e_int_config_convertible_module);
+ e_configure_registry_category_add("extensions", 90, "Extensions", NULL,
+ "preferences-extensions");
+ e_configure_registry_item_add("extensions/convertible", 30, "convertible", NULL,
+ "preferences-desktop-convertible", e_int_config_convertible_module);
instances = eina_list_append(instances, inst);
@@ -373,15 +368,7 @@ e_modapi_save(E_Module *m EINA_UNUSED)
{
if (convertible_config)
{
- e_config_domain_save("module.convertible", conf_edd, convertible_config);
+ e_config_domain_save("module.convertible", edd, convertible_config);
}
return 1;
}
-
-static void
-_conf_new(void)
-{
- conf = E_NEW(Convertible_Config, 1);
- conf->disable_keyboard_on_rotation = 1;
- e_config_save_queue();
-}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.