daemon: Finish renaming to convertablet

This commit is contained in:
Yuki Joou 2023-08-27 23:35:12 +02:00
parent 8f940254ff
commit 3771c8792a
3 changed files with 42 additions and 40 deletions

View file

@ -136,7 +136,7 @@ int main(int argc, char** argv)
struct device_information device_info = get_device_info_for_name(argv[1]);
struct accel_monitor* monitor = 0;
struct miix_wlr_state* state = 0;
struct convertablet_wlr_state* state = 0;
if (device_info.screen_rotation_supported) {
monitor = accel_start_monitor(device_info.target_motion_sensor);
if (!monitor) {
@ -144,7 +144,7 @@ int main(int argc, char** argv)
return -1;
}
state = miix_wlr_init();
state = convertablet_wlr_init();
if (!state) {
fprintf(stderr, "Failed to connect to wayland server.\n");
return -1;
@ -177,7 +177,7 @@ int main(int argc, char** argv)
if (base_station_detector && base_station_detector->is_connected) {
if (last_accel_rotation != ACCEL_ROTATION_0DEG) {
miix_wlr_head_set_transform(
convertablet_wlr_head_set_transform(
state,
device_info.target_output,
device_info.sensor_to_output_rotation[ACCEL_ROTATION_0DEG]);
@ -190,7 +190,7 @@ int main(int argc, char** argv)
if (rotation == ACCEL_ROTATION_NO_CHANGE ||
rotation == last_accel_rotation)
continue;
miix_wlr_head_set_transform(
convertablet_wlr_head_set_transform(
state,
device_info.target_output,
device_info.sensor_to_output_rotation[rotation]);
@ -199,7 +199,7 @@ int main(int argc, char** argv)
if (device_info.screen_rotation_supported) {
accel_stop_monitor(monitor);
miix_wlr_cleanup(state);
convertablet_wlr_cleanup(state);
}
if (device_info.basestation_detection_supported)

View file

@ -15,7 +15,7 @@ static void head_handle_name(void* data,
struct zwlr_output_head_v1*,
const char* name)
{
struct miix_wlr_head* head = data;
struct convertablet_wlr_head* head = data;
head->name = strdup(name);
}
@ -121,9 +121,9 @@ static void output_manager_handle_head(void* data,
struct zwlr_output_manager_v1*,
struct zwlr_output_head_v1* wlr_head)
{
struct miix_wlr_state* state = data;
struct convertablet_wlr_state* state = data;
struct miix_wlr_head* head = calloc(1, sizeof(*head));
struct convertablet_wlr_head* head = calloc(1, sizeof(*head));
head->wlr_head = wlr_head;
wl_list_insert(state->heads.prev, &head->link);
zwlr_output_head_v1_add_listener(wlr_head, &head_listener, head);
@ -133,7 +133,7 @@ static void output_manager_handle_done(void* data,
struct zwlr_output_manager_v1*,
uint32_t serial)
{
struct miix_wlr_state* state = data;
struct convertablet_wlr_state* state = data;
state->serial = serial;
}
@ -155,7 +155,7 @@ static void registry_handle_global(void* data,
const char* interface,
uint32_t)
{
struct miix_wlr_state* state = data;
struct convertablet_wlr_state* state = data;
if (strcmp(interface, zwlr_output_manager_v1_interface.name) == 0) {
// TODO: Don't always bind version 4?
@ -174,7 +174,7 @@ static void registry_handle_global_remove(void*, struct wl_registry*, uint32_t)
static void config_handle_succeeded(void* data,
struct zwlr_output_configuration_v1* config)
{
struct miix_wlr_state* state = data;
struct convertablet_wlr_state* state = data;
state->is_working = false;
zwlr_output_configuration_v1_destroy(config);
printf("Applied configuration successfully!\n");
@ -183,7 +183,7 @@ static void config_handle_succeeded(void* data,
static void config_handle_failed(void* data,
struct zwlr_output_configuration_v1* config)
{
struct miix_wlr_state* state = data;
struct convertablet_wlr_state* state = data;
state->is_working = false;
zwlr_output_configuration_v1_destroy(config);
fprintf(stderr, "Failed to apply configuration\n");
@ -192,7 +192,7 @@ static void config_handle_failed(void* data,
static void config_handle_cancelled(void* data,
struct zwlr_output_configuration_v1* config)
{
struct miix_wlr_state* state = data;
struct convertablet_wlr_state* state = data;
state->is_working = false;
zwlr_output_configuration_v1_destroy(config);
fprintf(stderr, "Configuration cancelled\n");
@ -204,7 +204,7 @@ static const struct zwlr_output_configuration_v1_listener config_listener = {
.cancelled = config_handle_cancelled,
};
struct miix_wlr_state* miix_wlr_init()
struct convertablet_wlr_state* convertablet_wlr_init()
{
struct wl_display* display = wl_display_connect(NULL);
if (!display) {
@ -218,7 +218,8 @@ struct miix_wlr_state* miix_wlr_init()
return 0;
}
struct miix_wlr_state* state = calloc(1, sizeof(struct miix_wlr_state));
struct convertablet_wlr_state* state =
calloc(1, sizeof(struct convertablet_wlr_state));
state->is_working = false;
state->display = display;
@ -245,13 +246,14 @@ struct miix_wlr_state* miix_wlr_init()
return state;
}
char** miix_wlr_get_head_names(struct miix_wlr_state const* state)
char** convertablet_wlr_get_head_names(
struct convertablet_wlr_state const* state)
{
int head_count = wl_list_length(&state->heads);
char** head_name_list = calloc(head_count + 1, sizeof(char*));
size_t head_index = 0;
struct miix_wlr_head *head, *tmp_head;
struct convertablet_wlr_head *head, *tmp_head;
wl_list_for_each_safe(head, tmp_head, &state->heads, link)
{
head_name_list[head_index] = head->name;
@ -262,7 +264,7 @@ char** miix_wlr_get_head_names(struct miix_wlr_state const* state)
return head_name_list;
}
void miix_wlr_head_set_transform(struct miix_wlr_state* state,
void convertablet_wlr_head_set_transform(struct convertablet_wlr_state* state,
char const* const head_name,
enum wl_output_transform transform)
{
@ -273,8 +275,8 @@ void miix_wlr_head_set_transform(struct miix_wlr_state* state,
zwlr_output_configuration_v1_add_listener(
output_config, &config_listener, state);
struct miix_wlr_head* head;
struct miix_wlr_head* tmp_head;
struct convertablet_wlr_head* head;
struct convertablet_wlr_head* tmp_head;
wl_list_for_each_safe(head, tmp_head, &state->heads, link)
{
if (strcmp(head->name, head_name) != 0) continue;
@ -295,10 +297,10 @@ void miix_wlr_head_set_transform(struct miix_wlr_state* state,
;
}
void miix_wlr_cleanup(struct miix_wlr_state* state)
void miix_wlr_cleanup(struct convertablet_wlr_state* state)
{
struct miix_wlr_head* head;
struct miix_wlr_head* tmp_head;
struct convertablet_wlr_head* head;
struct convertablet_wlr_head* tmp_head;
wl_list_for_each_safe(head, tmp_head, &state->heads, link)
{
zwlr_output_head_v1_destroy(head->wlr_head);

View file

@ -6,13 +6,13 @@
#include "wlr-output-management-unstable-v1.h"
struct miix_wlr_head {
struct convertablet_wlr_head {
struct zwlr_output_head_v1* wlr_head;
char* name;
struct wl_list link;
};
struct miix_wlr_state {
struct convertablet_wlr_state {
bool is_working;
struct zwlr_output_manager_v1* output_manager;
@ -22,11 +22,11 @@ struct miix_wlr_state {
struct wl_list heads; // struct miix_wlr_head
};
struct miix_wlr_state* miix_wlr_init();
struct convertablet_wlr_state* convertablet_wlr_init();
char** miix_wlr_get_head_names(struct miix_wlr_state const*);
void miix_wlr_head_set_transform(struct miix_wlr_state*,
char** convertablet_wlr_get_head_names(struct convertablet_wlr_state const*);
void convertablet_wlr_head_set_transform(struct convertablet_wlr_state*,
char const* const head_name,
enum wl_output_transform);
void miix_wlr_cleanup(struct miix_wlr_state*);
void convertablet_wlr_cleanup(struct convertablet_wlr_state*);