aboutsummaryrefslogtreecommitdiffstats
path: root/src/gwin
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2014-05-01 13:53:46 +1000
committerinmarket <andrewh@inmarket.com.au>2014-05-01 13:53:46 +1000
commitcf548f0e9c8a13741489a6b3368da1f8040301e2 (patch)
tree1dc255dcb830c66f857a1f015c238ec91419cc2e /src/gwin
parent5ada56e807a947d6ce9ad3939a540d303034b4ad (diff)
downloaduGFX-cf548f0e9c8a13741489a6b3368da1f8040301e2.tar.gz
uGFX-cf548f0e9c8a13741489a6b3368da1f8040301e2.tar.bz2
uGFX-cf548f0e9c8a13741489a6b3368da1f8040301e2.zip
Fix some gwin list widget mouse bugs
Diffstat (limited to 'src/gwin')
-rw-r--r--src/gwin/list.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/gwin/list.c b/src/gwin/list.c
index 50c669f0..cb17b671 100644
--- a/src/gwin/list.c
+++ b/src/gwin/list.c
@@ -93,10 +93,9 @@ static void gwinListDefaultDraw(GWidgetObject* gw, void* param) {
coord_t sy;
#endif
- // dont render if render has been disabled
- if (!(gw->g.flags & GLIST_FLG_ENABLERENDER)) {
+ // don't render if render has been disabled
+ if (!(gw->g.flags & GLIST_FLG_ENABLERENDER))
return;
- }
ps = (gw->g.flags & GWIN_FLG_ENABLED) ? &gw->pstyle->enabled : &gw->pstyle->disabled;
iheight = gdispGetFontMetric(gw->g.font, fontHeight) + VERTICAL_PADDING;
@@ -209,24 +208,23 @@ static void gwinListDefaultDraw(GWidgetObject* gw, void* param) {
// a mouse down has occurred over the list area
static void MouseDown(GWidgetObject* gw, coord_t x, coord_t y) {
- int pgsz;
- coord_t iheight;
- (void) x;
+ coord_t iheight, pgsz;
+ // Save our mouse start position
gw2obj->start_mouse_x = x;
gw2obj->start_mouse_y = y;
gw2obj->last_mouse_y = y;
- iheight = gdispGetFontMetric(gw->g.font, fontHeight) + VERTICAL_PADDING;
- pgsz = (gw->g.height-2);
- if (pgsz < 1) pgsz = 1;
-
// For smooth scrolling, scrolling is done in the MouseMove and selection is done on MouseUp
if (gw->g.flags & GLIST_FLG_SCROLLSMOOTH)
return;
+ // Some initial stuff
+ iheight = gdispGetFontMetric(gw->g.font, fontHeight) + VERTICAL_PADDING;
+ pgsz = gw->g.height-2;
+
// Handle click over the scroll bar
- if (gw2obj->cnt > (pgsz / iheight) && x >= gw->g.width-(SCROLLWIDTH+2)) {
+ if (x >= gw->g.width-(SCROLLWIDTH+2) && (gw2obj->cnt > pgsz/iheight || (gw->g.flags & GLIST_FLG_SCROLLALWAYS))) {
if (y < 2*ARROW) {
if (gw2obj->top > 0) {
gw2obj->top -= iheight;