]> git.sur5r.net Git - i3/i3/blobdiff - src/xinerama.c
Allow assign to workspace by number
[i3/i3] / src / xinerama.c
index 049e1bc4c8c63786f5a6afcafad02b90fe075de9..25bfa6b194970257fffeaa90cc4365605dbc3acb 100644 (file)
@@ -1,5 +1,3 @@
-#undef I3__FILE__
-#define I3__FILE__ "xinerama.c"
 /*
  * vim:ts=4:sw=4:expandtab
  *
@@ -87,6 +85,19 @@ static void query_screens(xcb_connection_t *conn) {
     }
 }
 
+/*
+ * This creates the root_output (borrowed from randr.c) and uses it
+ * as the sole output for this session.
+ *
+ */
+static void use_root_output(xcb_connection_t *conn) {
+    Output *s = create_root_output(conn);
+    s->active = true;
+    TAILQ_INSERT_TAIL(&outputs, s, outputs);
+    output_init_con(s);
+    init_ws_for_output(s, output_get_content(s->con));
+}
+
 /*
  * We have just established a connection to the X server and need the initial Xinerama
  * information to setup workspaces for each screen.
@@ -95,27 +106,17 @@ static void query_screens(xcb_connection_t *conn) {
 void xinerama_init(void) {
     if (!xcb_get_extension_data(conn, &xcb_xinerama_id)->present) {
         DLOG("Xinerama extension not found, using root output.\n");
-        create_root_output(conn);
+        use_root_output(conn);
     } else {
         xcb_xinerama_is_active_reply_t *reply;
         reply = xcb_xinerama_is_active_reply(conn, xcb_xinerama_is_active(conn), NULL);
 
         if (reply == NULL || !reply->state) {
             DLOG("Xinerama is not active (in your X-Server), using root output.\n");
-            create_root_output(conn);
+            use_root_output(conn);
         } else
             query_screens(conn);
 
         FREE(reply);
     }
-
-#if 0
-    Output *output;
-    Workspace *ws;
-    /* Just go through each active output and associate one workspace */
-    TAILQ_FOREACH(output, &outputs, outputs) {
-        ws = get_first_workspace_for_output(output);
-        initialize_output(conn, output, ws);
-    }
-#endif
 }