Make number of workspaces dynamic (no longer limited by 10)

Warning: This is not yet thoroughly tested, so be prepared to
encounter some segfaults. Please enable logging and coredumps,
so we can fix bugs quickly.
This commit is contained in:
Michael Stapelberg
2009-09-27 14:00:54 +02:00
parent a55d0b77fe
commit f38809288a
13 changed files with 149 additions and 65 deletions

View File

@ -27,9 +27,10 @@
#include "layout.h"
int current_workspace = 0;
Workspace workspaces[10];
int num_workspaces = 1;
Workspace *workspaces;
/* Convenience pointer to the current workspace */
Workspace *c_ws = &workspaces[0];
Workspace *c_ws;
int current_col = 0;
int current_row = 0;
@ -38,15 +39,14 @@ int current_row = 0;
*
*/
void init_table() {
memset(workspaces, 0, sizeof(workspaces));
workspaces = scalloc(sizeof(Workspace));
c_ws = workspaces;
for (int i = 0; i < 10; i++) {
workspaces[i].screen = NULL;
workspaces[i].num = i;
TAILQ_INIT(&(workspaces[i].floating_clients));
expand_table_cols(&(workspaces[i]));
expand_table_rows(&(workspaces[i]));
}
workspaces[0].screen = NULL;
workspaces[0].num = 0;
TAILQ_INIT(&(workspaces[0].floating_clients));
expand_table_cols(&(workspaces[0]));
expand_table_rows(&(workspaces[0]));
}
static void new_container(Workspace *workspace, Container **container, int col, int row) {