|
|
|
@ -225,11 +225,9 @@ redraw_handler(struct widget *widget, void *data) |
|
|
|
|
wl_surface_commit(window_get_wl_surface(smoke->window)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static int |
|
|
|
|
smoke_motion_handler(struct widget *widget, struct input *input, |
|
|
|
|
uint32_t time, float x, float y, void *data) |
|
|
|
|
static void |
|
|
|
|
smoke_motion_handler(struct smoke *smoke, float x, float y) |
|
|
|
|
{ |
|
|
|
|
struct smoke *smoke = data; |
|
|
|
|
int i, i0, i1, j, j0, j1, k, d = 5; |
|
|
|
|
|
|
|
|
|
if (x - d < 1) |
|
|
|
@ -257,10 +255,24 @@ smoke_motion_handler(struct widget *widget, struct input *input, |
|
|
|
|
smoke->b[0].v[k] += 256 - (random() & 512); |
|
|
|
|
smoke->b[0].d[k] += 1; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static int |
|
|
|
|
mouse_motion_handler(struct widget *widget, struct input *input, |
|
|
|
|
uint32_t time, float x, float y, void *data) |
|
|
|
|
{ |
|
|
|
|
smoke_motion_handler(data, x, y); |
|
|
|
|
|
|
|
|
|
return CURSOR_HAND1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
touch_motion_handler(struct widget *widget, uint32_t time, |
|
|
|
|
int32_t id, float x, float y, void *data) |
|
|
|
|
{ |
|
|
|
|
smoke_motion_handler(data, x, y); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
resize_handler(struct widget *widget, |
|
|
|
|
int32_t width, int32_t height, void *data) |
|
|
|
@ -304,7 +316,8 @@ int main(int argc, char *argv[]) |
|
|
|
|
smoke.b[1].u = calloc(size, sizeof(float)); |
|
|
|
|
smoke.b[1].v = calloc(size, sizeof(float)); |
|
|
|
|
|
|
|
|
|
widget_set_motion_handler(smoke.widget, smoke_motion_handler); |
|
|
|
|
widget_set_motion_handler(smoke.widget, mouse_motion_handler); |
|
|
|
|
widget_set_touch_motion_handler(smoke.widget, touch_motion_handler); |
|
|
|
|
widget_set_resize_handler(smoke.widget, resize_handler); |
|
|
|
|
widget_set_redraw_handler(smoke.widget, redraw_handler); |
|
|
|
|
|
|
|
|
|