]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: Correctly initialize screens when Xinerama is disabled (Thanks Moredread)
authorMichael Stapelberg <michael@stapelberg.de>
Wed, 24 Jun 2009 21:50:04 +0000 (23:50 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Wed, 24 Jun 2009 21:50:04 +0000 (23:50 +0200)
src/xinerama.c

index 818df00abf70114e1c5fb8bfbf9a5da2efec493a..f1becf8c423c0677e133bd060e0433ea901ff565 100644 (file)
@@ -100,6 +100,31 @@ i3Screen *get_screen_most(direction_t direction) {
         return candidate;
 }
 
+static void initialize_screen(xcb_connection_t *conn, i3Screen *screen, Workspace *workspace) {
+        i3Font *font = load_font(conn, config.font);
+
+        workspace->screen = screen;
+        screen->current_workspace = workspace->num;
+
+        /* Create a bar for each screen */
+        Rect bar_rect = {screen->rect.x,
+                         screen->rect.height - (font->height + 6),
+                         screen->rect.x + screen->rect.width,
+                         font->height + 6};
+        uint32_t mask = XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK;
+        uint32_t values[] = {1, XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_BUTTON_PRESS};
+        screen->bar = create_window(conn, bar_rect, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_CURSOR_LEFT_PTR, mask, values);
+        screen->bargc = xcb_generate_id(conn);
+        xcb_create_gc(conn, screen->bargc, screen->bar, 0, 0);
+
+        SLIST_INIT(&(screen->dock_clients));
+
+        /* Copy dimensions */
+        memcpy(&(workspace->rect), &(screen->rect), sizeof(Rect));
+        LOG("that is virtual screen at %d x %d with %d x %d\n",
+                        screen->rect.x, screen->rect.y, screen->rect.width, screen->rect.height);
+}
+
 /*
  * Fills virtual_screens with exactly one screen with width/height of the whole X server.
  *
@@ -114,6 +139,10 @@ static void disable_xinerama(xcb_connection_t *conn) {
         s->rect.width = root_screen->width_in_pixels;
         s->rect.height = root_screen->height_in_pixels;
 
+        num_screens = 1;
+        s->num = 0;
+        initialize_screen(conn, s, &(workspaces[0]));
+
         TAILQ_INSERT_TAIL(virtual_screens, s, screens);
 
         xinerama_enabled = false;
@@ -170,31 +199,6 @@ static void query_screens(xcb_connection_t *conn, struct screens_head *screenlis
         }
 }
 
-static void initialize_screen(xcb_connection_t *conn, i3Screen *screen, Workspace *workspace) {
-        i3Font *font = load_font(conn, config.font);
-
-        workspace->screen = screen;
-        screen->current_workspace = workspace->num;
-
-        /* Create a bar for each screen */
-        Rect bar_rect = {screen->rect.x,
-                         screen->rect.height - (font->height + 6),
-                         screen->rect.x + screen->rect.width,
-                         font->height + 6};
-        uint32_t mask = XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK;
-        uint32_t values[] = {1, XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_BUTTON_PRESS};
-        screen->bar = create_window(conn, bar_rect, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_CURSOR_LEFT_PTR, mask, values);
-        screen->bargc = xcb_generate_id(conn);
-        xcb_create_gc(conn, screen->bargc, screen->bar, 0, 0);
-
-        SLIST_INIT(&(screen->dock_clients));
-
-        /* Copy dimensions */
-        memcpy(&(workspace->rect), &(screen->rect), sizeof(Rect));
-        LOG("that is virtual screen at %d x %d with %d x %d\n",
-                        screen->rect.x, screen->rect.y, screen->rect.width, screen->rect.height);
-}
-
 /*
  * We have just established a connection to the X server and need the initial Xinerama
  * information to setup workspaces for each screen.