rename config apply cmds

This commit is contained in:
Tony Crisci 2017-12-16 12:14:24 -05:00
parent f4a5a0ead4
commit f16aa3c0ad
20 changed files with 37 additions and 22 deletions

View file

@ -42,9 +42,6 @@ enum expected_args {
EXPECTED_EQUAL_TO EXPECTED_EQUAL_TO
}; };
void input_cmd_apply(struct input_config *input);
void seat_cmd_apply(struct seat_config *seat);
struct cmd_results *checkarg(int argc, const char *name, struct cmd_results *checkarg(int argc, const char *name,
enum expected_args type, int val); enum expected_args type, int val);

View file

@ -384,6 +384,7 @@ int input_identifier_cmp(const void *item, const void *data);
struct input_config *new_input_config(const char* identifier); struct input_config *new_input_config(const char* identifier);
void merge_input_config(struct input_config *dst, struct input_config *src); void merge_input_config(struct input_config *dst, struct input_config *src);
void free_input_config(struct input_config *ic); void free_input_config(struct input_config *ic);
void apply_input_config(struct input_config *input);
int seat_name_cmp(const void *item, const void *data); int seat_name_cmp(const void *item, const void *data);
struct seat_config *new_seat_config(const char* name); struct seat_config *new_seat_config(const char* name);
@ -392,6 +393,7 @@ void free_seat_config(struct seat_config *ic);
struct seat_attachment_config *seat_attachment_config_new(); struct seat_attachment_config *seat_attachment_config_new();
struct seat_attachment_config *seat_config_get_attachment( struct seat_attachment_config *seat_config_get_attachment(
struct seat_config *seat_config, char *identifier); struct seat_config *seat_config, char *identifier);
void apply_seat_config(struct seat_config *seat);
int output_name_cmp(const void *item, const void *data); int output_name_cmp(const void *item, const void *data);
struct output_config *new_output_config(); struct output_config *new_output_config();

View file

@ -57,7 +57,7 @@ struct cmd_results *checkarg(int argc, const char *name, enum expected_args type
return error; return error;
} }
void input_cmd_apply(struct input_config *input) { void apply_input_config(struct input_config *input) {
int i; int i;
i = list_seq_find(config->input_configs, input_identifier_cmp, input->identifier); i = list_seq_find(config->input_configs, input_identifier_cmp, input->identifier);
if (i >= 0) { if (i >= 0) {
@ -74,7 +74,7 @@ void input_cmd_apply(struct input_config *input) {
sway_input_manager_apply_input_config(input_manager, input); sway_input_manager_apply_input_config(input_manager, input);
} }
void seat_cmd_apply(struct seat_config *seat) { void apply_seat_config(struct seat_config *seat) {
int i; int i;
i = list_seq_find(config->seat_configs, seat_name_cmp, seat->name); i = list_seq_find(config->seat_configs, seat_name_cmp, seat->name);
if (i >= 0) { if (i >= 0) {

View file

@ -1,5 +1,6 @@
#include <string.h> #include <string.h>
#include <strings.h> #include <strings.h>
#include "sway/config.h"
#include "sway/commands.h" #include "sway/commands.h"
#include "sway/input/input-manager.h" #include "sway/input/input-manager.h"
@ -24,6 +25,6 @@ struct cmd_results *input_cmd_accel_profile(int argc, char **argv) {
"Expected 'accel_profile <adaptive|flat>'"); "Expected 'accel_profile <adaptive|flat>'");
} }
input_cmd_apply(new_config); apply_input_config(new_config);
return cmd_results_new(CMD_SUCCESS, NULL, NULL); return cmd_results_new(CMD_SUCCESS, NULL, NULL);
} }

View file

@ -1,6 +1,7 @@
#include <string.h> #include <string.h>
#include <strings.h> #include <strings.h>
#include "sway/commands.h" #include "sway/commands.h"
#include "sway/config.h"
#include "sway/input/input-manager.h" #include "sway/input/input-manager.h"
#include "log.h" #include "log.h"
@ -29,6 +30,6 @@ struct cmd_results *input_cmd_click_method(int argc, char **argv) {
"Expected 'click_method <none|button_areas|clickfinger'"); "Expected 'click_method <none|button_areas|clickfinger'");
} }
input_cmd_apply(new_config); apply_input_config(new_config);
return cmd_results_new(CMD_SUCCESS, NULL, NULL); return cmd_results_new(CMD_SUCCESS, NULL, NULL);
} }

View file

@ -1,5 +1,6 @@
#include <string.h> #include <string.h>
#include <strings.h> #include <strings.h>
#include "sway/config.h"
#include "sway/commands.h" #include "sway/commands.h"
#include "sway/input/input-manager.h" #include "sway/input/input-manager.h"
@ -24,6 +25,6 @@ struct cmd_results *input_cmd_drag_lock(int argc, char **argv) {
"Expected 'drag_lock <enabled|disabled>'"); "Expected 'drag_lock <enabled|disabled>'");
} }
input_cmd_apply(new_config); apply_input_config(new_config);
return cmd_results_new(CMD_SUCCESS, NULL, NULL); return cmd_results_new(CMD_SUCCESS, NULL, NULL);
} }

View file

@ -1,5 +1,6 @@
#include <string.h> #include <string.h>
#include <strings.h> #include <strings.h>
#include "sway/config.h"
#include "sway/commands.h" #include "sway/commands.h"
#include "sway/input/input-manager.h" #include "sway/input/input-manager.h"
@ -23,6 +24,6 @@ struct cmd_results *input_cmd_dwt(int argc, char **argv) {
"Expected 'dwt <enabled|disabled>'"); "Expected 'dwt <enabled|disabled>'");
} }
input_cmd_apply(new_config); apply_input_config(new_config);
return cmd_results_new(CMD_SUCCESS, NULL, NULL); return cmd_results_new(CMD_SUCCESS, NULL, NULL);
} }

View file

@ -1,5 +1,6 @@
#include <string.h> #include <string.h>
#include <strings.h> #include <strings.h>
#include "sway/config.h"
#include "sway/commands.h" #include "sway/commands.h"
#include "sway/input/input-manager.h" #include "sway/input/input-manager.h"
#include "log.h" #include "log.h"
@ -30,6 +31,6 @@ struct cmd_results *input_cmd_events(int argc, char **argv) {
"Expected 'events <enabled|disabled|disabled_on_external_mouse>'"); "Expected 'events <enabled|disabled|disabled_on_external_mouse>'");
} }
input_cmd_apply(new_config); apply_input_config(new_config);
return cmd_results_new(CMD_SUCCESS, NULL, NULL); return cmd_results_new(CMD_SUCCESS, NULL, NULL);
} }

View file

@ -1,5 +1,6 @@
#include <string.h> #include <string.h>
#include <strings.h> #include <strings.h>
#include "sway/config.h"
#include "sway/commands.h" #include "sway/commands.h"
#include "sway/input/input-manager.h" #include "sway/input/input-manager.h"
@ -24,6 +25,6 @@ struct cmd_results *input_cmd_left_handed(int argc, char **argv) {
"Expected 'left_handed <enabled|disabled>'"); "Expected 'left_handed <enabled|disabled>'");
} }
input_cmd_apply(new_config); apply_input_config(new_config);
return cmd_results_new(CMD_SUCCESS, NULL, NULL); return cmd_results_new(CMD_SUCCESS, NULL, NULL);
} }

View file

@ -1,5 +1,6 @@
#include <string.h> #include <string.h>
#include <strings.h> #include <strings.h>
#include "sway/config.h"
#include "sway/commands.h" #include "sway/commands.h"
#include "sway/input/input-manager.h" #include "sway/input/input-manager.h"
@ -25,6 +26,6 @@ struct cmd_results *input_cmd_middle_emulation(int argc, char **argv) {
"Expected 'middle_emulation <enabled|disabled>'"); "Expected 'middle_emulation <enabled|disabled>'");
} }
input_cmd_apply(new_config); apply_input_config(new_config);
return cmd_results_new(CMD_SUCCESS, NULL, NULL); return cmd_results_new(CMD_SUCCESS, NULL, NULL);
} }

View file

@ -1,5 +1,6 @@
#include <string.h> #include <string.h>
#include <strings.h> #include <strings.h>
#include "sway/config.h"
#include "sway/commands.h" #include "sway/commands.h"
#include "sway/input/input-manager.h" #include "sway/input/input-manager.h"
@ -24,6 +25,6 @@ struct cmd_results *input_cmd_natural_scroll(int argc, char **argv) {
"Expected 'natural_scroll <enabled|disabled>'"); "Expected 'natural_scroll <enabled|disabled>'");
} }
input_cmd_apply(new_config); apply_input_config(new_config);
return cmd_results_new(CMD_SUCCESS, NULL, NULL); return cmd_results_new(CMD_SUCCESS, NULL, NULL);
} }

View file

@ -1,5 +1,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "sway/config.h"
#include "sway/commands.h" #include "sway/commands.h"
#include "sway/input/input-manager.h" #include "sway/input/input-manager.h"
@ -22,6 +23,6 @@ struct cmd_results *input_cmd_pointer_accel(int argc, char **argv) {
} }
new_config->pointer_accel = pointer_accel; new_config->pointer_accel = pointer_accel;
input_cmd_apply(new_config); apply_input_config(new_config);
return cmd_results_new(CMD_SUCCESS, NULL, NULL); return cmd_results_new(CMD_SUCCESS, NULL, NULL);
} }

View file

@ -1,5 +1,6 @@
#include <string.h> #include <string.h>
#include <strings.h> #include <strings.h>
#include "sway/config.h"
#include "sway/commands.h" #include "sway/commands.h"
#include "sway/input/input-manager.h" #include "sway/input/input-manager.h"
@ -28,6 +29,6 @@ struct cmd_results *input_cmd_scroll_method(int argc, char **argv) {
"Expected 'scroll_method <none|two_finger|edge|on_button_down>'"); "Expected 'scroll_method <none|two_finger|edge|on_button_down>'");
} }
input_cmd_apply(new_config); apply_input_config(new_config);
return cmd_results_new(CMD_SUCCESS, NULL, NULL); return cmd_results_new(CMD_SUCCESS, NULL, NULL);
} }

View file

@ -1,5 +1,6 @@
#include <string.h> #include <string.h>
#include <strings.h> #include <strings.h>
#include "sway/config.h"
#include "sway/commands.h" #include "sway/commands.h"
#include "sway/input/input-manager.h" #include "sway/input/input-manager.h"
#include "log.h" #include "log.h"
@ -27,6 +28,6 @@ struct cmd_results *input_cmd_tap(int argc, char **argv) {
sway_log(L_DEBUG, "apply-tap for device: %s", sway_log(L_DEBUG, "apply-tap for device: %s",
current_input_config->identifier); current_input_config->identifier);
input_cmd_apply(new_config); apply_input_config(new_config);
return cmd_results_new(CMD_SUCCESS, NULL, NULL); return cmd_results_new(CMD_SUCCESS, NULL, NULL);
} }

View file

@ -1,4 +1,5 @@
#define _XOPEN_SOURCE 700 #define _XOPEN_SOURCE 700
#include "sway/config.h"
#include "sway/commands.h" #include "sway/commands.h"
#include "sway/input/input-manager.h" #include "sway/input/input-manager.h"
#include "log.h" #include "log.h"
@ -19,6 +20,6 @@ struct cmd_results *input_cmd_xkb_layout(int argc, char **argv) {
sway_log(L_DEBUG, "apply-xkb_layout for device: %s", sway_log(L_DEBUG, "apply-xkb_layout for device: %s",
current_input_config->identifier); current_input_config->identifier);
input_cmd_apply(new_config); apply_input_config(new_config);
return cmd_results_new(CMD_SUCCESS, NULL, NULL); return cmd_results_new(CMD_SUCCESS, NULL, NULL);
} }

View file

@ -1,4 +1,5 @@
#define _XOPEN_SOURCE 700 #define _XOPEN_SOURCE 700
#include "sway/config.h"
#include "sway/commands.h" #include "sway/commands.h"
#include "sway/input/input-manager.h" #include "sway/input/input-manager.h"
#include "log.h" #include "log.h"
@ -19,6 +20,6 @@ struct cmd_results *input_cmd_xkb_model(int argc, char **argv) {
sway_log(L_DEBUG, "apply-xkb_model for device: %s", sway_log(L_DEBUG, "apply-xkb_model for device: %s",
current_input_config->identifier); current_input_config->identifier);
input_cmd_apply(new_config); apply_input_config(new_config);
return cmd_results_new(CMD_SUCCESS, NULL, NULL); return cmd_results_new(CMD_SUCCESS, NULL, NULL);
} }

View file

@ -1,4 +1,5 @@
#define _XOPEN_SOURCE 700 #define _XOPEN_SOURCE 700
#include "sway/config.h"
#include "sway/commands.h" #include "sway/commands.h"
#include "sway/input/input-manager.h" #include "sway/input/input-manager.h"
#include "log.h" #include "log.h"
@ -19,6 +20,6 @@ struct cmd_results *input_cmd_xkb_options(int argc, char **argv) {
sway_log(L_DEBUG, "apply-xkb_options for device: %s", sway_log(L_DEBUG, "apply-xkb_options for device: %s",
current_input_config->identifier); current_input_config->identifier);
input_cmd_apply(new_config); apply_input_config(new_config);
return cmd_results_new(CMD_SUCCESS, NULL, NULL); return cmd_results_new(CMD_SUCCESS, NULL, NULL);
} }

View file

@ -1,4 +1,5 @@
#define _XOPEN_SOURCE 700 #define _XOPEN_SOURCE 700
#include "sway/config.h"
#include "sway/commands.h" #include "sway/commands.h"
#include "sway/input/input-manager.h" #include "sway/input/input-manager.h"
#include "log.h" #include "log.h"
@ -19,6 +20,6 @@ struct cmd_results *input_cmd_xkb_rules(int argc, char **argv) {
sway_log(L_DEBUG, "apply-xkb_rules for device: %s", sway_log(L_DEBUG, "apply-xkb_rules for device: %s",
current_input_config->identifier); current_input_config->identifier);
input_cmd_apply(new_config); apply_input_config(new_config);
return cmd_results_new(CMD_SUCCESS, NULL, NULL); return cmd_results_new(CMD_SUCCESS, NULL, NULL);
} }

View file

@ -1,4 +1,5 @@
#define _XOPEN_SOURCE 700 #define _XOPEN_SOURCE 700
#include "sway/config.h"
#include "sway/commands.h" #include "sway/commands.h"
#include "sway/input/input-manager.h" #include "sway/input/input-manager.h"
#include "log.h" #include "log.h"
@ -19,6 +20,6 @@ struct cmd_results *input_cmd_xkb_variant(int argc, char **argv) {
sway_log(L_DEBUG, "apply-xkb_variant for device: %s", sway_log(L_DEBUG, "apply-xkb_variant for device: %s",
current_input_config->identifier); current_input_config->identifier);
input_cmd_apply(new_config); apply_input_config(new_config);
return cmd_results_new(CMD_SUCCESS, NULL, NULL); return cmd_results_new(CMD_SUCCESS, NULL, NULL);
} }

View file

@ -21,6 +21,6 @@ struct cmd_results *seat_cmd_attach(int argc, char **argv) {
new_attachment->identifier = strdup(argv[0]); new_attachment->identifier = strdup(argv[0]);
list_add(new_config->attachments, new_attachment); list_add(new_config->attachments, new_attachment);
seat_cmd_apply(new_config); apply_seat_config(new_config);
return cmd_results_new(CMD_SUCCESS, NULL, NULL); return cmd_results_new(CMD_SUCCESS, NULL, NULL);
} }