parent
							
								
									c173d30b92
								
							
						
					
					
						commit
						92fef27eaa
					
				| @ -1,15 +1,18 @@ | ||||
| #include "sway/input/seat.h" | ||||
| 
 | ||||
| struct sway_keyboard { | ||||
| 	struct sway_seat *seat; | ||||
| 	struct sway_input_device *device; | ||||
| 	struct sway_seat_device *seat_device; | ||||
| 	struct wl_list link; // sway_seat::keyboards
 | ||||
| 
 | ||||
| 	struct xkb_keymap *keymap; | ||||
| 
 | ||||
| 	struct wl_listener keyboard_key; | ||||
| 	struct wl_listener keyboard_modifiers; | ||||
| }; | ||||
| 
 | ||||
| struct sway_keyboard *sway_keyboard_create(struct sway_seat *seat, | ||||
| 		struct sway_input_device *device); | ||||
| 		struct sway_seat_device *device); | ||||
| 
 | ||||
| void sway_keyboard_configure(struct sway_keyboard *keyboard); | ||||
| 
 | ||||
| void sway_keyboard_destroy(struct sway_keyboard *keyboard); | ||||
|  | ||||
| @ -1,28 +0,0 @@ | ||||
| #define _XOPEN_SOURCE 700 | ||||
| #include <string.h> | ||||
| #include <strings.h> | ||||
| #include "sway/commands.h" | ||||
| #include "sway/input/input-manager.h" | ||||
| #include "log.h" | ||||
| 
 | ||||
| struct cmd_results *input_cmd_seat(int argc, char **argv) { | ||||
| 	sway_log(L_DEBUG, "seat for device:  %d %s", | ||||
| 		current_input_config==NULL, current_input_config->identifier); | ||||
| 	struct cmd_results *error = NULL; | ||||
| 	if ((error = checkarg(argc, "seat", EXPECTED_AT_LEAST, 1))) { | ||||
| 		return error; | ||||
| 	} | ||||
| 	if (!current_input_config) { | ||||
| 		return cmd_results_new(CMD_FAILURE, "seat", | ||||
| 			"No input device defined."); | ||||
| 	} | ||||
| 	struct input_config *new_config = | ||||
| 		new_input_config(current_input_config->identifier); | ||||
| 
 | ||||
| 	// TODO validate seat name
 | ||||
| 	free(new_config->seat); | ||||
| 	new_config->seat = strdup(argv[0]); | ||||
| 
 | ||||
| 	input_cmd_apply(new_config); | ||||
| 	return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||||
| } | ||||
| @ -0,0 +1,35 @@ | ||||
| #include <string.h> | ||||
| #include <strings.h> | ||||
| #include "sway/commands.h" | ||||
| #include "sway/input/input-manager.h" | ||||
| #include "log.h" | ||||
| 
 | ||||
| struct cmd_results *cmd_seat(int argc, char **argv) { | ||||
| 	struct cmd_results *error = NULL; | ||||
| 	if ((error = checkarg(argc, "seat", EXPECTED_AT_LEAST, 2))) { | ||||
| 		return error; | ||||
| 	} | ||||
| 
 | ||||
| 	if (config->reading && strcmp("{", argv[1]) == 0) { | ||||
| 		current_seat_config = new_seat_config(argv[0]); | ||||
| 		sway_log(L_DEBUG, "entering seat block: %s", current_seat_config->name); | ||||
| 		return cmd_results_new(CMD_BLOCK_SEAT, NULL, NULL); | ||||
| 	} | ||||
| 
 | ||||
| 	if (argc > 2) { | ||||
| 		int argc_new = argc-2; | ||||
| 		char **argv_new = argv+2; | ||||
| 
 | ||||
| 		struct cmd_results *res; | ||||
| 		current_seat_config = new_seat_config(argv[0]); | ||||
| 		if (strcasecmp("attach", argv[1]) == 0) { | ||||
| 			res = seat_cmd_attach(argc_new, argv_new); | ||||
| 		} else { | ||||
| 			res = cmd_results_new(CMD_INVALID, "seat <name>", "Unknown command %s", argv[1]); | ||||
| 		} | ||||
| 		current_seat_config = NULL; | ||||
| 		return res; | ||||
| 	} | ||||
| 
 | ||||
| 	return cmd_results_new(CMD_BLOCK_SEAT, NULL, NULL); | ||||
| } | ||||
| @ -0,0 +1,26 @@ | ||||
| #define _XOPEN_SOURCE 700 | ||||
| #include <string.h> | ||||
| #include <strings.h> | ||||
| #include "sway/input/input-manager.h" | ||||
| #include "sway/commands.h" | ||||
| #include "sway/config.h" | ||||
| #include "log.h" | ||||
| #include "stringop.h" | ||||
| 
 | ||||
| struct cmd_results *seat_cmd_attach(int argc, char **argv) { | ||||
| 	struct cmd_results *error = NULL; | ||||
| 	if ((error = checkarg(argc, "attach", EXPECTED_AT_LEAST, 1))) { | ||||
| 		return error; | ||||
| 	} | ||||
| 	if (!current_seat_config) { | ||||
| 		return cmd_results_new(CMD_FAILURE, "attach", "No seat defined"); | ||||
| 	} | ||||
| 
 | ||||
| 	struct seat_config *new_config = new_seat_config(current_seat_config->name); | ||||
| 	struct seat_attachment_config *new_attachment = seat_attachment_config_new(); | ||||
| 	new_attachment->identifier = strdup(argv[0]); | ||||
| 	list_add(new_config->attachments, new_attachment); | ||||
| 
 | ||||
| 	seat_cmd_apply(new_config); | ||||
| 	return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||||
| } | ||||
					Loading…
					
					
				
		Reference in new issue