+glk_window_iterate(winid_t win, glui32 *rockptr)
+{
+ GNode *retnode;
+
+ if(win == NULL)
+ retnode = root_window;
+ else
+ {
+ GNode *node = win->window_node;
+ if( G_NODE_IS_LEAF(node) )
+ {
+ while(node && node->next == NULL)
+ node = node->parent;
+ if(node)
+ retnode = node->next;
+ else
+ retnode = NULL;
+ }
+ else
+ retnode = g_node_first_child(node);
+ }
+ winid_t retval = retnode? (winid_t)retnode->data : NULL;
+
+ /* Store the window's rock in rockptr */
+ if(retval && rockptr)
+ *rockptr = glk_window_get_rock(retval);
+
+ return retval;
+}
+
+/**
+ * glk_window_get_rock:
+ * @win: A window.
+ *
+ * Returns the window @win's rock value. Pair windows always have rock 0.
+ *
+ * Returns: A rock value.
+ */
+glui32
+glk_window_get_rock(winid_t win)
+{
+ g_return_val_if_fail(win != NULL, 0);
+ return win->rock;
+}
+
+/**
+ * glk_window_get_type:
+ * @win: A window.
+ *
+ * Returns the window @win's type, one of #wintype_Blank, #wintype_Pair,
+ * #wintype_TextBuffer, #wintype_TextGrid, or #wintype_Graphics.
+ *
+ * Returns: The window's type.
+ */
+glui32
+glk_window_get_type(winid_t win)
+{
+ g_return_val_if_fail(win != NULL, 0);
+ return win->wintype;
+}
+
+/**
+ * glk_window_get_parent:
+ * @win: A window.
+ *
+ * Returns the window @win's parent window. If @win is the root window, this
+ * returns #NULL, since the root window has no parent. Remember that the parent
+ * of every window is a pair window; other window types are always childless.
+ *
+ * Returns: A window.
+ */
+winid_t
+glk_window_get_parent(winid_t win)
+{
+ g_return_val_if_fail(win != NULL, NULL);
+ /* Value will also be NULL if win is the root window */
+ return (winid_t)win->window_node->parent->data;
+}
+
+/**
+ * glk_window_get_sibling:
+ * @win: A window.
+ *
+ * Returns the other child of the window @win's parent. If @win is the
+ * root window, this returns #NULL.
+ *
+ * Returns: A window, or NULL.
+ */
+winid_t
+glk_window_get_sibling(winid_t win)
+{
+ g_return_val_if_fail(win != NULL, NULL);
+
+ if(G_NODE_IS_ROOT(win->window_node))
+ return NULL;
+ if(win->window_node->next)
+ return (winid_t)win->window_node->next;
+ return (winid_t)win->window_node->prev;
+}
+
+/**
+ * glk_window_get_root:
+ *
+ * Returns the root window. If there are no windows, this returns #NULL.
+ *
+ * Returns: A window, or #NULL.
+ */
+winid_t
+glk_window_get_root()
+{
+ if(root_window == NULL)
+ return NULL;
+ return (winid_t)root_window->data;
+}
+
+/**
+ * glk_window_open:
+ * @split: The window to split to create the new window. Must be 0 if there
+ * are no windows yet.
+ * @method: Position of the new window and method of size computation. One of
+ * #winmethod_Above, #winmethod_Below, #winmethod_Left, or #winmethod_Right
+ * OR'ed with #winmethod_Fixed or #winmethod_Proportional. If @wintype is
+ * #wintype_Blank, then #winmethod_Fixed is not allowed.
+ * @size: Size of the new window, in percentage points if @method is
+ * #winmethod_Proportional, otherwise in characters if @wintype is
+ * #wintype_TextBuffer or #wintype_TextGrid, or pixels if @wintype is
+ * #wintype_Graphics.
+ * @wintype: Type of the new window. One of #wintype_Blank, #wintype_TextGrid,
+ * #wintype_TextBuffer, or #wintype_Graphics.
+ * @rock: The new window's rock value.
+ *
+ * If there are no windows, create a new root window. @split must be 0, and
+ * @method and @size are ignored. Otherwise, split window @split into two, with
+ * position, size, and type specified by @method, @size, and @wintype. See the
+ * Glk documentation for the window placement algorithm.
+ *
+ * Returns: the new window.
+ */
+winid_t
+glk_window_open(winid_t split, glui32 method, glui32 size, glui32 wintype,
+ glui32 rock)