forked from external/yambar
particle: implement a default on_mouse handler
Which changes the cursor to a hand when there's a non-NULL on-click handler.
This commit is contained in:
parent
9e5dbfe27d
commit
cecab625ac
1 changed files with 21 additions and 0 deletions
21
particle.c
21
particle.c
|
@ -2,6 +2,12 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#define LOG_MODULE "particle"
|
||||
#define LOG_ENABLE_DBG 1
|
||||
#include "log.h"
|
||||
#include "bar.h"
|
||||
|
||||
void
|
||||
particle_default_destroy(struct particle *particle)
|
||||
|
@ -45,3 +51,18 @@ exposable_default_destroy(struct exposable *exposable)
|
|||
free(exposable->on_click);
|
||||
free(exposable);
|
||||
}
|
||||
|
||||
void
|
||||
exposable_default_on_mouse(struct exposable *exposable, struct bar *bar,
|
||||
enum mouse_event event, int x, int y)
|
||||
{
|
||||
LOG_DBG("on_mouse: exposable=%p, event=%s, x=%d, y=%d", exposable,
|
||||
event == ON_MOUSE_MOTION ? "motion" : "click", x, y);
|
||||
|
||||
assert(exposable->particle != NULL);
|
||||
|
||||
if (exposable->on_click == NULL)
|
||||
bar->set_cursor(bar, "left_ptr");
|
||||
else
|
||||
bar->set_cursor(bar, "hand2");
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue