From 54d361cf4291e9b498e78051b08668e80790357c Mon Sep 17 00:00:00 2001 From: o9000 Date: Sat, 25 Mar 2017 15:23:06 +0100 Subject: [PATCH] Button: mouse effects --- src/button/button.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/button/button.c b/src/button/button.c index 60f0e2b..ad2e8e2 100644 --- a/src/button/button.c +++ b/src/button/button.c @@ -438,8 +438,20 @@ void draw_button(void *obj, cairo_t *c) Button *button = obj; if (button->frontend->icon) { - imlib_context_set_image(button->frontend->icon); // Render icon + Imlib_Image image; + if (panel_config.mouse_effects) { + if (button->area.mouse_state == MOUSE_OVER) + image = button->frontend->icon_hover ? button->frontend->icon_hover : button->frontend->icon; + else if (button->area.mouse_state == MOUSE_DOWN) + image = button->frontend->icon_pressed ? button->frontend->icon_pressed : button->frontend->icon; + else + image = button->frontend->icon; + } else { + image = button->frontend->icon; + } + + imlib_context_set_image(image); render_image(button->area.pix, button->frontend->iconx, button->frontend->icony); }