UNAME=$(shell uname)
DEBUG=1
+CFLAGS += -std=c99
CFLAGS += -Wall
CFLAGS += -Iinclude
CFLAGS += -I/usr/local/include
printf("snapping container to direction %d\n", direction);
Container *container = CUR_CELL;
- int i;
assert(container != NULL);
/* Check if there are other cells with rowspan, which are in our way.
* If so, reduce their rowspan. */
- for (i = container->row-1; i >= 0; i--) {
+ for (int i = container->row-1; i >= 0; i--) {
printf("we got cell %d, %d with rowspan %d\n",
container->col+1, i, CUR_TABLE[container->col+1][i]->rowspan);
while ((CUR_TABLE[container->col+1][i]->rowspan-1) >= (container->row - i))
return;
}
- for (i = container->col-1; i >= 0; i--) {
+ for (int i = container->col-1; i >= 0; i--) {
printf("we got cell %d, %d with colspan %d\n",
i, container->row+1, CUR_TABLE[i][container->row+1]->colspan);
while ((CUR_TABLE[i][container->row+1]->colspan-1) >= (container->col - i))
}
static void show_workspace(xcb_connection_t *conn, int workspace) {
- int cols, rows;
Client *client;
xcb_window_t root = xcb_setup_roots_iterator(xcb_get_setup(conn)).data->root;
/* t_ws (to workspace) is just a convenience pointer to the workspace we’re switching to */
//xcb_grab_server(conn);
/* Unmap all clients of the current workspace */
- for (cols = 0; cols < c_ws->cols; cols++)
- for (rows = 0; rows < c_ws->rows; rows++) {
+ for (int cols = 0; cols < c_ws->cols; cols++)
+ for (int rows = 0; rows < c_ws->rows; rows++)
CIRCLEQ_FOREACH(client, &(c_ws->table[cols][rows]->clients), clients)
xcb_unmap_window(conn, client->frame);
- }
c_ws = &workspaces[workspace-1];
current_row = c_ws->current_row;
printf("new current row = %d, current col = %d\n", current_row, current_col);
/* Map all clients on the new workspace */
- for (cols = 0; cols < c_ws->cols; cols++)
- for (rows = 0; rows < c_ws->rows; rows++) {
+ for (int cols = 0; cols < c_ws->cols; cols++)
+ for (int rows = 0; rows < c_ws->rows; rows++)
CIRCLEQ_FOREACH(client, &(c_ws->table[cols][rows]->clients), clients)
xcb_map_window(conn, client->frame);
- }
/* Restore focus on the new workspace */
if (CUR_CELL->currently_focused != NULL)
}
void render_layout(xcb_connection_t *connection) {
- int cols, rows;
i3Screen *screen;
+
TAILQ_FOREACH(screen, &virtual_screens, screens) {
/* r_ws (rendering workspace) is just a shortcut to the Workspace being currently rendered */
Workspace *r_ws = &(workspaces[screen->current_workspace]);
width / r_ws->cols, height / r_ws->rows);
/* Go through the whole table and render what’s necessary */
- for (cols = 0; cols < r_ws->cols; cols++)
- for (rows = 0; rows < r_ws->rows; rows++) {
+ for (int cols = 0; cols < r_ws->cols; cols++)
+ for (int rows = 0; rows < r_ws->rows; rows++) {
Container *container = r_ws->table[cols][rows];
printf("container has %d colspan, %d rowspan\n",
container->colspan, container->rowspan);
*
*/
void init_table() {
- int i;
memset(workspaces, 0, sizeof(workspaces));
- for (i = 0; i < 10; i++) {
+ for (int i = 0; i < 10; i++) {
workspaces[i].screen = NULL;
expand_table_cols(&(workspaces[i]));
expand_table_rows(&(workspaces[i]));
*
*/
void expand_table_rows(Workspace *workspace) {
- int c;
-
workspace->rows++;
- for (c = 0; c < workspace->cols; c++) {
+ for (int c = 0; c < workspace->cols; c++) {
workspace->table[c] = realloc(workspace->table[c], sizeof(Container*) * workspace->rows);
new_container(workspace, &(workspace->table[c][workspace->rows-1]));
}
*
*/
void expand_table_cols(Workspace *workspace) {
- int c;
-
workspace->cols++;
workspace->table = realloc(workspace->table, sizeof(Container**) * workspace->cols);
workspace->table[workspace->cols-1] = calloc(sizeof(Container*) * workspace->rows, 1);
- for (c = 0; c < workspace->rows; c++)
+ for (int c = 0; c < workspace->rows; c++)
new_container(workspace, &(workspace->table[workspace->cols-1][c]));
}
void initialize_xinerama(xcb_connection_t *conn) {
xcb_xinerama_query_screens_reply_t *reply;
xcb_xinerama_screen_info_t *screen_info;
- int screen;
if (!xcb_get_extension_data(conn, &xcb_xinerama_id)->present) {
printf("Xinerama extension not found, disabling.\n");
num_screens = xcb_xinerama_query_screens_screen_info_length(reply);
/* Just go through each workspace and associate as many screens as we can. */
- for (screen = 0; screen < num_screens; screen++) {
+ for (int screen = 0; screen < num_screens; screen++) {
i3Screen *s = get_screen_at(screen_info[screen].x_org, screen_info[screen].y_org);
if (s!= NULL) {
/* This screen already exists. We use the littlest screen so that the user