From: Michael Stapelberg Date: Fri, 26 Nov 2010 21:15:09 +0000 (+0100) Subject: remove some obsolete code X-Git-Tag: tree-pr1~60 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=65bd71b213da5ae570b42b0fb4c8acfa77dccaac;p=i3%2Fi3 remove some obsolete code --- diff --git a/src/util.c b/src/util.c index df69ecc4..04ec1508 100644 --- a/src/util.c +++ b/src/util.c @@ -287,116 +287,6 @@ void set_focus(xcb_connection_t *conn, Client *client, bool set_anyways) { redecorate_window(conn, client); } -/* - * Called when the user switches to another mode or when the container is - * destroyed and thus needs to be cleaned up. - * - */ -void leave_stack_mode(xcb_connection_t *conn, Container *container) { - /* When going out of stacking mode, we need to close the window */ - struct Stack_Window *stack_win = &(container->stack_win); - - SLIST_REMOVE(&stack_wins, stack_win, Stack_Window, stack_windows); - - xcb_free_gc(conn, stack_win->pixmap.gc); - xcb_free_pixmap(conn, stack_win->pixmap.id); - xcb_destroy_window(conn, stack_win->window); - - stack_win->rect.width = -1; - stack_win->rect.height = -1; -} - -/* - * Switches the layout of the given container taking care of the necessary house-keeping - * - */ -void switch_layout_mode(xcb_connection_t *conn, Container *container, int mode) { - if (mode == MODE_STACK || mode == MODE_TABBED) { - /* When we’re already in stacking mode, nothing has to be done */ - if ((mode == MODE_STACK && container->mode == MODE_STACK) || - (mode == MODE_TABBED && container->mode == MODE_TABBED)) - return; - - if (container->mode == MODE_STACK || container->mode == MODE_TABBED) - goto after_stackwin; - - /* When entering stacking mode, we need to open a window on - * which we can draw the title bars of the clients, it has - * height 1 because we don’t bother here with calculating the - * correct height - it will be adjusted when rendering anyways. - * Also, we need to use max(width, 1) because windows cannot - * be created with either width == 0 or height == 0. */ - Rect rect = {container->x, container->y, max(container->width, 1), 1}; - - uint32_t mask = 0; - uint32_t values[2]; - - /* Don’t generate events for our new window, it should *not* be managed */ - mask |= XCB_CW_OVERRIDE_REDIRECT; - values[0] = 1; - - /* We want to know when… */ - mask |= XCB_CW_EVENT_MASK; - values[1] = XCB_EVENT_MASK_ENTER_WINDOW | /* …mouse is moved into our window */ - XCB_EVENT_MASK_BUTTON_PRESS | /* …mouse is pressed */ - XCB_EVENT_MASK_EXPOSURE; /* …our window needs to be redrawn */ - - struct Stack_Window *stack_win = &(container->stack_win); - stack_win->window = create_window(conn, rect, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_CURSOR_LEFT_PTR, false, mask, values); - - stack_win->rect.height = 0; - - /* Initialize the entry for our cached pixmap. It will be - * created as soon as it’s needed (see cached_pixmap_prepare). */ - memset(&(stack_win->pixmap), 0, sizeof(struct Cached_Pixmap)); - stack_win->pixmap.referred_rect = &stack_win->rect; - stack_win->pixmap.referred_drawable = stack_win->window; - - stack_win->container = container; - - SLIST_INSERT_HEAD(&stack_wins, stack_win, stack_windows); - } else { - if (container->mode == MODE_STACK || container->mode == MODE_TABBED) - leave_stack_mode(conn, container); - } -after_stackwin: - container->mode = mode; - - /* Force reconfiguration of each client */ - Client *client; - - CIRCLEQ_FOREACH(client, &(container->clients), clients) - client->force_reconfigure = true; - - render_layout(conn); - - if (container->currently_focused != NULL) { - /* We need to make sure that this client is above *each* of the - * other clients in this container */ - Client *last_focused = get_last_focused_client(conn, container, container->currently_focused); - - CIRCLEQ_FOREACH(client, &(container->clients), clients) { - if (client == container->currently_focused || client == last_focused) - continue; - - DLOG("setting %08x below %08x / %08x\n", client->frame, container->currently_focused->frame); - uint32_t values[] = { container->currently_focused->frame, XCB_STACK_MODE_BELOW }; - xcb_configure_window(conn, client->frame, - XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE, values); - } - - if (last_focused != NULL) { - DLOG("Putting last_focused directly underneath the currently focused\n"); - uint32_t values[] = { container->currently_focused->frame, XCB_STACK_MODE_BELOW }; - xcb_configure_window(conn, last_focused->frame, - XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE, values); - } - - - set_focus(conn, container->currently_focused, true); - } -} - /* * Gets the first matching client for the given window class/window title. * If the paramater specific is set to a specific client, only this one