-void realloc_sl_buffer(void) {
- DLOG("Re-allocating statusline-buffer, statusline_width = %d, root_screen->width_in_pixels = %d\n",
- statusline_width, root_screen->width_in_pixels);
- xcb_free_pixmap(xcb_connection, statusline_pm);
- statusline_pm = xcb_generate_id(xcb_connection);
- xcb_void_cookie_t sl_pm_cookie = xcb_create_pixmap_checked(xcb_connection,
- root_screen->root_depth,
- statusline_pm,
- xcb_root,
- MAX(root_screen->width_in_pixels, statusline_width),
- bar_height);
-
- uint32_t mask = XCB_GC_FOREGROUND;
- uint32_t vals[2] = {colors.bar_bg, colors.bar_bg};
- xcb_free_gc(xcb_connection, statusline_clear);
- statusline_clear = xcb_generate_id(xcb_connection);
- xcb_void_cookie_t clear_ctx_cookie = xcb_create_gc_checked(xcb_connection,
- statusline_clear,
- xcb_root,
- mask,
- vals);
-
- mask |= XCB_GC_BACKGROUND;
- vals[0] = colors.bar_fg;
- xcb_free_gc(xcb_connection, statusline_ctx);
- statusline_ctx = xcb_generate_id(xcb_connection);
- xcb_void_cookie_t sl_ctx_cookie = xcb_create_gc_checked(xcb_connection,
- statusline_ctx,
- xcb_root,
- mask,
- vals);
-
- if (xcb_request_failed(sl_pm_cookie, "Could not allocate statusline-buffer") ||
- xcb_request_failed(clear_ctx_cookie, "Could not allocate statusline-buffer-clearcontext") ||
- xcb_request_failed(sl_ctx_cookie, "Could not allocate statusline-buffer-context")) {
- exit(EXIT_FAILURE);
+static i3_output *get_tray_output(void) {
+ i3_output *output = NULL;
+ if (TAILQ_EMPTY(&(config.tray_outputs))) {
+ /* No tray_output specified, use first active output. */
+ SLIST_FOREACH(output, outputs, slist) {
+ if (output->active) {
+ return output;
+ }
+ }
+ return NULL;
+ } else if (strcasecmp(TAILQ_FIRST(&(config.tray_outputs))->output, "none") == 0) {
+ /* Check for "tray_output none" */
+ return NULL;