[Fix] Small fix for list selection, Don't allow focus when mouse clicked out of boundaries.

This commit is contained in:
Allanis 2013-03-07 14:42:28 +00:00
parent e6b28a1634
commit b8f4ee9443

View File

@ -1031,8 +1031,14 @@ static void toolkit_listScroll(Widget* wgt, int direction) {
// List mouse even focus.
static void toolkit_listFocus(Widget* lst, double bx, double by) {
(void)bx;
lst->dat.lst.selected = (lst->h - by) / (gl_defFont.h+2.);
int i;
i = (lst->h - by) / (gl_defFont.h + 2.);
if(i< lst->dat.lst.noptions) {
// Should not be out of boundaries.
lst->dat.lst.selected = i;
toolkit_listScroll(lst, 0); // Check boundaries and trigger callback.
}
}
char* toolkit_getList(const unsigned int wid, char* name) {