summaryrefslogtreecommitdiffstats
path: root/src/tk/window.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tk/window.c')
-rw-r--r--src/tk/window.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/tk/window.c b/src/tk/window.c
index 532a2e4..b87e7c0 100644
--- a/src/tk/window.c
+++ b/src/tk/window.c
@@ -26,6 +26,8 @@
struct mftk_window {
struct mftk_widget *root;
+ struct mftk_widget *first;
+ struct mftk_widget *focus;
};
struct mftk_window *
@@ -44,10 +46,31 @@ mftk_window_new(struct mftk_widget *root)
w->root = root;
mftk_widget_layout(w->root);
+ mftk_widget_index(w->root, w);
+ w->focus = w->first;
return w;
}
+void
+mftk_window_index(struct mftk_window *win, struct mftk_widget *wid)
+{
+ if (win->first == NULL) {
+ win->first = wid;
+ wid->prev = wid;
+ wid->next = wid;
+ return;
+ }
+ /*
+ * Head: win->first
+ * Tail: win->first->prev
+ */
+ wid->prev = win->first->prev;
+ wid->next = win->first;
+ win->first->prev->next = wid;
+ win->first->prev = wid;
+}
+
int
mftk_window_event(struct mftk_window *w, SDL_Event *e)
{