]> git.sur5r.net Git - i3/i3/blobdiff - src/commands.c
get_output_for_con: Assert result != NULL
[i3/i3] / src / commands.c
index 57dc58b4c1633ca367d0259a4e517f5b5d0a82ef..b7fbce902f324836cab989ab2cfca3bd96e7fc5a 100644 (file)
 #include <float.h>
 #include <stdarg.h>
 
-#ifdef I3_ASAN_ENABLED
-#include <sanitizer/lsan_interface.h>
-#endif
-
 #include "shmlog.h"
 
 // Macros to make the YAJL API a bit easier to use.
@@ -467,7 +463,7 @@ static void cmd_resize_floating(I3_CMD, const char *way, const char *direction_s
     } else {
         floating_con->rect.width += px;
     }
-    floating_check_size(floating_con);
+    floating_check_size(floating_con, orientation == VERT);
 
     /* Did we actually resize anything or did the size constraints prevent us?
      * If we could not resize, exit now to not move the window. */
@@ -605,13 +601,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 +657,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 +782,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;
     }
@@ -831,7 +832,7 @@ void cmd_append_layout(I3_CMD, const char *cpath) {
     // is not executed yet and will be batched with append_layout’s
     // needs_tree_render after the parser finished. We should check if that is
     // necessary at all.
-    render_con(croot, false);
+    render_con(croot);
 
     restore_open_placeholder_windows(parent);
 
@@ -1113,22 +1114,13 @@ void cmd_move_workspace_to_output(I3_CMD, const char *name) {
         }
 
         Output *current_output = get_output_for_con(ws);
-        if (current_output == NULL) {
-            yerror("Cannot get current output. This is a bug in i3.");
-            return;
-        }
-
         Output *target_output = get_output_from_string(current_output, name);
         if (!target_output) {
             yerror("Could not get output from string \"%s\"", name);
             return;
         }
 
-        bool success = workspace_move_to_output(ws, target_output);
-        if (!success) {
-            yerror("Failed to move workspace to output.");
-            return;
-        }
+        workspace_move_to_output(ws, target_output);
     }
 
     cmd_output->needs_tree_render = true;
@@ -1513,7 +1505,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;
     }
 
@@ -1568,12 +1560,6 @@ void cmd_layout_toggle(I3_CMD, const char *toggle_mode) {
  */
 void cmd_exit(I3_CMD) {
     LOG("Exiting due to user command.\n");
-#ifdef I3_ASAN_ENABLED
-    __lsan_do_leak_check();
-#endif
-    ipc_shutdown(SHUTDOWN_REASON_EXIT);
-    unlink(config.ipc_socket_path);
-    xcb_disconnect(conn);
     exit(0);
 
     /* unreached */