Implement moving clients to the left if they are leftmost
This commit is contained in:
parent
9c0d5b6e5e
commit
49b56166dc
|
@ -28,10 +28,10 @@ extern int current_row;
|
||||||
void init_table();
|
void init_table();
|
||||||
void expand_table_rows(Workspace *workspace);
|
void expand_table_rows(Workspace *workspace);
|
||||||
void expand_table_cols(Workspace *workspace);
|
void expand_table_cols(Workspace *workspace);
|
||||||
|
void expand_table_cols_at_head(Workspace *workspace);
|
||||||
bool cell_exists(int col, int row);
|
bool cell_exists(int col, int row);
|
||||||
void cleanup_table(xcb_connection_t *conn, Workspace *workspace);
|
void cleanup_table(xcb_connection_t *conn, Workspace *workspace);
|
||||||
void fix_colrowspan(xcb_connection_t *conn, Workspace *workspace);
|
void fix_colrowspan(xcb_connection_t *conn, Workspace *workspace);
|
||||||
void dump_table(xcb_connection_t *conn, Workspace *workspace);
|
void dump_table(xcb_connection_t *conn, Workspace *workspace);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -181,11 +181,13 @@ static void move_current_window(xcb_connection_t *conn, direction_t direction) {
|
||||||
|
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case D_LEFT:
|
case D_LEFT:
|
||||||
/* TODO: If we’re at the left-most position, move the rest of the table right */
|
/* If we’re at the left-most position, move the rest of the table right */
|
||||||
if (current_col == 0)
|
if (current_col == 0) {
|
||||||
return;
|
expand_table_cols_at_head(c_ws);
|
||||||
|
new = CUR_TABLE[current_col][current_row];
|
||||||
|
} else
|
||||||
|
new = CUR_TABLE[--current_col][current_row];
|
||||||
|
|
||||||
new = CUR_TABLE[--current_col][current_row];
|
|
||||||
break;
|
break;
|
||||||
case D_RIGHT:
|
case D_RIGHT:
|
||||||
if (current_col == (c_ws->cols-1))
|
if (current_col == (c_ws->cols-1))
|
||||||
|
|
22
src/table.c
22
src/table.c
|
@ -85,6 +85,28 @@ void expand_table_cols(Workspace *workspace) {
|
||||||
new_container(workspace, &(workspace->table[workspace->cols-1][c]), workspace->cols-1, c);
|
new_container(workspace, &(workspace->table[workspace->cols-1][c]), workspace->cols-1, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Inserts one column at the table’s head
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void expand_table_cols_at_head(Workspace *workspace) {
|
||||||
|
workspace->cols++;
|
||||||
|
|
||||||
|
workspace->table = realloc(workspace->table, sizeof(Container**) * workspace->cols);
|
||||||
|
workspace->table[workspace->cols-1] = calloc(sizeof(Container*) * workspace->rows, 1);
|
||||||
|
|
||||||
|
/* Move the other columns */
|
||||||
|
for (int rows = 0; rows < workspace->rows; rows++)
|
||||||
|
for (int cols = workspace->cols - 1; cols > 0; cols--) {
|
||||||
|
LOG("Moving col %d to %d\n", cols-1, cols);
|
||||||
|
workspace->table[cols][rows] = workspace->table[cols-1][rows];
|
||||||
|
workspace->table[cols][rows]->col = cols;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int rows = 0; rows < workspace->rows; rows++)
|
||||||
|
new_container(workspace, &(workspace->table[0][rows]), 0, rows);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Shrinks the table by one column.
|
* Shrinks the table by one column.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue