* creating the workspace if necessary (by allocating the necessary amount of
* memory and initializing the data structures correctly).
*
+ * If created is not NULL, *created will be set to whether or not the
+ * workspace has just been created.
+ *
*/
-Con *workspace_get(const char *num);
+Con *workspace_get(const char *num, bool *created);
#if 0
/**
printf("should move window to workspace %s\n", $<string>5);
/* get the workspace */
- Con *ws = workspace_get($<string>5);
+ Con *ws = workspace_get($<string>5, NULL);
free($<string>5);
/* check if the match is empty, not if the result is empty */
}
DLOG("Changing container/workspace and unmapping the client\n");
- Workspace *t_ws = workspace_get(assign->workspace-1);
+ Workspace *t_ws = workspace_get(assign->workspace-1, NULL);
workspace_initialize(t_ws, c_ws->output, false);
new->container = t_ws->table[t_ws->current_col][t_ws->current_row];
* memory and initializing the data structures correctly).
*
*/
-Con *workspace_get(const char *num) {
+Con *workspace_get(const char *num, bool *created) {
Con *output, *workspace = NULL, *child;
/* TODO: could that look like this in the future?
con_attach(workspace, content, false);
ipc_send_event("workspace", I3_IPC_EVENT_WORKSPACE, "{\"change\":\"init\"}");
+ if (created != NULL)
+ *created = true;
+ }
+ else if (created != NULL) {
+ *created = false;
}
//ewmh_update_workarea();
void workspace_show(const char *num) {
Con *workspace, *current, *old = NULL;
- workspace = workspace_get(num);
+ workspace = workspace_get(num, NULL);
/* disable fullscreen for the other workspaces and get the workspace we are
* currently on. */
int last_ws = 0;
TAILQ_FOREACH(ws, workspaces, workspaces)
last_ws = ws->num;
- result = workspace_get(last_ws + 1);
+ result = workspace_get(last_ws + 1, NULL);
}
workspace_initialize(result, output, false);