Add new_output_config, update root container size on output hotplug

master
emersion 7 years ago
parent 41dd291612
commit 8764dc26c6
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

@ -364,10 +364,8 @@ void apply_input_config(struct input_config *ic, struct libinput_device *dev);
void free_input_config(struct input_config *ic);
int output_name_cmp(const void *item, const void *data);
void output_config_defaults(struct output_config *oc);
struct output_config *new_output_config();
void merge_output_config(struct output_config *dst, struct output_config *src);
/** Sets up a WLC output handle based on a given output_config.
*/
void apply_output_config(struct output_config *oc, swayc_t *output);
void free_output_config(struct output_config *oc);

@ -27,11 +27,10 @@ struct cmd_results *cmd_output(int argc, char **argv) {
}
const char *name = argv[0];
struct output_config *output = calloc(1, sizeof(struct output_config));
struct output_config *output = new_output_config();
if (!output) {
return cmd_results_new(CMD_FAILURE, "output", "Unable to allocate output config");
}
output_config_defaults(output);
output->name = strdup(name);
// TODO: atoi doesn't handle invalid numbers

@ -14,13 +14,18 @@ int output_name_cmp(const void *item, const void *data) {
return strcmp(output->name, name);
}
void output_config_defaults(struct output_config *oc) {
struct output_config *new_output_config() {
struct output_config *oc = calloc(1, sizeof(struct output_config));
if (oc == NULL) {
return NULL;
}
oc->enabled = -1;
oc->width = oc->height -1;
oc->refresh_rate = -1;
oc->x = oc->y = -1;
oc->scale = -1;
oc->transform = -1;
return oc;
}
void merge_output_config(struct output_config *dst, struct output_config *src) {

@ -93,6 +93,7 @@ swayc_t *new_output(struct sway_output *sway_output) {
sway_log(L_DEBUG, "Creating default workspace %s", ws_name);
new_workspace(output, ws_name);
free(ws_name);
update_root_geometry();
return output;
}

Loading…
Cancel
Save