Remove some commented out code.

This commit is contained in:
Fernando Tarlá Cardoso Lemos 2010-11-30 22:43:15 -02:00 committed by Michael Stapelberg
parent a1dd74da5a
commit 3669bcbd5f
2 changed files with 0 additions and 214 deletions

View File

@ -103,49 +103,6 @@ void check_error(xcb_connection_t *conn, xcb_void_cookie_t cookie,
*/
char *convert_utf8_to_ucs2(char *input, int *real_strlen);
#if 0
/**
* Returns the client which comes next in focus stack (= was selected before) for
* the given container, optionally excluding the given client.
*
*/
Client *get_last_focused_client(xcb_connection_t *conn, Container *container,
Client *exclude);
#endif
#if 0
/**
* Sets the given client as focused by updating the data structures correctly,
* updating the X input focus and finally re-decorating both windows (to
* signalize the user the new focus situation)
*
*/
void set_focus(xcb_connection_t *conn, Client *client, bool set_anyways);
/**
* 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);
/**
* 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);
/**
* 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
* will be checked.
*
*/
Client *get_matching_client(xcb_connection_t *conn,
const char *window_classtitle, Client *specific);
#endif
/*
* Restart i3 in-place
* appends -a to argument list to disable autostart
@ -153,9 +110,4 @@ Client *get_matching_client(xcb_connection_t *conn,
*/
void i3_restart();
#if defined(__OpenBSD__)
/* OpenBSD does not provide memmem(), so we provide FreeBSDs implementation */
void *memmem(const void *l, size_t l_len, const void *s, size_t s_len);
#endif
#endif

View File

@ -174,172 +174,6 @@ char *convert_utf8_to_ucs2(char *input, int *real_strlen) {
return buffer;
}
#if 0
/*
* Returns the client which comes next in focus stack (= was selected before) for
* the given container, optionally excluding the given client.
*
*/
Client *get_last_focused_client(xcb_connection_t *conn, Container *container, Client *exclude) {
Client *current;
SLIST_FOREACH(current, &(container->workspace->focus_stack), focus_clients)
if ((current->container == container) && ((exclude == NULL) || (current != exclude)))
return current;
return NULL;
}
/*
* Sets the given client as focused by updating the data structures correctly,
* updating the X input focus and finally re-decorating both windows (to signalize
* the user the new focus situation)
*
*/
void set_focus(xcb_connection_t *conn, Client *client, bool set_anyways) {
/* The dock window cannot be focused, but enter notifies are still handled correctly */
if (client->dock)
return;
/* Store the old client */
Client *old_client = SLIST_FIRST(&(c_ws->focus_stack));
/* Check if the focus needs to be changed at all */
if (!set_anyways && (old_client == client))
return;
/* Store current_row/current_col */
c_ws->current_row = current_row;
c_ws->current_col = current_col;
c_ws = client->workspace;
ewmh_update_current_desktop();
/* Load current_col/current_row if we switch to a client without a container */
current_col = c_ws->current_col;
current_row = c_ws->current_row;
/* Update container */
if (client->container != NULL) {
client->container->currently_focused = client;
current_col = client->container->col;
current_row = client->container->row;
}
CLIENT_LOG(client);
/* Set focus to the entered window, and flush xcb buffer immediately */
xcb_set_input_focus(conn, XCB_INPUT_FOCUS_POINTER_ROOT, client->child, XCB_CURRENT_TIME);
ewmh_update_active_window(client->child);
//xcb_warp_pointer(conn, XCB_NONE, client->child, 0, 0, 0, 0, 10, 10);
if (client->container != NULL) {
/* Get the client which was last focused in this particular container, it may be a different
one than old_client */
Client *last_focused = get_last_focused_client(conn, client->container, NULL);
/* In stacking containers, raise the client in respect to the one which was focused before */
if ((client->container->mode == MODE_STACK || client->container->mode == MODE_TABBED) &&
client->container->workspace->fullscreen_client == NULL) {
/* We need to get the client again, this time excluding the current client, because
* we might have just gone into stacking mode and need to raise */
Client *last_focused = get_last_focused_client(conn, client->container, client);
if (last_focused != NULL) {
DLOG("raising above frame %p / child %p\n", last_focused->frame, last_focused->child);
uint32_t values[] = { last_focused->frame, XCB_STACK_MODE_ABOVE };
xcb_configure_window(conn, client->frame, XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE, values);
}
}
/* If it is the same one as old_client, we save us the unnecessary redecorate */
if ((last_focused != NULL) && (last_focused != old_client))
redecorate_window(conn, last_focused);
}
/* If the last client was a floating client, we need to go to the next
* tiling client in stack and re-decorate it. */
if (old_client != NULL && client_is_floating(old_client)) {
DLOG("Coming from floating client, searching next tiling...\n");
Client *current;
SLIST_FOREACH(current, &(client->workspace->focus_stack), focus_clients) {
if (client_is_floating(current))
continue;
DLOG("Found window: %p / child %p\n", current->frame, current->child);
redecorate_window(conn, current);
break;
}
}
SLIST_REMOVE(&(client->workspace->focus_stack), client, Client, focus_clients);
SLIST_INSERT_HEAD(&(client->workspace->focus_stack), client, focus_clients);
/* Clear the urgency flag if set (necessary when i3 sets the flag, for
* example when automatically putting windows on the workspace of their
* leader) */
client->urgent = false;
workspace_update_urgent_flag(client->workspace);
/* If were in stacking mode, this renders the container to update changes in the title
bars and to raise the focused client */
if ((old_client != NULL) && (old_client != client) && !old_client->dock)
redecorate_window(conn, old_client);
/* redecorate_window flushes, so we dont need to */
redecorate_window(conn, client);
}
/*
* 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
* will be checked.
*
*/
Client *get_matching_client(xcb_connection_t *conn, const char *window_classtitle,
Client *specific) {
char *to_class, *to_title, *to_title_ucs = NULL;
int to_title_ucs_len = 0;
Client *matching = NULL;
to_class = sstrdup(window_classtitle);
/* If a title was specified, split both strings at the slash */
if ((to_title = strstr(to_class, "/")) != NULL) {
*(to_title++) = '\0';
/* Convert to UCS-2 */
to_title_ucs = convert_utf8_to_ucs2(to_title, &to_title_ucs_len);
}
/* If we were given a specific client we only check if that one matches */
if (specific != NULL) {
if (client_matches_class_name(specific, to_class, to_title, to_title_ucs, to_title_ucs_len))
matching = specific;
goto done;
}
DLOG("Getting clients for class \"%s\" / title \"%s\"\n", to_class, to_title);
Workspace *ws;
TAILQ_FOREACH(ws, workspaces, workspaces) {
if (ws->output == NULL)
continue;
Client *client;
SLIST_FOREACH(client, &(ws->focus_stack), focus_clients) {
DLOG("Checking client with class=%s / %s, name=%s\n", client->window_class_instance,
client->window_class_class, client->name);
if (!client_matches_class_name(client, to_class, to_title, to_title_ucs, to_title_ucs_len))
continue;
matching = client;
goto done;
}
}
done:
free(to_class);
FREE(to_title_ucs);
return matching;
}
#endif
/*
* Goes through the list of arguments (for exec()) and checks if the given argument