*
*/
Con *con_new_skeleton(Con *parent, i3Window *window) {
- Con *new = scalloc(sizeof(Con));
+ Con *new = scalloc(1, sizeof(Con));
new->on_remove_child = con_on_remove_child;
TAILQ_INSERT_TAIL(&all_cons, new, all_cons);
- new->aspect_ratio = 0.0;
new->type = CT_CON;
new->window = window;
new->border_style = config.default_border;
new->current_border_width = -1;
- if (window)
+ if (window) {
new->depth = window->depth;
- else
+ new->window->aspect_ratio = 0.0;
+ } else {
new->depth = XCB_COPY_FROM_PARENT;
+ }
DLOG("opening window\n");
TAILQ_INIT(&(new->floating_head));
* checks before resetting the urgency.
*/
if (con->urgent && con_is_leaf(con)) {
- con->urgent = false;
+ con_set_urgency(con, false);
con_update_parents_urgency(con);
workspace_update_urgent_flag(con_get_workspace(con));
ipc_send_window_event("urgent", con);
/* Prevent moving if this would violate the fullscreen focus restrictions. */
Con *target_ws = con_get_workspace(target);
if (!con_fullscreen_permits_focusing(target_ws)) {
- LOG("Cannot move out of a fullscreen container");
+ LOG("Cannot move out of a fullscreen container.\n");
return false;
}
if (con_is_floating(con)) {
- DLOG("Using FLOATINGCON instead\n");
+ DLOG("Container is floating, using parent instead.\n");
con = con->parent;
}
int border_style = con_border_style(con);
if (border_style == BS_NONE)
return (Rect){0, 0, 0, 0};
- borders_to_hide = con_adjacent_borders(con) & config.hide_edge_borders;
if (border_style == BS_NORMAL) {
result = (Rect){border_width, 0, -(2 * border_width), -(border_width)};
} else {
result = (Rect){border_width, border_width, -(2 * border_width), -(2 * border_width)};
}
- /* Floating windows are never adjacent to any other window, so
- don’t hide their border(s). This prevents bug #998. */
- if (con_is_floating(con))
- return result;
-
+ borders_to_hide = con_adjacent_borders(con) & config.hide_edge_borders;
if (borders_to_hide & ADJ_LEFT_SCREEN_EDGE) {
result.x -= border_width;
result.width += border_width;
*/
adjacent_t con_adjacent_borders(Con *con) {
adjacent_t result = ADJ_NONE;
+ /* Floating windows are never adjacent to any other window, so
+ don’t hide their border(s). This prevents bug #998. */
+ if (con_is_floating(con))
+ return result;
+
Con *workspace = con_get_workspace(con);
if (con->rect.x == workspace->rect.x)
result |= ADJ_LEFT_SCREEN_EDGE;
*
*/
void con_set_urgency(Con *con, bool urgent) {
- if (focused == con) {
+ if (urgent && focused == con) {
DLOG("Ignoring urgency flag for current client\n");
- con->window->urgent.tv_sec = 0;
- con->window->urgent.tv_usec = 0;
return;
}
+ const bool old_urgent = con->urgent;
+
if (con->urgency_timer == NULL) {
con->urgent = urgent;
} else
if ((ws = con_get_workspace(con)) != NULL)
workspace_update_urgent_flag(ws);
- if (con->urgent == urgent) {
+ if (con->urgent != old_urgent) {
LOG("Urgency flag changed to %d\n", con->urgent);
ipc_send_window_event("urgent", con);
}