]> git.sur5r.net Git - i3/i3/blobdiff - src/x.c
Merge pull request #3052 from d-e-s-o/remove-magic-numbers
[i3/i3] / src / x.c
diff --git a/src/x.c b/src/x.c
index f3dbc237aff363b15f11dfbc31b990782378a494..7829079bb0363f8514e5b1abe6513434c0db809a 100644 (file)
--- a/src/x.c
+++ b/src/x.c
@@ -127,7 +127,7 @@ void x_con_init(Con *con) {
     /* We explicitly set a background color and border color (even though we
      * don’t even have a border) because the X11 server requires us to when
      * using 32 bit color depths, see
-     * http://stackoverflow.com/questions/3645632 */
+     * https://stackoverflow.com/questions/3645632 */
     mask |= XCB_CW_BACK_PIXEL;
     values[0] = root_screen->black_pixel;
 
@@ -572,9 +572,6 @@ void x_draw_decoration(Con *con) {
         goto after_title;
     }
 
-    if (win->name == NULL)
-        goto copy_pixmaps;
-
     int mark_width = 0;
     if (config.show_marks && !TAILQ_EMPTY(&(con->marks_head))) {
         char *formatted_mark = sstrdup("");
@@ -608,13 +605,19 @@ void x_draw_decoration(Con *con) {
     }
 
     i3String *title = con->title_format == NULL ? win->name : con_parse_title_format(con);
+    if (title == NULL) {
+        goto copy_pixmaps;
+    }
+
     draw_util_text(title, &(parent->frame_buffer),
                    p->color->text, p->color->background,
                    con->deco_rect.x + logical_px(2),
                    con->deco_rect.y + text_offset_y,
                    con->deco_rect.width - mark_width - 2 * logical_px(2));
-    if (con->title_format != NULL)
+
+    if (con->title_format != NULL) {
         I3STRING_FREE(title);
+    }
 
 after_title:
     x_draw_decoration_after_title(con, p);
@@ -901,8 +904,9 @@ void x_push_node(Con *con) {
     /* Handle all children and floating windows of this node. We recurse
      * in focus order to display the focused client in a stack first when
      * switching workspaces (reduces flickering). */
-    TAILQ_FOREACH(current, &(con->focus_head), focused)
-    x_push_node(current);
+    TAILQ_FOREACH(current, &(con->focus_head), focused) {
+        x_push_node(current);
+    }
 }
 
 /*
@@ -1223,9 +1227,13 @@ void x_set_name(Con *con, const char *name) {
  *
  */
 void update_shmlog_atom() {
-    xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root,
-                        A_I3_SHMLOG_PATH, A_UTF8_STRING, 8,
-                        strlen(shmlogname), shmlogname);
+    if (*shmlogname == '\0') {
+        xcb_delete_property(conn, root, A_I3_SHMLOG_PATH);
+    } else {
+        xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root,
+                            A_I3_SHMLOG_PATH, A_UTF8_STRING, 8,
+                            strlen(shmlogname), shmlogname);
+    }
 }
 
 /*