return NULL;
}
+/*
+ * Changes the atoms on the root window and the windows themselves to properly
+ * reflect the current focus for ewmh compliance.
+ *
+ */
+static void change_ewmh_focus(xcb_window_t new_focus, xcb_window_t old_focus) {
+ ewmh_update_active_window(new_focus);
+
+ if (new_focus != XCB_WINDOW_NONE) {
+ ewmh_update_focused(new_focus, true);
+ }
+
+ if (old_focus != XCB_WINDOW_NONE) {
+ ewmh_update_focused(old_focus, false);
+ }
+}
+
/*
* Initializes the X11 part for the given container. Called exactly once for
* every container from con_new().
/* 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;
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("");
}
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);
/* 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);
+ }
}
/*
to_focus, focused, focused->name);
send_take_focus(to_focus, last_timestamp);
- ewmh_update_active_window((con_has_managed_window(focused) ? focused->window->id : XCB_WINDOW_NONE));
+ change_ewmh_focus((con_has_managed_window(focused) ? focused->window->id : XCB_WINDOW_NONE), last_focused);
if (to_focus != last_focused && is_con_attached(focused))
ipc_send_window_event("focus", focused);
xcb_change_window_attributes(conn, focused->window->id, XCB_CW_EVENT_MASK, values);
}
- ewmh_update_active_window((con_has_managed_window(focused) ? focused->window->id : XCB_WINDOW_NONE));
+ change_ewmh_focus((con_has_managed_window(focused) ? focused->window->id : XCB_WINDOW_NONE), last_focused);
if (to_focus != XCB_NONE && to_focus != last_focused && focused->window != NULL && is_con_attached(focused))
ipc_send_window_event("focus", focused);
* root window in order to avoid an X11 fallback mechanism causing a ghosting effect (see #1378). */
DLOG("Still no window focused, better set focus to the EWMH support window (%d)\n", ewmh_window);
xcb_set_input_focus(conn, XCB_INPUT_FOCUS_POINTER_ROOT, ewmh_window, last_timestamp);
- ewmh_update_active_window(XCB_WINDOW_NONE);
+ change_ewmh_focus(XCB_WINDOW_NONE, last_focused);
+
focused_id = ewmh_window;
}
*
*/
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);
+ }
}
/*