diff options
| author | Dusan Durech <dusan.d@Centrum.sk> | 2009-07-15 20:36:23 +0200 |
|---|---|---|
| committer | Dusan Durech <dusan.d@Centrum.sk> | 2009-07-15 20:36:23 +0200 |
| commit | d0c088655af27e2e66b164c061e48a5f5bd28f05 (patch) | |
| tree | 59bb7dd44ff5bed456e84c4195fd4c1bd1aff130 /src/widget/widget_button.c | |
| parent | dd094a1c6598648c013ae1483c303eea34fc3bbe (diff) | |
add new API for mouse and fix bug with crash upon load session
Diffstat (limited to 'src/widget/widget_button.c')
| -rw-r--r-- | src/widget/widget_button.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/widget/widget_button.c b/src/widget/widget_button.c index 26c153a..7e2d091 100644 --- a/src/widget/widget_button.c +++ b/src/widget/widget_button.c @@ -6,6 +6,7 @@ #include "interface.h" #include "image.h" #include "font.h" +#include "mouse_buffer.h" #include "widget.h" #include "widget_button.h" @@ -44,8 +45,7 @@ void button_draw(widget_t *widget) g_button1 = image_add("button1.png", IMAGE_ALPHA, "button1", IMAGE_GROUP_BASE); } - if (x >= widget->x && x <= widget->x + WIDGET_BUTTON_WIDTH && - y >= widget->y && y <= widget->y + WIDGET_BUTTON_HEIGHT) { + if (mouse_buffer_is_on_area(widget->x, widget->y, WIDGET_BUTTON_WIDTH, WIDGET_BUTTON_HEIGHT, MOUSE_BUF_MOTION)) { image_draw(g_button1, widget->x, widget->y, 0, 0, g_button0->w, g_button0->h); } else { image_draw(g_button0, widget->x, widget->y, 0, 0, g_button0->w, g_button0->h); @@ -61,7 +61,6 @@ void button_event(widget_t *widget) { widget_button_t *p; static int my_time = 0; - int x, y; assert(widget != NULL); assert(widget->type == WIDGET_TYPE_BUTTON); @@ -73,11 +72,7 @@ void button_event(widget_t *widget) return; } - interface_get_mouse_position(&x, &y); - - if (x >= widget->x && x <= widget->x + WIDGET_BUTTON_WIDTH && - y >= widget->y && y <= widget->y + WIDGET_BUTTON_HEIGHT && - interface_is_mouse_clicket()) { + if (mouse_buffer_is_on_area(widget->x, widget->y, WIDGET_BUTTON_WIDTH, WIDGET_BUTTON_HEIGHT, MOUSE_BUF_CLICK)) { my_time = WIDGET_BUTTON_TIME; DEBUG_MSG(_("[Debug] Caught some button event\n")); |