summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher James Halse Rogers <chris@Burninator.(none)>2007-06-22 23:18:14 +1000
committerChristopher James Halse Rogers <chris@Burninator.(none)>2007-06-22 23:18:14 +1000
commit575ae46a57cfc753480c686419003cfe63867444 (patch)
treee9103ca99279c4cc7d6c276df51a9bb4159bd6f7
parent45cb5578fd2a5b2df6cdec8c84050329b64ed624 (diff)
downloadradial-switcher-575ae46a57cfc753480c686419003cfe63867444.tar.gz
radial-switcher-575ae46a57cfc753480c686419003cfe63867444.tar.bz2
Now I remember that you need to defererence pointers to structures with ->! :)
-rw-r--r--radial-switcher.c75
1 files changed, 38 insertions, 37 deletions
diff --git a/radial-switcher.c b/radial-switcher.c
index 622c5aa..70ef348 100644
--- a/radial-switcher.c
+++ b/radial-switcher.c
@@ -76,9 +76,9 @@ newWindowList (void)
{
WindowList *ret;
ret = malloc (sizeof(WindowList));
- ret.nWindows = 0;
- ret.windowsSize = 32;
- ret.windows = malloc (sizeof(CompWindow *) * 32);
+ ret->nWindows = 0;
+ ret->windowsSize = 32;
+ ret->w = malloc (sizeof(CompWindow *) * 32);
return ret;
}
@@ -115,43 +115,13 @@ newWindowTreeNode (void)
{
WindowTreeNode *ret;
ret = malloc (sizeof(WindowTreeNode));
- ret.windows = newWindowList();
- ret.childrenSize = 4;
- ret.children = malloc (sizeof (WindowTreeNode *) * 4);
+ ret->windows = newWindowList();
+ ret->childrenSize = 4;
+ ret->children = malloc (sizeof (WindowTreeNode *) * 4);
return ret;
}
/**
- * Create a WindowTree from a list of windows.
- *
- * @param windows: The @WindowList to built the tree from.
- * @param isSameGroup: Comparison function, true when the two window should be
- * placed in the same group
- *
- * @return: The root node of the tree. The caller is responsible for freeing
- * the tree once it is no longer needed.
-**/
-static WindowTreeNode *
-createWindowTree (WindowList *windows,
- WindowCmpProc isSameGroup)
-{
- CompWindow *w;
- WindowTreeNode *root;
-
- root = newWindowTreeNode();
- /* XXX: Most naieve possible algorithm! */
- for (int i = 0; i < windows->nWindows; ++i)
- {
- if (!addWindowToTree (root, windows->w[i], isSameGroup))
- {
- destroyWindowTree(root);
- return FALSE;
- }
- }
- return TRUE;
-}
-
-/**
* Add a window to the window tree
* @param node: The @WindowTreeNode to add the window to
* @param w: The window to add to the tree
@@ -185,6 +155,37 @@ addWindowToTree (WindowTreeNode *node,
return addWindowToList (node->windows, w);
}
+/**
+ * Create a WindowTree from a list of windows.
+ *
+ * @param windows: The @WindowList to built the tree from.
+ * @param isSameGroup: Comparison function, true when the two window should be
+ * placed in the same group
+ *
+ * @return: The root node of the tree. The caller is responsible for freeing
+ * the tree once it is no longer needed.
+**/
+static WindowTreeNode *
+createWindowTree (WindowList *windows,
+ WindowCmpProc isSameGroup)
+{
+ CompWindow *w;
+ WindowTreeNode *root;
+
+ root = newWindowTreeNode();
+ /* XXX: Most naieve possible algorithm! */
+ for (int i = 0; i < windows->nWindows; ++i)
+ {
+ if (!addWindowToTree (root, windows->w[i], isSameGroup))
+ {
+ destroyWindowTree(root);
+ return NULL;
+ }
+ }
+ return root;
+}
+
+/*
static void
radialSetupCairoContext(CompScreen *s, RadialCairoContext *context)
{
@@ -219,7 +220,7 @@ radialSetupCairoContext(CompScreen *s, RadialCairoContext *context)
cairo_restore(cr);
cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
}
-
+*/
/*
static Bool
isSwitchWin (CompWindow *w)