thingmenu

A simple graphical menu launcher for X11.
git clone git://r-36.net/thingmenu
Log | Files | Refs | LICENSE

commit 6fe4ccf5c1b27d5babe573dfa794ac86610ae28d
parent 179f5949844bee93fdcc1d6b62327ded89a7e553
Author: Christoph Lohmann <20h@r-36.net>
Date:   Mon, 12 Sep 2011 15:55:07 +0200

Adding expected behaviour to highlight and press.

Diffstat:
thingmenu.c | 15++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/thingmenu.c b/thingmenu.c @@ -102,6 +102,7 @@ static char *name = "thingmenu"; Entry **entries = NULL; int nentries = 0; int oneshot = 1; +Bool ispressing = 0; /* configuration, allows nested code to access above variables */ #include "config.h" @@ -118,11 +119,19 @@ motionnotify(XEvent *e) && ev->y > entries[i]->y && ev->y < entries[i]->y + entries[i]->h) { if (entries[i]->highlighted != True) { - entries[i]->highlighted = True; + if (ispressing) { + entries[i]->pressed = True; + } else { + entries[i]->highlighted = True; + } drawentry(entries[i]); } continue; } + if (entries[i]->pressed == True) { + entries[i]->pressed = False; + drawentry(entries[i]); + } if (entries[i]->highlighted == True) { entries[i]->highlighted = False; drawentry(entries[i]); @@ -136,6 +145,8 @@ buttonpress(XEvent *e) XButtonPressedEvent *ev = &e->xbutton; Entry *en; + ispressing = True; + if((en = findentry(ev->x, ev->y))) press(en); } @@ -146,6 +157,8 @@ buttonrelease(XEvent *e) XButtonPressedEvent *ev = &e->xbutton; Entry *en; + ispressing = False; + if((en = findentry(ev->x, ev->y))) unpress(en); }