[Fix] Small fix for list selection, Don't allow focus when mouse clicked out of boundaries.
This commit is contained in:
parent
e6b28a1634
commit
b8f4ee9443
@ -1031,9 +1031,15 @@ static void toolkit_listScroll(Widget* wgt, int direction) {
|
|||||||
// List mouse even focus.
|
// List mouse even focus.
|
||||||
static void toolkit_listFocus(Widget* lst, double bx, double by) {
|
static void toolkit_listFocus(Widget* lst, double bx, double by) {
|
||||||
(void)bx;
|
(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.
|
toolkit_listScroll(lst, 0); // Check boundaries and trigger callback.
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
char* toolkit_getList(const unsigned int wid, char* name) {
|
char* toolkit_getList(const unsigned int wid, char* name) {
|
||||||
Widget* wgt = window_getwgt(wid, name);
|
Widget* wgt = window_getwgt(wid, name);
|
||||||
|
Loading…
Reference in New Issue
Block a user