Apply clang-format

This commit is contained in:
project-repo 2023-09-17 09:59:23 +02:00
commit 7f592ef01a
5 changed files with 30 additions and 25 deletions

View file

@ -370,7 +370,7 @@ main(int argc, char *argv[]) {
server.event_loop = event_loop;
backend = wlr_backend_autocreate(server.wl_display);
server.headless_backend=wlr_headless_backend_create(server.wl_display);
server.headless_backend = wlr_headless_backend_create(server.wl_display);
if(!backend) {
wlr_log(WLR_ERROR, "Unable to create the wlroots backend");
ret = 1;

View file

@ -1028,7 +1028,8 @@ print_output(struct cg_output *outp) {
outp->wlr_output->width, outp->wlr_output->height);
print_str(&outp_str, "\"refresh_rate\": %f,\n",
(float)outp->wlr_output->refresh / 1000.0);
print_str(&outp_str, "\"permanent\": %d,\n", outp->role == OUTPUT_ROLE_PERMANENT);
print_str(&outp_str, "\"permanent\": %d,\n",
outp->role == OUTPUT_ROLE_PERMANENT);
print_str(&outp_str, "\"curr_workspace\": %d,\n", outp->curr_workspace + 1);
char *workspaces_str = print_workspaces(outp);
if(workspaces_str != NULL) {
@ -1549,7 +1550,7 @@ keybinding_configure_output(struct cg_server *server,
struct cg_output *output, *tmp_output;
wl_list_for_each_safe(output, tmp_output, &server->outputs, link) {
if(strcmp(config->output_name, output->name) == 0) {
int output_num=output_get_num(output);
int output_num = output_get_num(output);
output_configure(server, output);
ipc_send_event(server,
"{\"event_name\":\"configure_output\",\"output\":\"%"

View file

@ -139,9 +139,11 @@ output_destroy(struct cg_output *output) {
wlr_output_layout_get_box(server->output_layout, output->wlr_output,
&output->layout_box);
wlr_output_layout_remove(server->output_layout, output->wlr_output);
output->wlr_output=wlr_headless_add_output(server->headless_backend,output->layout_box.width,output->layout_box.height);
wlr_output_layout_add(server->output_layout, output->wlr_output, output->layout_box.x,
output->layout_box.y);
output->wlr_output = wlr_headless_add_output(server->headless_backend,
output->layout_box.width,
output->layout_box.height);
wlr_output_layout_add(server->output_layout, output->wlr_output,
output->layout_box.x, output->layout_box.y);
} else {
@ -280,10 +282,11 @@ output_apply_config(struct cg_server *server, struct cg_output *output,
struct wlr_output *wlr_output = output->wlr_output;
wlr_output_layout_get_box(server->output_layout, output->wlr_output,
&output->layout_box);
&output->layout_box);
if(config->role != OUTPUT_ROLE_DEFAULT) {
output->role = config->role;
if((output->role == OUTPUT_ROLE_PERIPHERAL)&&(output->destroyed == true)) {
if((output->role == OUTPUT_ROLE_PERIPHERAL) &&
(output->destroyed == true)) {
output_destroy(output);
wlr_output_destroy(wlr_output);
return;
@ -319,38 +322,38 @@ output_apply_config(struct cg_server *server, struct cg_output *output,
config->pos.y);
/* Since the size of the output may have changed, we
* reinitialize all workspaces with a fullscreen layout */
if(output->layout_box.width!=config->pos.width||output->layout_box.height!=config->pos.height) {
if(output->layout_box.width != config->pos.width ||
output->layout_box.height != config->pos.height) {
for(unsigned int i = 0; i < output->server->nws; ++i) {
output_make_workspace_fullscreen(output, i);
}
} else {
wlr_output_layout_get_box(server->output_layout, output->wlr_output,
&output->layout_box);
&output->layout_box);
for(unsigned int i = 0; i < server->nws; ++i) {
struct cg_workspace *ws=output->workspaces[i];
struct cg_workspace *ws = output->workspaces[i];
bool first = true;
for(struct cg_tile *tile = ws->focused_tile;
first || output->workspaces[i]->focused_tile != tile;
tile = tile->next) {
first || output->workspaces[i]->focused_tile != tile;
tile = tile->next) {
first = false;
if(tile->view != NULL) {
wlr_scene_node_set_position(
&tile->view->scene_tree->node,
tile->view->ox + output->layout_box.x,
output->layout_box.y);
&tile->view->scene_tree->node,
tile->view->ox + output->layout_box.x,
output->layout_box.y);
}
}
}
}
} else {
wlr_output_layout_add_auto(server->output_layout, wlr_output);
// The following two lines make sure that the output is "manually" managed,
// so that its position doesn't change anymore in the future.
// The following two lines make sure that the output is "manually"
// managed, so that its position doesn't change anymore in the future.
wlr_output_layout_get_box(server->output_layout, output->wlr_output,
&output->layout_box);
wlr_output_layout_move(server->output_layout, output->wlr_output, output->layout_box.x,
output->layout_box.y);
&output->layout_box);
wlr_output_layout_move(server->output_layout, output->wlr_output,
output->layout_box.x, output->layout_box.y);
struct wlr_output_mode *preferred_mode =
wlr_output_preferred_mode(wlr_output);

2
seat.c
View file

@ -914,7 +914,7 @@ handle_destroy(struct wl_listener *listener, void *_data) {
wl_list_remove(&seat->request_set_cursor.link);
wl_list_remove(&seat->request_set_selection.link);
wl_list_remove(&seat->request_set_primary_selection.link);
seat->server->seat=NULL;
seat->server->seat = NULL;
free(seat);
}

View file

@ -100,8 +100,9 @@ void
workspace_free_tiles(struct cg_workspace *workspace) {
workspace->focused_tile->prev->next = NULL;
while(workspace->focused_tile != NULL) {
if(workspace->server->seat!=NULL&&(!workspace->output->server->running ||
workspace->focused_tile == workspace->server->seat->cursor_tile)) {
if(workspace->server->seat != NULL &&
(!workspace->output->server->running ||
workspace->focused_tile == workspace->server->seat->cursor_tile)) {
workspace->server->seat->cursor_tile = NULL;
}
struct cg_tile *next = workspace->focused_tile->next;