From: Ingo Bürk Date: Sun, 9 Dec 2018 17:13:13 +0000 (+0100) Subject: Merge pull request #3549 from xzfc/small-fixes X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f08119298eb36994caf8a395474c977077799ab4;hp=b35c56687d84a9159d02f26613b754d02617eec1;p=i3%2Fi3 Merge pull request #3549 from xzfc/small-fixes Small fixes --- diff --git a/include/con.h b/include/con.h index 88992076..09ec7b44 100644 --- a/include/con.h +++ b/include/con.h @@ -378,13 +378,6 @@ orientation_t con_orientation(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 * possible. This comes in handy when attaching a con to a workspace at the diff --git a/src/bindings.c b/src/bindings.c index 6704c816..732543d0 100644 --- a/src/bindings.c +++ b/src/bindings.c @@ -123,7 +123,7 @@ static bool binding_in_current_group(const Binding *bind) { } static void grab_keycode_for_binding(xcb_connection_t *conn, Binding *bind, uint32_t keycode) { -/* Grab the key in all combinations */ + /* Grab the key in all combinations */ #define GRAB_KEY(modifier) \ do { \ xcb_grab_key(conn, 0, root, modifier, keycode, XCB_GRAB_MODE_SYNC, XCB_GRAB_MODE_ASYNC); \ diff --git a/src/click.c b/src/click.c index 1218a4c2..58ebbf3d 100644 --- a/src/click.c +++ b/src/click.c @@ -302,12 +302,6 @@ static int route_click(Con *con, xcb_button_press_event_t *event, const bool mod 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 */ if (dest == CLICK_INSIDE && mod_pressed && event->detail == XCB_BUTTON_CLICK_RIGHT) { if (floating_mod_on_tiled_client(con, event)) diff --git a/src/commands.c b/src/commands.c index ed5e482d..9f408eb7 100644 --- a/src/commands.c +++ b/src/commands.c @@ -605,13 +605,17 @@ void cmd_resize(I3_CMD, const char *way, const char *direction, long resize_px, const double ppt = (double)resize_ppt / 100.0; if (!cmd_resize_tiling_width_height(current_match, cmd_output, current->con, direction, - resize_px, ppt)) + resize_px, ppt)) { + yerror("Cannot resize."); return; + } } else { if (!cmd_resize_tiling_direction(current_match, cmd_output, current->con, direction, - resize_px, resize_ppt)) + resize_px, resize_ppt)) { + yerror("Cannot resize."); return; + } } } } @@ -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) { DLOG("resizing to %ld %s x %ld %s\n", cwidth, mode_width, cheight, mode_height); 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; } @@ -782,6 +786,7 @@ void cmd_append_layout(I3_CMD, const char *cpath) { char *buf = NULL; ssize_t len; if ((len = slurp(path, &buf)) < 0) { + yerror("Could not slurp \"%s\".", path); /* slurp already logged an error. */ goto out; } @@ -1513,7 +1518,7 @@ void cmd_layout(I3_CMD, const char *layout_str) { layout_t 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; } diff --git a/src/commands_parser.c b/src/commands_parser.c index 4299c008..0da65adc 100644 --- a/src/commands_parser.c +++ b/src/commands_parser.c @@ -353,7 +353,7 @@ CommandResult *parse_command(const char *input, yajl_gen gen) { if (*walk == '\0' || *walk == ',' || *walk == ';') { next_state(token); token_handled = true; -/* To make sure we start with an appropriate matching + /* To make sure we start with an appropriate matching * datastructure for commands which do *not* specify any * criteria, we re-initialize the criteria system after * every command. */ diff --git a/src/con.c b/src/con.c index 764419dc..f904bfe8 100644 --- a/src/con.c +++ b/src/con.c @@ -1485,42 +1485,6 @@ Con *con_next_focused(Con *con) { 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 * possible. This comes in handy when attaching a con to a workspace at the diff --git a/src/config.c b/src/config.c index 9631b216..402771b1 100644 --- a/src/config.c +++ b/src/config.c @@ -202,7 +202,7 @@ void load_configuration(xcb_connection_t *conn, const char *override_configpath, /* Clear the old config or initialize the data structure */ memset(&config, 0, sizeof(config)); -/* Initialize default colors */ + /* Initialize default colors */ #define INIT_COLOR(x, cborder, cbackground, ctext, cindicator) \ do { \ x.border = draw_util_hex_to_color(cborder); \ diff --git a/src/config_parser.c b/src/config_parser.c index 9f972fed..c238f1b9 100644 --- a/src/config_parser.c +++ b/src/config_parser.c @@ -409,7 +409,7 @@ struct ConfigResultIR *parse_config(const char *input, struct context *context) if (*walk == '\0' || *walk == '\n' || *walk == '\r') { next_state(token); token_handled = true; -/* To make sure we start with an appropriate matching + /* To make sure we start with an appropriate matching * datastructure for commands which do *not* specify any * criteria, we re-initialize the criteria system after * every command. */ diff --git a/src/log.c b/src/log.c index 916085f4..31db8b33 100644 --- a/src/log.c +++ b/src/log.c @@ -124,9 +124,9 @@ void init_logging(void) { */ void open_logbuffer(void) { /* Reserve 1% of the RAM for the logfile, but at max 25 MiB. - * For 512 MiB of RAM this will lead to a 5 MiB log buffer. - * At the moment (2011-12-10), no testcase leads to an i3 log - * of more than ~ 600 KiB. */ + * For 512 MiB of RAM this will lead to a 5 MiB log buffer. + * At the moment (2011-12-10), no testcase leads to an i3 log + * of more than ~ 600 KiB. */ logbuffer_size = min(physical_mem_bytes * 0.01, shmlog_size); #if defined(__FreeBSD__) sasprintf(&shmlogname, "/tmp/i3-log-%d", getpid()); diff --git a/src/main.c b/src/main.c index b8b4bdf1..4a20e0c0 100644 --- a/src/main.c +++ b/src/main.c @@ -529,7 +529,7 @@ int main(int argc, char *argv[]) { root_screen = xcb_aux_get_screen(conn, conn_screen); root = root_screen->root; -/* Place requests for the atoms we need as soon as possible */ + /* Place requests for the atoms we need as soon as possible */ #define xmacro(atom) \ xcb_intern_atom_cookie_t atom##_cookie = xcb_intern_atom(conn, 0, strlen(#atom), #atom); #include "atoms.xmacro" @@ -567,7 +567,7 @@ int main(int argc, char *argv[]) { xcb_get_geometry_cookie_t gcookie = xcb_get_geometry(conn, root); xcb_query_pointer_cookie_t pointercookie = xcb_query_pointer(conn, root); -/* Setup NetWM atoms */ + /* Setup NetWM atoms */ #define xmacro(name) \ do { \ xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(conn, name##_cookie, NULL); \ diff --git a/src/render.c b/src/render.c index e9e38ae0..e16e36d7 100644 --- a/src/render.c +++ b/src/render.c @@ -134,17 +134,17 @@ void render_con(Con *con) { x_raise_con(child); if ((child = TAILQ_FIRST(&(con->focus_head)))) { /* By rendering the stacked container again, we handle the case - * that we have a non-leaf-container inside the stack. In that - * case, the children of the non-leaf-container need to be raised - * as well. */ + * that we have a non-leaf-container inside the stack. In that + * case, the children of the non-leaf-container need to be + * raised as well. */ render_con(child); } if (params.children != 1) - /* Raise the stack con itself. This will put the stack decoration on - * top of every stack window. That way, when a new window is opened in - * the stack, the old window will not obscure part of the decoration - * (it’s unmapped afterwards). */ + /* Raise the stack con itself. This will put the stack + * decoration on top of every stack window. That way, when a + * new window is opened in the stack, the old window will not + * obscure part of the decoration (it’s unmapped afterwards). */ x_raise_con(con); } } diff --git a/src/scratchpad.c b/src/scratchpad.c index a679f20a..b7fbcc92 100644 --- a/src/scratchpad.c +++ b/src/scratchpad.c @@ -121,8 +121,8 @@ bool scratchpad_show(Con *con) { DLOG("Found an unfocused scratchpad window on this workspace\n"); DLOG("Focusing it: %p\n", walk_con); /* use con_descend_tiling_focused to get the last focused - * window inside this scratch container in order to - * keep the focus the same within this container */ + * window inside this scratch container in order to + * keep the focus the same within this container */ con_activate(con_descend_tiling_focused(walk_con)); return true; } diff --git a/src/sd-daemon.c b/src/sd-daemon.c index dc33b2e9..28a88bfd 100644 --- a/src/sd-daemon.c +++ b/src/sd-daemon.c @@ -413,8 +413,7 @@ int sd_booted(void) { struct stat a, b; - /* We simply test whether the systemd cgroup hierarchy is - * mounted */ + /* We simply test whether the systemd cgroup hierarchy is mounted */ if (lstat("/sys/fs/cgroup", &a) < 0) return 0; diff --git a/src/window.c b/src/window.c index bec4c691..799488c6 100644 --- a/src/window.c +++ b/src/window.c @@ -439,7 +439,7 @@ void window_update_hints(i3Window *win, xcb_get_property_reply_t *prop, bool *ur * */ void window_update_motif_hints(i3Window *win, xcb_get_property_reply_t *prop, border_style_t *motif_border_style) { -/* This implementation simply mirrors Gnome's Metacity. Official + /* This implementation simply mirrors Gnome's Metacity. Official * documentation of this hint is nowhere to be found. * For more information see: * https://people.gnome.org/~tthurman/docs/metacity/xprops_8h-source.html