all: Fixed formatting
This commit is contained in:
parent
3fa9c8d193
commit
ce96e70e66
3 changed files with 10 additions and 12 deletions
|
@ -72,8 +72,7 @@ static int monitor_thread(void* data)
|
|||
return 0;
|
||||
}
|
||||
|
||||
struct accel_monitor* accel_start_monitor(
|
||||
char const* const sysfs_device_path)
|
||||
struct accel_monitor* accel_start_monitor(char const* const sysfs_device_path)
|
||||
{
|
||||
mtx_t current_data_lock;
|
||||
if (mtx_init(¤t_data_lock, mtx_plain) != thrd_success) return 0;
|
||||
|
@ -127,8 +126,7 @@ static bool axis_is_mostly_negative(int16_t axis)
|
|||
return axis <= -500;
|
||||
}
|
||||
|
||||
enum accel_rotation accel_get_current_rotation(
|
||||
struct accel_monitor* monitor)
|
||||
enum accel_rotation accel_get_current_rotation(struct accel_monitor* monitor)
|
||||
{
|
||||
if (mtx_lock(&monitor->current_data_lock) != thrd_success)
|
||||
return ACCEL_ROTATION_NO_CHANGE;
|
||||
|
|
|
@ -30,7 +30,6 @@ struct accel_monitor {
|
|||
atomic_bool data_is_ready;
|
||||
};
|
||||
|
||||
struct accel_monitor* accel_start_monitor(
|
||||
char const* const sysfs_device_path);
|
||||
enum accel_rotation accel_get_current_rotation(struct accel_monitor*);
|
||||
void accel_stop_monitor(struct accel_monitor*);
|
||||
struct accel_monitor* accel_start_monitor(char const* const sysfs_device_path);
|
||||
enum accel_rotation accel_get_current_rotation(struct accel_monitor*);
|
||||
void accel_stop_monitor(struct accel_monitor*);
|
||||
|
|
9
main.c
9
main.c
|
@ -20,8 +20,7 @@ static enum accel_rotation last_accel_rotation = ACCEL_ROTATION_NO_CHANGE;
|
|||
|
||||
int main(int, char**)
|
||||
{
|
||||
struct accel_monitor* monitor =
|
||||
accel_start_monitor(DEFAULT_MOTION_SENSOR);
|
||||
struct accel_monitor* monitor = accel_start_monitor(DEFAULT_MOTION_SENSOR);
|
||||
|
||||
if (!monitor) {
|
||||
fprintf(stderr, "Failed to start iio motion monitoring\n");
|
||||
|
@ -34,12 +33,14 @@ int main(int, char**)
|
|||
if (!monitor->data_is_ready) continue;
|
||||
|
||||
enum accel_rotation rotation = accel_get_current_rotation(monitor);
|
||||
if (rotation == ACCEL_ROTATION_NO_CHANGE || rotation == last_accel_rotation) continue;
|
||||
if (rotation == ACCEL_ROTATION_NO_CHANGE ||
|
||||
rotation == last_accel_rotation)
|
||||
continue;
|
||||
miix_wlr_head_set_transform(
|
||||
state, DEFAULT_OUTPUT, SENSOR_TO_OUTPUT_ROTATION[rotation]);
|
||||
last_accel_rotation = rotation;
|
||||
}
|
||||
|
||||
accel_stop_monitor(monitor);
|
||||
accel_stop_monitor(monitor);
|
||||
miix_wlr_cleanup(state);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue