Merge pull request #3549 from xzfc/small-fixes

Small fixes
This commit is contained in:
Ingo Bürk 2018-12-09 18:13:13 +01:00 committed by GitHub
commit f08119298e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 29 additions and 74 deletions

View File

@ -378,13 +378,6 @@ orientation_t con_orientation(Con *con);
*/ */
Con *con_next_focused(Con *con); Con *con_next_focused(Con *con);
/**
* Get the next/previous container in the specified orientation. This may
* travel up until it finds a container with suitable orientation.
*
*/
Con *con_get_next(Con *con, char way, orientation_t orientation);
/** /**
* Returns the focused con inside this client, descending the tree as far as * Returns the focused con inside this client, descending the tree as far as
* possible. This comes in handy when attaching a con to a workspace at the * possible. This comes in handy when attaching a con to a workspace at the

View File

@ -302,12 +302,6 @@ static int route_click(Con *con, xcb_button_press_event_t *event, const bool mod
goto done; goto done;
} }
if (in_stacked) {
/* for stacked/tabbed cons, the resizing applies to the parent
* container */
con = con->parent;
}
/* 7: floating modifier pressed, initiate a resize */ /* 7: floating modifier pressed, initiate a resize */
if (dest == CLICK_INSIDE && mod_pressed && event->detail == XCB_BUTTON_CLICK_RIGHT) { if (dest == CLICK_INSIDE && mod_pressed && event->detail == XCB_BUTTON_CLICK_RIGHT) {
if (floating_mod_on_tiled_client(con, event)) if (floating_mod_on_tiled_client(con, event))

View File

@ -605,16 +605,20 @@ void cmd_resize(I3_CMD, const char *way, const char *direction, long resize_px,
const double ppt = (double)resize_ppt / 100.0; const double ppt = (double)resize_ppt / 100.0;
if (!cmd_resize_tiling_width_height(current_match, cmd_output, if (!cmd_resize_tiling_width_height(current_match, cmd_output,
current->con, direction, current->con, direction,
resize_px, ppt)) resize_px, ppt)) {
yerror("Cannot resize.");
return; return;
}
} else { } else {
if (!cmd_resize_tiling_direction(current_match, cmd_output, if (!cmd_resize_tiling_direction(current_match, cmd_output,
current->con, direction, current->con, direction,
resize_px, resize_ppt)) resize_px, resize_ppt)) {
yerror("Cannot resize.");
return; return;
} }
} }
} }
}
cmd_output->needs_tree_render = true; cmd_output->needs_tree_render = true;
// XXX: default reply for now, make this a better reply // XXX: default reply for now, make this a better reply
@ -657,7 +661,7 @@ static bool resize_set_tiling(I3_CMD, Con *target, orientation_t resize_orientat
void cmd_resize_set(I3_CMD, long cwidth, const char *mode_width, long cheight, const char *mode_height) { void cmd_resize_set(I3_CMD, long cwidth, const char *mode_width, long cheight, const char *mode_height) {
DLOG("resizing to %ld %s x %ld %s\n", cwidth, mode_width, cheight, mode_height); DLOG("resizing to %ld %s x %ld %s\n", cwidth, mode_width, cheight, mode_height);
if (cwidth < 0 || cheight < 0) { if (cwidth < 0 || cheight < 0) {
ELOG("Resize failed: dimensions cannot be negative (was %ld %s x %ld %s)\n", cwidth, mode_width, cheight, mode_height); yerror("Dimensions cannot be negative.");
return; return;
} }
@ -782,6 +786,7 @@ void cmd_append_layout(I3_CMD, const char *cpath) {
char *buf = NULL; char *buf = NULL;
ssize_t len; ssize_t len;
if ((len = slurp(path, &buf)) < 0) { if ((len = slurp(path, &buf)) < 0) {
yerror("Could not slurp \"%s\".", path);
/* slurp already logged an error. */ /* slurp already logged an error. */
goto out; goto out;
} }
@ -1513,7 +1518,7 @@ void cmd_layout(I3_CMD, const char *layout_str) {
layout_t layout; layout_t layout;
if (!layout_from_name(layout_str, &layout)) { if (!layout_from_name(layout_str, &layout)) {
ELOG("Unknown layout \"%s\", this is a mismatch between code and parser spec.\n", layout_str); yerror("Unknown layout \"%s\", this is a mismatch between code and parser spec.", layout_str);
return; return;
} }

View File

@ -1485,42 +1485,6 @@ Con *con_next_focused(Con *con) {
return next; return next;
} }
/*
* Get the next/previous container in the specified orientation. This may
* travel up until it finds a container with suitable orientation.
*
*/
Con *con_get_next(Con *con, char way, orientation_t orientation) {
DLOG("con_get_next(way=%c, orientation=%d)\n", way, orientation);
/* 1: get the first parent with the same orientation */
Con *cur = con;
while (con_orientation(cur->parent) != orientation) {
DLOG("need to go one level further up\n");
if (cur->parent->type == CT_WORKSPACE) {
LOG("that's a workspace, we can't go further up\n");
return NULL;
}
cur = cur->parent;
}
/* 2: chose next (or previous) */
Con *next;
if (way == 'n') {
next = TAILQ_NEXT(cur, nodes);
/* if we are at the end of the list, we need to wrap */
if (next == TAILQ_END(&(parent->nodes_head)))
return NULL;
} else {
next = TAILQ_PREV(cur, nodes_head, nodes);
/* if we are at the end of the list, we need to wrap */
if (next == TAILQ_END(&(cur->nodes_head)))
return NULL;
}
DLOG("next = %p\n", next);
return next;
}
/* /*
* Returns the focused con inside this client, descending the tree as far as * Returns the focused con inside this client, descending the tree as far as
* possible. This comes in handy when attaching a con to a workspace at the * possible. This comes in handy when attaching a con to a workspace at the

View File

@ -135,16 +135,16 @@ void render_con(Con *con) {
if ((child = TAILQ_FIRST(&(con->focus_head)))) { if ((child = TAILQ_FIRST(&(con->focus_head)))) {
/* By rendering the stacked container again, we handle the case /* By rendering the stacked container again, we handle the case
* that we have a non-leaf-container inside the stack. In that * that we have a non-leaf-container inside the stack. In that
* case, the children of the non-leaf-container need to be raised * case, the children of the non-leaf-container need to be
* as well. */ * raised as well. */
render_con(child); render_con(child);
} }
if (params.children != 1) if (params.children != 1)
/* Raise the stack con itself. This will put the stack decoration on /* Raise the stack con itself. This will put the stack
* top of every stack window. That way, when a new window is opened in * decoration on top of every stack window. That way, when a
* the stack, the old window will not obscure part of the decoration * new window is opened in the stack, the old window will not
* (its unmapped afterwards). */ * obscure part of the decoration (its unmapped afterwards). */
x_raise_con(con); x_raise_con(con);
} }
} }

View File

@ -413,8 +413,7 @@ int sd_booted(void) {
struct stat a, b; struct stat a, b;
/* We simply test whether the systemd cgroup hierarchy is /* We simply test whether the systemd cgroup hierarchy is mounted */
* mounted */
if (lstat("/sys/fs/cgroup", &a) < 0) if (lstat("/sys/fs/cgroup", &a) < 0)
return 0; return 0;