]> git.sur5r.net Git - i3/i3/blobdiff - src/randr.c
Don’t set the _NET_WM_WORKAREA hint at all (Thanks cg)
[i3/i3] / src / randr.c
index 0329038ba2db31b379bb2e32463fb7d4fd728599..d1683e9f925ea7c3c504801be73ff560a9141418 100644 (file)
@@ -243,7 +243,7 @@ void output_init_con(Output *output) {
     output->con = con;
 
     char *name;
-    asprintf(&name, "[i3 con] output %s", con->name);
+    sasprintf(&name, "[i3 con] output %s", con->name);
     x_set_name(con, name);
     FREE(name);
 
@@ -267,7 +267,7 @@ void output_init_con(Output *output) {
     FREE(topdock->name);
     topdock->name = sstrdup("topdock");
 
-    asprintf(&name, "[i3 con] top dockarea %s", con->name);
+    sasprintf(&name, "[i3 con] top dockarea %s", con->name);
     x_set_name(topdock, name);
     FREE(name);
     DLOG("attaching\n");
@@ -281,7 +281,7 @@ void output_init_con(Output *output) {
     FREE(content->name);
     content->name = sstrdup("content");
 
-    asprintf(&name, "[i3 con] content %s", con->name);
+    sasprintf(&name, "[i3 con] content %s", con->name);
     x_set_name(content, name);
     FREE(name);
     con_attach(content, con, false);
@@ -301,7 +301,7 @@ void output_init_con(Output *output) {
     FREE(bottomdock->name);
     bottomdock->name = sstrdup("bottomdock");
 
-    asprintf(&name, "[i3 con] bottom dockarea %s", con->name);
+    sasprintf(&name, "[i3 con] bottom dockarea %s", con->name);
     x_set_name(bottomdock, name);
     FREE(name);
     DLOG("attaching\n");
@@ -420,11 +420,12 @@ void init_ws_for_output(Output *output, Con *content) {
             continue;
         DLOG("relevant command = %s\n", bind->command);
         char *target = bind->command + strlen("workspace ");
-        /* We check if this is the workspace next/prev command. Beware: The
-         * workspace names "next" and "prev" are OK, so we check before
-         * stripping the double quotes */
+        /* We check if this is the workspace next/prev/back_and_forth command.
+         * Beware: The workspace names "next", "prev" and "back_and_forth" are
+         * OK, so we check before stripping the double quotes */
         if (strncasecmp(target, "next", strlen("next")) == 0 ||
-            strncasecmp(target, "prev", strlen("prev")) == 0)
+            strncasecmp(target, "prev", strlen("prev")) == 0 ||
+            strncasecmp(target, "back_and_forth", strlen("back_and_forth")) == 0)
             continue;
         if (*target == '"')
             target++;
@@ -464,7 +465,7 @@ void init_ws_for_output(Output *output, Con *content) {
             c++;
 
             FREE(ws->name);
-            asprintf(&(ws->name), "%d", c);
+            sasprintf(&(ws->name), "%d", c);
 
             current = NULL;
             TAILQ_FOREACH(out, &(croot->nodes_head), nodes)
@@ -477,7 +478,7 @@ void init_ws_for_output(Output *output, Con *content) {
     }
     con_attach(ws, content, false);
 
-    asprintf(&name, "[i3 con] workspace %s", ws->name);
+    sasprintf(&name, "[i3 con] workspace %s", ws->name);
     x_set_name(ws, name);
     free(name);
 
@@ -562,7 +563,7 @@ static void handle_output(xcb_connection_t *conn, xcb_randr_output_t id,
     new->id = id;
     new->primary = (primary && primary->output == id);
     FREE(new->name);
-    asprintf(&new->name, "%.*s",
+    sasprintf(&new->name, "%.*s",
             xcb_randr_get_output_info_name_length(output),
             xcb_randr_get_output_info_name(output));
 
@@ -743,7 +744,7 @@ void randr_query_outputs() {
                 Con *next = NULL;
                 if (TAILQ_FIRST(&(croot->focus_head)) == output->con) {
                     DLOG("This output (%p) was focused! Getting next\n", output->con);
-                    next = con_next_focused(output->con);
+                    next = focused;
                     DLOG("next = %p\n", next);
                 }
 
@@ -763,6 +764,7 @@ void randr_query_outputs() {
                 if (next) {
                     DLOG("now focusing next = %p\n", next);
                     con_focus(next);
+                    workspace_show(con_get_workspace(next));
                 }
 
                 /* 3: move the dock clients to the first output */
@@ -806,8 +808,6 @@ void randr_query_outputs() {
         disable_randr(conn);
     }
 
-    ewmh_update_workarea();
-
     /* Just go through each active output and assign one workspace */
     TAILQ_FOREACH(output, &outputs, outputs) {
         if (!output->active)
@@ -844,9 +844,10 @@ void randr_init(int *event_base) {
     const xcb_query_extension_reply_t *extreply;
 
     extreply = xcb_get_extension_data(conn, &xcb_randr_id);
-    if (!extreply->present)
+    if (!extreply->present) {
         disable_randr(conn);
-    else randr_query_outputs();
+        return;
+    } else randr_query_outputs();
 
     if (event_base != NULL)
         *event_base = extreply->first_event;