summaryrefslogtreecommitdiffstats
path: root/src/tk
diff options
context:
space:
mode:
Diffstat (limited to 'src/tk')
-rw-r--r--src/tk/window.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/tk/window.c b/src/tk/window.c
index 5062f24..0c8302e 100644
--- a/src/tk/window.c
+++ b/src/tk/window.c
@@ -25,13 +25,15 @@
#include "widget.h"
struct mftk_window {
+ int x;
+ int y;
struct mftk_widget *root;
struct mftk_widget *first;
struct mftk_widget *focus;
};
struct mftk_window *
-mftk_window_new(struct mftk_widget *root)
+mftk_window_new(int x, int y, struct mftk_widget *root)
{
struct mftk_window *w;
@@ -43,6 +45,8 @@ mftk_window_new(struct mftk_widget *root)
return NULL;
}
+ w->x = x;
+ w->y = y;
w->root = root;
mftk_widget_layout(w->root);
@@ -99,7 +103,7 @@ mftk_window_event(struct mftk_window *w, SDL_Event *e)
case SDL_TEXTINPUT:
return mftk_widget_key_event(w->focus, e);
case SDL_MOUSEBUTTONUP:
- return mftk_widget_mouse_event(w->root, e, 0, 0);
+ return mftk_widget_mouse_event(w->root, e, w->x, w->y);
default:
break;
}
@@ -120,7 +124,7 @@ mftk_window_focus(struct mftk_window *win, struct mftk_widget *wid)
int
mftk_window_render(struct mftk_window *w, SDL_Renderer *renderer)
{
- return mftk_widget_render(w->root, renderer, 0, 0);
+ return mftk_widget_render(w->root, renderer, w->x, w->y);
}
void