summaryrefslogtreecommitdiffstats
path: root/src/tk
diff options
context:
space:
mode:
Diffstat (limited to 'src/tk')
-rw-r--r--src/tk/blank.c2
-rw-r--r--src/tk/box.c4
-rw-r--r--src/tk/button.c2
-rw-r--r--src/tk/check.c2
-rw-r--r--src/tk/grid.c5
-rw-r--r--src/tk/label.c2
-rw-r--r--src/tk/radio.c5
-rw-r--r--src/tk/text.c2
-rw-r--r--src/tk/widget.c4
-rw-r--r--src/tk/widget.h30
-rw-r--r--src/tk/window.c2
11 files changed, 31 insertions, 29 deletions
diff --git a/src/tk/blank.c b/src/tk/blank.c
index 154870c..67e9b3d 100644
--- a/src/tk/blank.c
+++ b/src/tk/blank.c
@@ -32,7 +32,7 @@ _mftk_blank_layout(struct mftk_widget *w __attribute__((__unused__)))
}
static int
-_mftk_blank_event(struct mftk_widget *w __attribute__((__unused__)),
+_mftk_blank_mouse_event(struct mftk_widget *w __attribute__((__unused__)),
SDL_Event *e __attribute__((__unused__)),
int x __attribute__((__unused__)),
int y __attribute__((__unused__)))
diff --git a/src/tk/box.c b/src/tk/box.c
index b9faf70..2afe0d1 100644
--- a/src/tk/box.c
+++ b/src/tk/box.c
@@ -60,7 +60,7 @@ _mftk_box_index(struct mftk_widget *w, struct mftk_window *win)
}
static int
-_mftk_box_event(struct mftk_widget *w, SDL_Event *e, int x, int y)
+_mftk_box_mouse_event(struct mftk_widget *w, SDL_Event *e, int x, int y)
{
struct mftk_box *b = (struct mftk_box *) w;
SDL_Point p;
@@ -75,7 +75,7 @@ _mftk_box_event(struct mftk_widget *w, SDL_Event *e, int x, int y)
rect.w = b->child->w;
rect.h = b->child->h;
if (SDL_PointInRect(&p, &rect) == SDL_TRUE) {
- return mftk_widget_event(b->child, e,
+ return mftk_widget_mouse_event(b->child, e,
rect.x, rect.y);
}
break;
diff --git a/src/tk/button.c b/src/tk/button.c
index 0b5e874..5638fb0 100644
--- a/src/tk/button.c
+++ b/src/tk/button.c
@@ -42,7 +42,7 @@ _mftk_button_layout(struct mftk_widget *w)
}
static int
-_mftk_button_event(struct mftk_widget *w, SDL_Event *e,
+_mftk_button_mouse_event(struct mftk_widget *w, SDL_Event *e,
int x __attribute__((__unused__)),
int y __attribute__((__unused__)))
{
diff --git a/src/tk/check.c b/src/tk/check.c
index 30b7077..1df3b98 100644
--- a/src/tk/check.c
+++ b/src/tk/check.c
@@ -81,7 +81,7 @@ _mftk_check_layout(struct mftk_widget *w)
}
static int
-_mftk_check_event(struct mftk_widget *w, SDL_Event *e,
+_mftk_check_mouse_event(struct mftk_widget *w, SDL_Event *e,
int x __attribute__((__unused__)),
int y __attribute__((__unused__)))
{
diff --git a/src/tk/grid.c b/src/tk/grid.c
index 9862088..aedc228 100644
--- a/src/tk/grid.c
+++ b/src/tk/grid.c
@@ -91,7 +91,7 @@ _mftk_grid_index(struct mftk_widget *w, struct mftk_window *win)
}
static int
-_mftk_grid_event(struct mftk_widget *w, SDL_Event *e, int x, int y)
+_mftk_grid_mouse_event(struct mftk_widget *w, SDL_Event *e, int x, int y)
{
struct mftk_grid *g = (struct mftk_grid *) w;
SDL_Point p;
@@ -147,7 +147,8 @@ _mftk_grid_event(struct mftk_widget *w, SDL_Event *e, int x, int y)
rect.h = ch->h;
if (SDL_PointInRect(&p, &rect)
== SDL_TRUE) {
- return mftk_widget_event(ch, e,
+ return mftk_widget_mouse_event(
+ ch, e,
rect.x, rect.y);
}
cx += g->cols_w[c];
diff --git a/src/tk/label.c b/src/tk/label.c
index ffade82..dcd827e 100644
--- a/src/tk/label.c
+++ b/src/tk/label.c
@@ -36,7 +36,7 @@ _mftk_label_layout(struct mftk_widget *w __attribute__((__unused__)))
}
static int
-_mftk_label_event(struct mftk_widget *w __attribute__((__unused__)),
+_mftk_label_mouse_event(struct mftk_widget *w __attribute__((__unused__)),
SDL_Event *e __attribute__((__unused__)),
int x __attribute__((__unused__)),
int y __attribute__((__unused__)))
diff --git a/src/tk/radio.c b/src/tk/radio.c
index 2c75406..7e4719c 100644
--- a/src/tk/radio.c
+++ b/src/tk/radio.c
@@ -71,7 +71,7 @@ _mftk_radio_layout(struct mftk_widget *w)
}
static int
-_mftk_radio_event(struct mftk_widget *w, SDL_Event *e, int x, int y)
+_mftk_radio_mouse_event(struct mftk_widget *w, SDL_Event *e, int x, int y)
{
struct mftk_radio *r = (struct mftk_radio *) w;
@@ -79,7 +79,8 @@ _mftk_radio_event(struct mftk_widget *w, SDL_Event *e, int x, int y)
case SDL_MOUSEBUTTONUP:
if (e->button.button == SDL_BUTTON_LEFT) {
mftk_window_focus(w->window, w);
- return mftk_widget_event(r->grid, e, x, y);
+ return mftk_widget_mouse_event(r->grid, e,
+ x, y);
}
break;
default:
diff --git a/src/tk/text.c b/src/tk/text.c
index 88b8e37..49ab13c 100644
--- a/src/tk/text.c
+++ b/src/tk/text.c
@@ -49,7 +49,7 @@ _mftk_text_layout(struct mftk_widget *w __attribute__((__unused__)))
}
static int
-_mftk_text_event(struct mftk_widget *w, SDL_Event *e,
+_mftk_text_mouse_event(struct mftk_widget *w, SDL_Event *e,
int x __attribute__((__unused__)),
int y __attribute__((__unused__)))
{
diff --git a/src/tk/widget.c b/src/tk/widget.c
index 5c4ae17..f124867 100644
--- a/src/tk/widget.c
+++ b/src/tk/widget.c
@@ -72,9 +72,9 @@ mftk_widget_index(struct mftk_widget *w, struct mftk_window *win)
}
int
-mftk_widget_event(struct mftk_widget *w, SDL_Event *e, int x, int y)
+mftk_widget_mouse_event(struct mftk_widget *w, SDL_Event *e, int x, int y)
{
- return w->event(w, e, x, y);
+ return w->mouse_event(w, e, x, y);
}
int
diff --git a/src/tk/widget.h b/src/tk/widget.h
index e9a88cb..9064252 100644
--- a/src/tk/widget.h
+++ b/src/tk/widget.h
@@ -43,7 +43,7 @@ struct mftk_widget {
void (*layout)(struct mftk_widget *);
void (*index)(struct mftk_widget *,
struct mftk_window *);
- int (*event)(struct mftk_widget *, SDL_Event *,
+ int (*mouse_event)(struct mftk_widget *, SDL_Event *,
int, int);
int (*render)(struct mftk_widget *, SDL_Renderer *,
int, int);
@@ -64,10 +64,10 @@ mftk_widget_new(size_t size);
if (w == NULL) { \
return NULL; \
}; \
- w->layout = &_mftk_##name##_layout; \
- w->event = &_mftk_##name##_event; \
- w->render = &_mftk_##name##_render; \
- w->destroy = &_mftk_##name##_destroy; \
+ w->layout = &_mftk_##name##_layout; \
+ w->mouse_event = &_mftk_##name##_mouse_event; \
+ w->render = &_mftk_##name##_render; \
+ w->destroy = &_mftk_##name##_destroy; \
w->role = MFTK_WIDGET_ROLE_NONE; \
t_w = (struct mftk_##name *) w; \
} while (0)
@@ -77,10 +77,10 @@ mftk_widget_new(size_t size);
if (w == NULL) { \
return NULL; \
}; \
- w->layout = &_mftk_##name##_layout; \
- w->event = &_mftk_##name##_event; \
- w->render = &_mftk_##name##_render; \
- w->destroy = &_mftk_##name##_destroy; \
+ w->layout = &_mftk_##name##_layout; \
+ w->mouse_event = &_mftk_##name##_mouse_event; \
+ w->render = &_mftk_##name##_render; \
+ w->destroy = &_mftk_##name##_destroy; \
w->role = MFTK_WIDGET_ROLE_FOCUSABLE; \
t_w = (struct mftk_##name *) w; \
} while (0)
@@ -90,11 +90,11 @@ mftk_widget_new(size_t size);
if (w == NULL) { \
return NULL; \
}; \
- w->layout = &_mftk_##name##_layout; \
- w->index = &_mftk_##name##_index; \
- w->event = &_mftk_##name##_event; \
- w->render = &_mftk_##name##_render; \
- w->destroy = &_mftk_##name##_destroy; \
+ w->layout = &_mftk_##name##_layout; \
+ w->index = &_mftk_##name##_index; \
+ w->mouse_event = &_mftk_##name##_mouse_event; \
+ w->render = &_mftk_##name##_render; \
+ w->destroy = &_mftk_##name##_destroy; \
w->role = MFTK_WIDGET_ROLE_CONTAINER; \
t_w = (struct mftk_##name *) w; \
} while (0)
@@ -113,7 +113,7 @@ void
mftk_widget_index(struct mftk_widget *w, struct mftk_window *win);
int
-mftk_widget_event(struct mftk_widget *w, SDL_Event *e, int x, int y);
+mftk_widget_mouse_event(struct mftk_widget *w, SDL_Event *e, int x, int y);
int
mftk_widget_render(struct mftk_widget *w, SDL_Renderer *renderer, int x, int y);
diff --git a/src/tk/window.c b/src/tk/window.c
index 53fbb41..d4d7cb3 100644
--- a/src/tk/window.c
+++ b/src/tk/window.c
@@ -92,7 +92,7 @@ mftk_window_event(struct mftk_window *w, SDL_Event *e)
}
break;
case SDL_MOUSEBUTTONUP:
- return mftk_widget_event(w->root, e, 0, 0);
+ return mftk_widget_mouse_event(w->root, e, 0, 0);
default:
break;
}