diff --git a/output.c b/output.c index 38b79a1..42ed10e 100644 --- a/output.c +++ b/output.c @@ -364,7 +364,7 @@ static void handle_output_transform(struct wl_listener *listener, void *data) { struct cg_output *output = wl_container_of(listener, output, transform); - if(!output->wlr_output->enabled || output->workspaces==NULL) { + if(!output->wlr_output->enabled || output->workspaces == NULL) { return; } @@ -379,7 +379,7 @@ static void handle_output_mode(struct wl_listener *listener, void *data) { struct cg_output *output = wl_container_of(listener, output, mode); - if(!output->wlr_output->enabled || output->workspaces==NULL) { + if(!output->wlr_output->enabled || output->workspaces == NULL) { return; } @@ -390,8 +390,9 @@ handle_output_mode(struct wl_listener *listener, void *data) { } } -void output_clear(struct cg_output* output) { - struct cg_server *server=output->server; +void +output_clear(struct cg_output *output) { + struct cg_server *server = output->server; wlr_output_layout_remove(server->output_layout, output->wlr_output); if(server->running && server->curr_output == output && @@ -409,9 +410,10 @@ void output_clear(struct cg_output* output) { bool first = true; for(struct cg_tile *tile = output->workspaces[i]->focused_tile; - first || output->workspaces[i]->focused_tile != tile; tile = tile->next) { + first || output->workspaces[i]->focused_tile != tile; + tile = tile->next) { first = false; - tile->view=NULL; + tile->view = NULL; } wl_list_for_each_safe(view, view_tmp, &output->workspaces[i]->views, link) { @@ -450,7 +452,6 @@ void output_clear(struct cg_output* output) { } } } - } static void @@ -545,7 +546,8 @@ output_configure(struct cg_server *server, struct cg_output *output) { struct wlr_output *wlr_output = output->wlr_output; struct cg_output_config *config = output_find_config(server, wlr_output); /* Refuse to disable the only output */ - if(config!=NULL&&config->status == OUTPUT_DISABLE && wl_list_length(&server->outputs)==1) { + if(config != NULL && config->status == OUTPUT_DISABLE && + wl_list_length(&server->outputs) == 1) { return; } if(output->wlr_output->enabled) { @@ -561,17 +563,17 @@ output_configure(struct cg_server *server, struct cg_output *output) { wlr_output_set_mode(wlr_output, preferred_mode); } wl_list_remove(&output->link); - wl_list_insert(&server->outputs,&output->link); + wl_list_insert(&server->outputs, &output->link); wlr_output_enable(wlr_output, true); wlr_output_commit(wlr_output); } else if(config->status == OUTPUT_DISABLE) { output_clear(output); - wl_list_insert(&server->disabled_outputs,&output->link); + wl_list_insert(&server->disabled_outputs, &output->link); wlr_output_enable(wlr_output, false); wlr_output_commit(wlr_output); } else { wl_list_remove(&output->link); - wl_list_insert(&server->outputs,&output->link); + wl_list_insert(&server->outputs, &output->link); output_set_mode(wlr_output, config->pos.width, config->pos.height, config->refresh_rate); wlr_output_layout_add(server->output_layout, wlr_output, config->pos.x, @@ -613,7 +615,7 @@ handle_new_output(struct wl_listener *listener, void *data) { wl_signal_add(&output->damage->events.destroy, &output->damage_destroy); wlr_output_set_transform(wlr_output, server->output_transform); - output->workspaces=NULL; + output->workspaces = NULL; output->curr_workspace = 0; wl_list_init(&output->messages); diff --git a/output.h b/output.h index 83a79b9..a11d4be 100644 --- a/output.h +++ b/output.h @@ -28,11 +28,7 @@ struct cg_output { struct wl_list link; // cg_server::outputs }; -enum output_status { - OUTPUT_ENABLE, - OUTPUT_DISABLE, - OUTPUT_DEFAULT -}; +enum output_status { OUTPUT_ENABLE, OUTPUT_DISABLE, OUTPUT_DEFAULT }; struct cg_output_config { enum output_status status; diff --git a/parse.c b/parse.c index 895ed71..46b275a 100644 --- a/parse.c +++ b/parse.c @@ -260,16 +260,16 @@ parse_float(char **saveptr, const char *delim) { } int -parse_output_config_keyword(char *key_str,enum output_status *status) { +parse_output_config_keyword(char *key_str, enum output_status *status) { if(key_str == NULL) { return -1; } - if(strcmp(key_str,"pos") == 0) { - *status=OUTPUT_DEFAULT; + if(strcmp(key_str, "pos") == 0) { + *status = OUTPUT_DEFAULT; } else if(strcmp(key_str, "enable") == 0) { - *status=OUTPUT_ENABLE; + *status = OUTPUT_ENABLE; } else if(strcmp(key_str, "disable") == 0) { - *status=OUTPUT_DISABLE; + *status = OUTPUT_DISABLE; } else { return -1; } @@ -291,10 +291,10 @@ parse_output_config(char **saveptr, char **errstr) { goto error; } char *key_str = strtok_r(NULL, " ", saveptr); - if(parse_output_config_keyword(key_str,&(cfg->status))!=0) { - *errstr = log_error( - "Expected keyword \"pos\", \"enable\" or \"disable\" in output configuration for output %s", - name); + if(parse_output_config_keyword(key_str, &(cfg->status)) != 0) { + *errstr = log_error("Expected keyword \"pos\", \"enable\" or " + "\"disable\" in output configuration for output %s", + name); goto error; } if(cfg->status == OUTPUT_ENABLE || cfg->status == OUTPUT_DISABLE) { diff --git a/seat.c b/seat.c index 5c6e379..fc22669 100644 --- a/seat.c +++ b/seat.c @@ -55,7 +55,8 @@ view_at(const struct cg_view *view, double lx, double ly, struct wlr_box *output_layout_box = wlr_output_layout_get_box( view->server->output_layout, view->workspace->output->wlr_output); if(output_layout_box == NULL) { - fprintf(stderr, "OUTPUT:%d\n",view->workspace->output->wlr_output->enabled); + fprintf(stderr, "OUTPUT:%d\n", + view->workspace->output->wlr_output->enabled); return output_layout_box->x; return false; } diff --git a/view.c b/view.c index 0b51904..f9bfcc3 100644 --- a/view.c +++ b/view.c @@ -297,8 +297,8 @@ view_unmap(struct cg_view *view) { struct cg_view *prev = view_get_prev_view(view); if(view == view->server->seat->focused_view) { seat_set_focus(view->server->seat, prev); - } else if(view->server->seat->seat->keyboard_state - .focused_surface == view->wlr_surface) { + } else if(view->server->seat->seat->keyboard_state.focused_surface == + view->wlr_surface) { wlr_seat_keyboard_clear_focus(view->server->seat->seat); seat_set_focus(view->server->seat, view->server->seat->focused_view);