This commit is contained in:
emersion 2018-07-09 22:54:30 +01:00
parent ebcdce457a
commit 63b4bf5000
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
85 changed files with 391 additions and 385 deletions

View file

@ -47,11 +47,11 @@ static void apply_horiz_layout(struct sway_container *parent) {
double scale = parent->width / total_width;
// Resize windows
wlr_log(L_DEBUG, "Arranging %p horizontally", parent);
wlr_log(WLR_DEBUG, "Arranging %p horizontally", parent);
double child_x = parent->x;
for (size_t i = 0; i < num_children; ++i) {
struct sway_container *child = parent->children->items[i];
wlr_log(L_DEBUG,
wlr_log(WLR_DEBUG,
"Calculating arrangement for %p:%d (will scale %f by %f)",
child, child->type, child->width, scale);
child->x = child_x;
@ -99,11 +99,11 @@ static void apply_vert_layout(struct sway_container *parent) {
double scale = parent_height / total_height;
// Resize
wlr_log(L_DEBUG, "Arranging %p vertically", parent);
wlr_log(WLR_DEBUG, "Arranging %p vertically", parent);
double child_y = parent->y + parent_offset;
for (size_t i = 0; i < num_children; ++i) {
struct sway_container *child = parent->children->items[i];
wlr_log(L_DEBUG,
wlr_log(WLR_DEBUG,
"Calculating arrangement for %p:%d (will scale %f by %f)",
child, child->type, child->height, scale);
child->x = parent->x;
@ -179,7 +179,7 @@ static void arrange_children_of(struct sway_container *parent,
if (config->reloading) {
return;
}
wlr_log(L_DEBUG, "Arranging layout for %p %s %fx%f+%f,%f", parent,
wlr_log(WLR_DEBUG, "Arranging layout for %p %s %fx%f+%f,%f", parent,
parent->name, parent->width, parent->height, parent->x, parent->y);
// Calculate x, y, width and height of children
@ -226,7 +226,7 @@ static void arrange_workspace(struct sway_container *workspace,
}
struct sway_container *output = workspace->parent;
struct wlr_box *area = &output->sway_output->usable_area;
wlr_log(L_DEBUG, "Usable area for ws: %dx%d@%d,%d",
wlr_log(WLR_DEBUG, "Usable area for ws: %dx%d@%d,%d",
area->width, area->height, area->x, area->y);
remove_gaps(workspace);
workspace->width = area->width;
@ -235,7 +235,7 @@ static void arrange_workspace(struct sway_container *workspace,
workspace->y = output->y + area->y;
add_gaps(workspace);
transaction_add_container(transaction, workspace);
wlr_log(L_DEBUG, "Arranging workspace '%s' at %f, %f", workspace->name,
wlr_log(WLR_DEBUG, "Arranging workspace '%s' at %f, %f", workspace->name,
workspace->x, workspace->y);
arrange_floating(workspace->sway_workspace->floating, transaction);
arrange_children_of(workspace, transaction);
@ -254,7 +254,7 @@ static void arrange_output(struct sway_container *output,
output->width = output_box->width;
output->height = output_box->height;
transaction_add_container(transaction, output);
wlr_log(L_DEBUG, "Arranging output '%s' at %f,%f",
wlr_log(WLR_DEBUG, "Arranging output '%s' at %f,%f",
output->name, output->x, output->y);
for (int i = 0; i < output->children->length; ++i) {
struct sway_container *workspace = output->children->items[i];
@ -315,7 +315,7 @@ void arrange_and_commit(struct sway_container *container) {
void remove_gaps(struct sway_container *c) {
if (c->current_gaps == 0) {
wlr_log(L_DEBUG, "Removing gaps: not gapped: %p", c);
wlr_log(WLR_DEBUG, "Removing gaps: not gapped: %p", c);
return;
}
@ -326,12 +326,12 @@ void remove_gaps(struct sway_container *c) {
c->current_gaps = 0;
wlr_log(L_DEBUG, "Removing gaps %p", c);
wlr_log(WLR_DEBUG, "Removing gaps %p", c);
}
void add_gaps(struct sway_container *c) {
if (c->current_gaps > 0 || c->type == C_CONTAINER) {
wlr_log(L_DEBUG, "Not adding gaps: %p", c);
wlr_log(WLR_DEBUG, "Not adding gaps: %p", c);
return;
}
@ -348,5 +348,5 @@ void add_gaps(struct sway_container *c) {
c->height -= 2 * gaps;
c->current_gaps = gaps;
wlr_log(L_DEBUG, "Adding gaps: %p", c);
wlr_log(WLR_DEBUG, "Adding gaps: %p", c);
}

View file

@ -31,7 +31,7 @@ static list_t *get_bfs_queue() {
if (!bfs_queue) {
bfs_queue = create_list();
if (!bfs_queue) {
wlr_log(L_ERROR, "could not allocate list for bfs queue");
wlr_log(WLR_ERROR, "could not allocate list for bfs queue");
return NULL;
}
}
@ -213,7 +213,7 @@ static struct sway_container *container_workspace_destroy(
return NULL;
}
wlr_log(L_DEBUG, "destroying workspace '%s'", workspace->name);
wlr_log(WLR_DEBUG, "destroying workspace '%s'", workspace->name);
struct sway_container *parent = workspace->parent;
if (!workspace_is_empty(workspace) && output) {
@ -226,7 +226,7 @@ static struct sway_container *container_workspace_destroy(
}
}
wlr_log(L_DEBUG, "moving children to different workspace '%s' -> '%s'",
wlr_log(WLR_DEBUG, "moving children to different workspace '%s' -> '%s'",
workspace->name, new_workspace->name);
for (int i = 0; i < workspace->children->length; i++) {
container_move_to(workspace->children->items[i], new_workspace);
@ -292,7 +292,7 @@ static struct sway_container *container_output_destroy(
output->sway_output->swayc = NULL;
output->sway_output = NULL;
wlr_log(L_DEBUG, "OUTPUT: Destroying output '%s'", output->name);
wlr_log(WLR_DEBUG, "OUTPUT: Destroying output '%s'", output->name);
return &root_container;
}
@ -319,7 +319,7 @@ static struct sway_container *container_destroy_noreaping(
// Workspaces will refuse to be destroyed if they're the last workspace
// on their output.
if (!container_workspace_destroy(con)) {
wlr_log(L_ERROR, "workspace doesn't want to destroy");
wlr_log(WLR_ERROR, "workspace doesn't want to destroy");
return NULL;
}
}
@ -346,7 +346,7 @@ bool container_reap_empty(struct sway_container *con) {
break;
case C_WORKSPACE:
if (!workspace_is_visible(con) && workspace_is_empty(con)) {
wlr_log(L_DEBUG, "Destroying workspace via reaper");
wlr_log(WLR_DEBUG, "Destroying workspace via reaper");
container_destroy_noreaping(con);
return true;
}
@ -439,7 +439,7 @@ struct sway_container *container_view_create(struct sway_container *sibling,
}
const char *title = view_get_title(sway_view);
struct sway_container *swayc = container_create(C_VIEW);
wlr_log(L_DEBUG, "Adding new view %p:%s to container %p %d %s",
wlr_log(WLR_DEBUG, "Adding new view %p:%s to container %p %d %s",
swayc, title, sibling, sibling ? sibling->type : 0, sibling->name);
// Setup values
swayc->sway_view = sway_view;
@ -702,7 +702,7 @@ void container_for_each_descendant_bfs(struct sway_container *con,
}
if (queue == NULL) {
wlr_log(L_ERROR, "could not allocate list");
wlr_log(WLR_ERROR, "could not allocate list");
return;
}

View file

@ -101,7 +101,7 @@ void container_insert_child(struct sway_container *parent,
if (old_parent) {
container_remove_child(child);
}
wlr_log(L_DEBUG, "Inserting id:%zd at index %d", child->id, i);
wlr_log(WLR_DEBUG, "Inserting id:%zd at index %d", child->id, i);
list_insert(parent->children, i, child);
child->parent = parent;
container_handle_fullscreen_reparent(child, old_parent);
@ -127,7 +127,7 @@ struct sway_container *container_add_sibling(struct sway_container *fixed,
void container_add_child(struct sway_container *parent,
struct sway_container *child) {
wlr_log(L_DEBUG, "Adding %p (%d, %fx%f) to %p (%d, %fx%f)",
wlr_log(WLR_DEBUG, "Adding %p (%d, %fx%f) to %p (%d, %fx%f)",
child, child->type, child->width, child->height,
parent, parent->type, parent->width, parent->height);
struct sway_container *old_parent = child->parent;
@ -319,13 +319,13 @@ static void move_out_of_tabs_stacks(struct sway_container *container,
int offs) {
if (container->parent == current->parent
&& current->parent->children->length == 1) {
wlr_log(L_DEBUG, "Changing layout of %zd", current->parent->id);
wlr_log(WLR_DEBUG, "Changing layout of %zd", current->parent->id);
current->parent->layout = move_dir ==
MOVE_LEFT || move_dir == MOVE_RIGHT ? L_HORIZ : L_VERT;
return;
}
wlr_log(L_DEBUG, "Moving out of tab/stack into a split");
wlr_log(WLR_DEBUG, "Moving out of tab/stack into a split");
bool is_workspace = current->parent->type == C_WORKSPACE;
struct sway_container *new_parent = container_split(current->parent,
move_dir == MOVE_LEFT || move_dir == MOVE_RIGHT ? L_HORIZ : L_VERT);
@ -370,7 +370,7 @@ void container_move(struct sway_container *container,
}
parent = current->parent;
wlr_log(L_DEBUG, "Visiting %p %s '%s'", current,
wlr_log(WLR_DEBUG, "Visiting %p %s '%s'", current,
container_type_to_str(current->type), current->name);
int index = index_child(current);
@ -388,12 +388,12 @@ void container_move(struct sway_container *container,
root_container.sway_root->output_layout, wlr_dir,
current->sway_output->wlr_output, ref_lx, ref_ly);
if (!next) {
wlr_log(L_DEBUG, "Hit edge of output, nowhere else to go");
wlr_log(WLR_DEBUG, "Hit edge of output, nowhere else to go");
return;
}
struct sway_output *next_output = next->data;
current = next_output->swayc;
wlr_log(L_DEBUG, "Selected next output (%s)", current->name);
wlr_log(WLR_DEBUG, "Selected next output (%s)", current->name);
// Select workspace and get outta here
current = seat_get_focus_inactive(
config->handler_context.seat, current);
@ -406,20 +406,20 @@ void container_move(struct sway_container *container,
case C_WORKSPACE:
if (!is_parallel(current->layout, move_dir)) {
if (current->children->length >= 2) {
wlr_log(L_DEBUG, "Rejiggering the workspace (%d kiddos)",
wlr_log(WLR_DEBUG, "Rejiggering the workspace (%d kiddos)",
current->children->length);
workspace_rejigger(current, container, move_dir);
return;
} else {
wlr_log(L_DEBUG, "Selecting output");
wlr_log(WLR_DEBUG, "Selecting output");
current = current->parent;
}
} else if (current->layout == L_TABBED
|| current->layout == L_STACKED) {
wlr_log(L_DEBUG, "Rejiggering out of tabs/stacks");
wlr_log(WLR_DEBUG, "Rejiggering out of tabs/stacks");
workspace_rejigger(current, container, move_dir);
} else {
wlr_log(L_DEBUG, "Selecting output");
wlr_log(WLR_DEBUG, "Selecting output");
current = current->parent;
}
break;
@ -435,11 +435,11 @@ void container_move(struct sway_container *container,
move_dir, offs);
return;
} else {
wlr_log(L_DEBUG, "Hit limit, selecting parent");
wlr_log(WLR_DEBUG, "Hit limit, selecting parent");
current = current->parent;
}
} else {
wlr_log(L_DEBUG, "Hit limit, "
wlr_log(WLR_DEBUG, "Hit limit, "
"promoting descendant to sibling");
// Special case
container_insert_child(current->parent, container,
@ -449,14 +449,14 @@ void container_move(struct sway_container *container,
}
} else {
sibling = parent->children->items[index + offs];
wlr_log(L_DEBUG, "Selecting sibling id:%zd", sibling->id);
wlr_log(WLR_DEBUG, "Selecting sibling id:%zd", sibling->id);
}
} else if (parent->layout == L_TABBED
|| parent->layout == L_STACKED) {
move_out_of_tabs_stacks(container, current, move_dir, offs);
return;
} else {
wlr_log(L_DEBUG, "Moving up to find a parallel container");
wlr_log(WLR_DEBUG, "Moving up to find a parallel container");
current = current->parent;
}
break;
@ -475,11 +475,11 @@ void container_move(struct sway_container *container,
switch (sibling->type) {
case C_VIEW:
if (sibling->parent == container->parent) {
wlr_log(L_DEBUG, "Swapping siblings");
wlr_log(WLR_DEBUG, "Swapping siblings");
sibling->parent->children->items[index + offs] = container;
sibling->parent->children->items[index] = sibling;
} else {
wlr_log(L_DEBUG, "Promoting to sibling of cousin");
wlr_log(WLR_DEBUG, "Promoting to sibling of cousin");
container_insert_child(sibling->parent, container,
index_child(sibling) + (offs > 0 ? 0 : 1));
container->width = container->height = 0;
@ -490,31 +490,31 @@ void container_move(struct sway_container *container,
case C_CONTAINER:
if (is_parallel(sibling->layout, move_dir)) {
int limit = container_limit(sibling, invert_movement(move_dir));
wlr_log(L_DEBUG, "limit: %d", limit);
wlr_log(L_DEBUG,
wlr_log(WLR_DEBUG, "limit: %d", limit);
wlr_log(WLR_DEBUG,
"Reparenting container (parallel) to index %d "
"(move dir: %d)", limit, move_dir);
container_insert_child(sibling, container, limit);
container->width = container->height = 0;
sibling = NULL;
} else {
wlr_log(L_DEBUG, "Reparenting container (perpendicular)");
wlr_log(WLR_DEBUG, "Reparenting container (perpendicular)");
struct sway_container *focus_inactive = seat_get_focus_inactive(
config->handler_context.seat, sibling);
if (focus_inactive && focus_inactive != sibling) {
while (focus_inactive->parent != sibling) {
focus_inactive = focus_inactive->parent;
}
wlr_log(L_DEBUG, "Focus inactive: id:%zd",
wlr_log(WLR_DEBUG, "Focus inactive: id:%zd",
focus_inactive->id);
sibling = focus_inactive;
continue;
} else if (sibling->children->length) {
wlr_log(L_DEBUG, "No focus-inactive, adding arbitrarily");
wlr_log(WLR_DEBUG, "No focus-inactive, adding arbitrarily");
container_remove_child(container);
container_add_sibling(sibling->children->items[0], container);
} else {
wlr_log(L_DEBUG, "No kiddos, adding container alone");
wlr_log(WLR_DEBUG, "No kiddos, adding container alone");
container_remove_child(container);
container_add_child(sibling, container);
}
@ -611,7 +611,7 @@ static struct sway_container *get_swayc_in_output_direction(
}
if (ws == NULL) {
wlr_log(L_ERROR, "got an output without a workspace");
wlr_log(WLR_ERROR, "got an output without a workspace");
return NULL;
}
@ -783,7 +783,7 @@ struct sway_container *container_get_in_direction(
} else {
struct sway_container *desired_con =
parent->children->items[desired];
wlr_log(L_DEBUG,
wlr_log(WLR_DEBUG,
"cont %d-%p dir %i sibling %d: %p", idx,
container, dir, desired, desired_con);
return seat_get_focus_inactive_view(seat, desired_con);
@ -848,7 +848,7 @@ struct sway_container *container_split(struct sway_container *child,
struct sway_container *cont = container_create(C_CONTAINER);
wlr_log(L_DEBUG, "creating container %p around %p", cont, child);
wlr_log(WLR_DEBUG, "creating container %p around %p", cont, child);
remove_gaps(child);
@ -896,7 +896,7 @@ struct sway_container *container_split(struct sway_container *child,
void container_recursive_resize(struct sway_container *container,
double amount, enum resize_edge edge) {
bool layout_match = true;
wlr_log(L_DEBUG, "Resizing %p with amount: %f", container, amount);
wlr_log(WLR_DEBUG, "Resizing %p with amount: %f", container, amount);
if (edge == RESIZE_EDGE_LEFT || edge == RESIZE_EDGE_RIGHT) {
container->width += amount;
layout_match = container->layout == L_HORIZ;
@ -986,7 +986,7 @@ void container_swap(struct sway_container *con1, struct sway_container *con2) {
return;
}
wlr_log(L_DEBUG, "Swapping containers %zu and %zu", con1->id, con2->id);
wlr_log(WLR_DEBUG, "Swapping containers %zu and %zu", con1->id, con2->id);
int fs1 = con1->type == C_VIEW && con1->sway_view->is_fullscreen;
int fs2 = con2->type == C_VIEW && con2->sway_view->is_fullscreen;

View file

@ -43,11 +43,11 @@ struct sway_container *output_create(
if (strcasecmp(name, cur->name) == 0 ||
strcasecmp(identifier, cur->name) == 0) {
wlr_log(L_DEBUG, "Matched output config for %s", name);
wlr_log(WLR_DEBUG, "Matched output config for %s", name);
oc = cur;
}
if (strcasecmp("*", cur->name) == 0) {
wlr_log(L_DEBUG, "Matched wildcard output config for %s", name);
wlr_log(WLR_DEBUG, "Matched wildcard output config for %s", name);
all = cur;
}
@ -86,7 +86,7 @@ struct sway_container *output_create(
if (!output->children->length) {
// Create workspace
char *ws_name = workspace_next_name(output->name);
wlr_log(L_DEBUG, "Creating default workspace %s", ws_name);
wlr_log(WLR_DEBUG, "Creating default workspace %s", ws_name);
struct sway_container *ws = workspace_create(output, ws_name);
// Set each seat's focus if not already set
struct sway_seat *seat = NULL;

View file

@ -462,17 +462,17 @@ void view_execute_criteria(struct sway_view *view) {
list_t *criterias = criteria_for_view(view, CT_COMMAND);
for (int i = 0; i < criterias->length; i++) {
struct criteria *criteria = criterias->items[i];
wlr_log(L_DEBUG, "Checking criteria %s", criteria->raw);
wlr_log(WLR_DEBUG, "Checking criteria %s", criteria->raw);
if (view_has_executed_criteria(view, criteria)) {
wlr_log(L_DEBUG, "Criteria already executed");
wlr_log(WLR_DEBUG, "Criteria already executed");
continue;
}
wlr_log(L_DEBUG, "for_window '%s' matches view %p, cmd: '%s'",
wlr_log(WLR_DEBUG, "for_window '%s' matches view %p, cmd: '%s'",
criteria->raw, view, criteria->cmdlist);
list_add(view->executed_criteria, criteria);
struct cmd_results *res = execute_command(criteria->cmdlist, NULL);
if (res->status != CMD_SUCCESS) {
wlr_log(L_ERROR, "Command '%s' failed: %s", res->input, res->error);
wlr_log(WLR_ERROR, "Command '%s' failed: %s", res->input, res->error);
}
free_cmd_results(res);
// view must be focused for commands to affect it,
@ -601,7 +601,7 @@ static void view_subsurface_create(struct sway_view *view,
struct wlr_subsurface *subsurface) {
struct sway_view_child *child = calloc(1, sizeof(struct sway_view_child));
if (child == NULL) {
wlr_log(L_ERROR, "Allocation failed");
wlr_log(WLR_ERROR, "Allocation failed");
return;
}
view_child_init(child, NULL, view, subsurface->surface);
@ -721,7 +721,7 @@ struct sway_view *view_from_wlr_surface(struct wlr_surface *wlr_surface) {
return NULL;
}
wlr_log(L_DEBUG, "Surface of unknown type (role %s): %p",
wlr_log(WLR_DEBUG, "Surface of unknown type (role %s): %p",
wlr_surface->role, wlr_surface);
return NULL;
}
@ -789,7 +789,7 @@ static char *escape_title(char *buffer) {
char *escaped_title = calloc(length + 1, sizeof(char));
int result = escape_markup_text(buffer, escaped_title, length);
if (result != length) {
wlr_log(L_ERROR, "Could not escape title: %s", buffer);
wlr_log(WLR_ERROR, "Could not escape title: %s", buffer);
free(escaped_title);
return buffer;
}

View file

@ -49,7 +49,7 @@ struct sway_container *workspace_create(struct sway_container *output,
output = get_workspace_initial_output(name);
}
wlr_log(L_DEBUG, "Added workspace %s for output %s", name, output->name);
wlr_log(WLR_DEBUG, "Added workspace %s for output %s", name, output->name);
struct sway_container *workspace = container_create(C_WORKSPACE);
workspace->x = output->x;
@ -107,7 +107,7 @@ static bool workspace_valid_on_output(const char *output_name,
}
char *workspace_next_name(const char *output_name) {
wlr_log(L_DEBUG, "Workspace: Generating new workspace name for output %s",
wlr_log(WLR_DEBUG, "Workspace: Generating new workspace name for output %s",
output_name);
// Scan all workspace bindings to find the next available workspace name,
// if none are found/available then default to a number
@ -135,7 +135,7 @@ char *workspace_next_name(const char *output_name) {
while (isspace(*_target)) {
memmove(_target, _target+1, strlen(_target+1));
}
wlr_log(L_DEBUG, "Got valid workspace command for target: '%s'",
wlr_log(WLR_DEBUG, "Got valid workspace command for target: '%s'",
_target);
// Make sure that the command references an actual workspace
@ -161,7 +161,7 @@ char *workspace_next_name(const char *output_name) {
temp[length - 1] = '\0';
free(_target);
_target = temp;
wlr_log(L_DEBUG, "Isolated name from workspace number: '%s'", _target);
wlr_log(WLR_DEBUG, "Isolated name from workspace number: '%s'", _target);
// Make sure the workspace number doesn't already exist
if (workspace_by_number(_target)) {
@ -190,7 +190,7 @@ char *workspace_next_name(const char *output_name) {
order = binding->order;
free(target);
target = _target;
wlr_log(L_DEBUG, "Workspace: Found free name %s", _target);
wlr_log(WLR_DEBUG, "Workspace: Found free name %s", _target);
} else {
free(_target);
}
@ -387,7 +387,7 @@ bool workspace_switch(struct sway_container *workspace) {
free(prev_workspace_name);
prev_workspace_name = malloc(strlen(active_ws->name) + 1);
if (!prev_workspace_name) {
wlr_log(L_ERROR, "Unable to allocate previous workspace name");
wlr_log(WLR_ERROR, "Unable to allocate previous workspace name");
return false;
}
strcpy(prev_workspace_name, active_ws->name);
@ -409,7 +409,7 @@ bool workspace_switch(struct sway_container *workspace) {
}
}
wlr_log(L_DEBUG, "Switching to workspace %p:%s",
wlr_log(WLR_DEBUG, "Switching to workspace %p:%s",
workspace, workspace->name);
struct sway_container *next = seat_get_focus_inactive(seat, workspace);
if (next == NULL) {