From: Ingo Bürk Date: Thu, 5 May 2016 12:18:04 +0000 (+0200) Subject: Remove dead code guarded with "#if 0 … #endif" (#2338) X-Git-Tag: 4.13~83 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=152318bccf9bbc3f80a7be94c7b601b425d49b4f;p=i3%2Fi3 Remove dead code guarded with "#if 0 … #endif" (#2338) This code has been neutralized for many years now and served no purpose other than cluttering up the code. We obviously don't need it and it's out of date anyway. If there's ever any reason to restore (parts of) it, we have git for that. But we don't need to keep commented out code around. --- diff --git a/i3-input/main.c b/i3-input/main.c index 2241f2cf..b467c4c3 100644 --- a/i3-input/main.c +++ b/i3-input/main.c @@ -216,10 +216,6 @@ static void finish_input() { free(full); -#if 0 - free(command); - return 1; -#endif exit(0); } diff --git a/include/floating.h b/include/floating.h index 466c0e79..e187b98f 100644 --- a/include/floating.h +++ b/include/floating.h @@ -76,25 +76,6 @@ void floating_center(Con *con, Rect rect); */ void floating_move_to_pointer(Con *con); -#if 0 -/** - * Removes the floating client from its workspace and attaches it to the new - * workspace. This is centralized here because it may happen if you move it - * via keyboard and if you move it using your mouse. - * - */ -void floating_assign_to_workspace(Client *client, Workspace *new_workspace); - -/** - * Called whenever the user clicks on a border (not the titlebar!) of a - * floating window. Determines on which border the user clicked and launches - * the drag_pointer function with the resize_callback. - * - */ -int floating_border_click(xcb_connection_t *conn, Client *client, - xcb_button_press_event_t *event); - -#endif /** * Called when the user clicked on the titlebar of a floating window. * Calls the drag_pointer function with the drag_window callback @@ -118,32 +99,6 @@ void floating_resize_window(Con *con, const bool proportional, const xcb_button_ */ void floating_check_size(Con *floating_con); -#if 0 -/** - * Changes focus in the given direction for floating clients. - * - * Changing to the left/right means going to the previous/next floating client, - * changing to top/bottom means cycling through the Z-index. - * - */ -void floating_focus_direction(xcb_connection_t *conn, Client *currently_focused, - direction_t direction); - -/** - * Moves the client 10px to the specified direction. - * - */ -void floating_move(xcb_connection_t *conn, Client *currently_focused, - direction_t direction); - -/** - * Hides all floating clients (or show them if they are currently hidden) on - * the specified workspace. - * - */ -void floating_toggle_hide(xcb_connection_t *conn, Workspace *workspace); - -#endif /** * This is the return value of a drag operation like drag_pointer. * diff --git a/include/manage.h b/include/manage.h index b0c42381..520f0c06 100644 --- a/include/manage.h +++ b/include/manage.h @@ -35,19 +35,3 @@ void restore_geometry(void); void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cookie, bool needs_to_be_mapped); - -#if 0 -/** - * reparent_window() gets called when a new window was opened and becomes a - * child of the root window, or it gets called by us when we manage the - * already existing windows at startup. - * - * Essentially, this is the point where we take over control. - * - */ -void reparent_window(xcb_connection_t *conn, xcb_window_t child, - xcb_visualid_t visual, xcb_window_t root, uint8_t depth, - int16_t x, int16_t y, uint16_t width, uint16_t height, - uint32_t border_width); - -#endif diff --git a/include/workspace.h b/include/workspace.h index 0ff5cd30..8e5ff841 100644 --- a/include/workspace.h +++ b/include/workspace.h @@ -50,17 +50,6 @@ void extract_workspace_names_from_bindings(void); */ Con *create_workspace_on_output(Output *output, Con *content); -#if 0 -/** - * Sets the name (or just its number) for the given workspace. This has to - * be called for every workspace as the rendering function - * (render_internal_bar) relies on workspace->name and workspace->name_len - * being ready-to-use. - * - */ -void workspace_set_name(Workspace *ws, const char *name); -#endif - /** * Returns true if the workspace is currently visible. Especially important for * multi-monitor environments, as they can have multiple currenlty active diff --git a/src/config.c b/src/config.c index 9028a881..c2824ca2 100644 --- a/src/config.c +++ b/src/config.c @@ -160,13 +160,6 @@ void load_configuration(xcb_connection_t *conn, const char *override_configpath, FREE(barconfig); } -/* Clear workspace names */ -#if 0 - Workspace *ws; - TAILQ_FOREACH(ws, workspaces, workspaces) - workspace_set_name(ws, NULL); -#endif - /* Invalidate pixmap caches in case font or colors changed */ Con *con; TAILQ_FOREACH(con, &all_cons, all_cons) @@ -254,21 +247,4 @@ void load_configuration(xcb_connection_t *conn, const char *override_configpath, x_deco_recurse(croot); xcb_flush(conn); } - -#if 0 - /* Set an empty name for every workspace which got no name */ - Workspace *ws; - TAILQ_FOREACH(ws, workspaces, workspaces) { - if (ws->name != NULL) { - /* If the font was not specified when the workspace name - * was loaded, we need to predict the text width now */ - if (ws->text_width == 0) - ws->text_width = predict_text_width(global_conn, - config.font, ws->name, ws->name_len); - continue; - } - - workspace_set_name(ws, NULL); - } -#endif } diff --git a/src/floating.c b/src/floating.c index 17a99638..e9c7a801 100644 --- a/src/floating.c +++ b/src/floating.c @@ -886,80 +886,3 @@ void floating_fix_coordinates(Con *con, Rect *old_rect, Rect *new_rect) { con->rect.y = (int32_t)new_rect->y + (double)(rel_y * (int32_t)new_rect->height) / (int32_t)old_rect->height - (int32_t)(con->rect.height / 2); DLOG("Resulting coordinates: x = %d, y = %d\n", con->rect.x, con->rect.y); } - -#if 0 -/* - * Moves the client 10px to the specified direction. - * - */ -void floating_move(xcb_connection_t *conn, Client *currently_focused, direction_t direction) { - DLOG("floating move\n"); - - Rect destination = currently_focused->rect; - Rect *screen = &(currently_focused->workspace->output->rect); - - switch (direction) { - case D_LEFT: - destination.x -= 10; - break; - case D_RIGHT: - destination.x += 10; - break; - case D_UP: - destination.y -= 10; - break; - case D_DOWN: - destination.y += 10; - break; - /* to make static analyzers happy */ - default: - break; - } - - /* Prevent windows from vanishing completely */ - if ((int32_t)(destination.x + destination.width - 5) <= (int32_t)screen->x || - (int32_t)(destination.x + 5) >= (int32_t)(screen->x + screen->width) || - (int32_t)(destination.y + destination.height - 5) <= (int32_t)screen->y || - (int32_t)(destination.y + 5) >= (int32_t)(screen->y + screen->height)) { - DLOG("boundary check failed, not moving\n"); - return; - } - - currently_focused->rect = destination; - reposition_client(conn, currently_focused); - - /* Because reposition_client does not send a faked configure event (only resize does), - * we need to initiate that on our own */ - fake_absolute_configure_notify(conn, currently_focused); - /* fake_absolute_configure_notify flushes */ -} - -/* - * Hides all floating clients (or show them if they are currently hidden) on - * the specified workspace. - * - */ -void floating_toggle_hide(xcb_connection_t *conn, Workspace *workspace) { - Client *client; - - workspace->floating_hidden = !workspace->floating_hidden; - DLOG("floating_hidden is now: %d\n", workspace->floating_hidden); - TAILQ_FOREACH(client, &(workspace->floating_clients), floating_clients) { - if (workspace->floating_hidden) - client_unmap(conn, client); - else client_map(conn, client); - } - - /* If we just unmapped all floating windows we should ensure that the focus - * is set correctly, that ist, to the first non-floating client in stack */ - if (workspace->floating_hidden) - SLIST_FOREACH(client, &(workspace->focus_stack), focus_clients) { - if (client_is_floating(client)) - continue; - set_focus(conn, client, true); - return; - } - - xcb_flush(conn); -} -#endif diff --git a/src/handlers.c b/src/handlers.c index 2991d7c3..2d18cbbd 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -172,16 +172,6 @@ static void handle_enter_notify(xcb_enter_notify_event_t *event) { } } -#if 0 - if (client->workspace != c_ws && client->workspace->output == c_ws->output) { - /* This can happen when a client gets assigned to a different workspace than - * the current one (see src/mainx.c:reparent_window). Shortly after it was created, - * an enter_notify will follow. */ - DLOG("enter_notify for a client on a different workspace but the same screen, ignoring\n"); - return 1; - } -#endif - if (config.disable_focus_follows_mouse) return; @@ -421,22 +411,6 @@ static void handle_configure_request(xcb_configure_request_event_t *event) { return; } -#if 0 - -/* - * Configuration notifies are only handled because we need to set up ignore for - * the following enter notify events. - * - */ -int handle_configure_event(void *prophs, xcb_connection_t *conn, xcb_configure_notify_event_t *event) { - DLOG("configure_event, sequence %d\n", event->sequence); - /* We ignore this sequence twice because events for child and frame should be ignored */ - add_ignore_event(event->sequence); - add_ignore_event(event->sequence); - - return 1; -} -#endif /* * Gets triggered upon a RandR screen change event, that is when the user @@ -630,23 +604,6 @@ static bool handle_windowrole_change(void *data, xcb_connection_t *conn, uint8_t return true; } -#if 0 -/* - * Updates the client’s WM_CLASS property - * - */ -static int handle_windowclass_change(void *data, xcb_connection_t *conn, uint8_t state, - xcb_window_t window, xcb_atom_t atom, xcb_get_property_reply_t *prop) { - Con *con; - if ((con = con_by_window_id(window)) == NULL || con->window == NULL) - return 1; - - window_update_class(con->window, prop, false); - - return 0; -} -#endif - /* * Expose event means we should redraw our windows (= title bar) * diff --git a/src/x.c b/src/x.c index ed23431c..1f812076 100644 --- a/src/x.c +++ b/src/x.c @@ -464,11 +464,6 @@ void x_draw_decoration(Con *con) { borders_to_hide = con_adjacent_borders(con) & config.hide_edge_borders; Rect br = con_border_style_rect(con); -#if 0 - DLOG("con->rect spans %d x %d\n", con->rect.width, con->rect.height); - DLOG("border_rect spans (%d, %d) with %d x %d\n", br.x, br.y, br.width, br.height); - DLOG("window_rect spans (%d, %d) with %d x %d\n", con->window_rect.x, con->window_rect.y, con->window_rect.width, con->window_rect.height); -#endif /* These rectangles represent the border around the child window * (left, bottom and right part). We don’t just fill the whole diff --git a/src/xinerama.c b/src/xinerama.c index fb3b8603..ddf98375 100644 --- a/src/xinerama.c +++ b/src/xinerama.c @@ -121,14 +121,4 @@ void xinerama_init(void) { 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 }