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.
This commit is contained in:
Ingo Bürk 2016-05-05 14:18:04 +02:00 committed by Michael Stapelberg
parent d242ae1745
commit 152318bccf
9 changed files with 0 additions and 235 deletions

View File

@ -216,10 +216,6 @@ static void finish_input() {
free(full); free(full);
#if 0
free(command);
return 1;
#endif
exit(0); exit(0);
} }

View File

@ -76,25 +76,6 @@ void floating_center(Con *con, Rect rect);
*/ */
void floating_move_to_pointer(Con *con); 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. * Called when the user clicked on the titlebar of a floating window.
* Calls the drag_pointer function with the drag_window callback * 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); 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. * This is the return value of a drag operation like drag_pointer.
* *

View File

@ -35,19 +35,3 @@ void restore_geometry(void);
void manage_window(xcb_window_t window, void manage_window(xcb_window_t window,
xcb_get_window_attributes_cookie_t cookie, xcb_get_window_attributes_cookie_t cookie,
bool needs_to_be_mapped); 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

View File

@ -50,17 +50,6 @@ void extract_workspace_names_from_bindings(void);
*/ */
Con *create_workspace_on_output(Output *output, Con *content); 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 * Returns true if the workspace is currently visible. Especially important for
* multi-monitor environments, as they can have multiple currenlty active * multi-monitor environments, as they can have multiple currenlty active

View File

@ -160,13 +160,6 @@ void load_configuration(xcb_connection_t *conn, const char *override_configpath,
FREE(barconfig); 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 */ /* Invalidate pixmap caches in case font or colors changed */
Con *con; Con *con;
TAILQ_FOREACH(con, &all_cons, all_cons) 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); x_deco_recurse(croot);
xcb_flush(conn); 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
} }

View File

@ -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); 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); 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

View File

@ -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) if (config.disable_focus_follows_mouse)
return; return;
@ -421,22 +411,6 @@ static void handle_configure_request(xcb_configure_request_event_t *event) {
return; 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 * 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; return true;
} }
#if 0
/*
* Updates the clients 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) * Expose event means we should redraw our windows (= title bar)
* *

View File

@ -464,11 +464,6 @@ void x_draw_decoration(Con *con) {
borders_to_hide = con_adjacent_borders(con) & config.hide_edge_borders; borders_to_hide = con_adjacent_borders(con) & config.hide_edge_borders;
Rect br = con_border_style_rect(con); 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 /* These rectangles represent the border around the child window
* (left, bottom and right part). We dont just fill the whole * (left, bottom and right part). We dont just fill the whole

View File

@ -121,14 +121,4 @@ void xinerama_init(void) {
FREE(reply); 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
} }