X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fworkspace.c;h=70022151117c7392f1de4bff97ee8e776322e79e;hb=bc52fae15c75635e9cec57e25619d304dba3a69b;hp=f55c920ebd4697b7cd9346c8d233993d7625c202;hpb=6d94231f745bfa9c85c8cec8bf862cdfcc8a07d7;p=i3%2Fi3 diff --git a/src/workspace.c b/src/workspace.c index f55c920e..70022151 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -4,7 +4,7 @@ * vim:ts=4:sw=4:expandtab * * i3 - an improved dynamic tiling window manager - * © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE) + * © 2009 Michael Stapelberg and contributors (see also: LICENSE) * * workspace.c: Modifying workspaces, accessing them, moving containers to * workspaces. @@ -29,6 +29,7 @@ static void _workspace_apply_default_orientation(Con *ws) { if (config.default_orientation == NO_ORIENTATION) { Con *output = con_get_output(ws); ws->layout = (output->rect.height > output->rect.width) ? L_SPLITV : L_SPLITH; + ws->rect = output->rect; DLOG("Auto orientation. Workspace size set to (%d,%d), setting layout to %d.\n", output->rect.width, output->rect.height, ws->layout); } else { @@ -128,7 +129,7 @@ Con *create_workspace_on_output(Output *output, Con *content) { continue; DLOG("relevant command = %s\n", bind->command); const char *target = bind->command + strlen("workspace "); - while ((*target == ' ' || *target == '\t') && target != '\0') + while (*target == ' ' || *target == '\t') target++; /* We check if this is the workspace * next/prev/next_on_output/prev_on_output/back_and_forth/number command. @@ -321,17 +322,17 @@ static void workspace_reassign_sticky(Con *con) { static void workspace_defer_update_urgent_hint_cb(EV_P_ ev_timer *w, int revents) { Con *con = w->data; + ev_timer_stop(main_loop, con->urgency_timer); + FREE(con->urgency_timer); + if (con->urgent) { DLOG("Resetting urgency flag of con %p by timer\n", 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); tree_render(); } - - ev_timer_stop(main_loop, con->urgency_timer); - FREE(con->urgency_timer); } static void _workspace_show(Con *workspace) { @@ -396,7 +397,7 @@ static void _workspace_show(Con *workspace) { if (focused->urgency_timer == NULL) { DLOG("Deferring reset of urgency flag of con %p on newly shown workspace %p\n", focused, workspace); - focused->urgency_timer = scalloc(sizeof(struct ev_timer)); + focused->urgency_timer = scalloc(1, sizeof(struct ev_timer)); /* use a repeating timer to allow for easy resets */ ev_timer_init(focused->urgency_timer, workspace_defer_update_urgent_hint_cb, config.workspace_urgency_timer, config.workspace_urgency_timer); @@ -728,7 +729,7 @@ workspace_prev_on_output_end: */ void workspace_back_and_forth(void) { if (!previous_workspace_name) { - DLOG("No previous workspace name set. Not switching."); + DLOG("No previous workspace name set. Not switching.\n"); return; } @@ -741,7 +742,7 @@ void workspace_back_and_forth(void) { */ Con *workspace_back_and_forth_get(void) { if (!previous_workspace_name) { - DLOG("no previous workspace name set."); + DLOG("No previous workspace name set.\n"); return NULL; } @@ -846,6 +847,9 @@ Con *workspace_attach_to(Con *ws) { DLOG("Attaching new split %p to workspace %p\n", new, ws); con_attach(new, ws, false); + /* 5: fix the percentages */ + con_fix_percent(ws); + return new; }