@@ -138,18 +138,16 @@ void ScrollbarClickHandler(Window *w, co
* @param x The Window client X coordinate
* @param y The Window client y coordinate
* @return A widget index, or -1 if no widget was found.
*/
int GetWidgetFromPos(const Window *w, int x, int y)
{
uint index;
int found_index = -1;
/* Go through the widgets and check if we find the widget that the coordinate is
* inside. */
for (index = 0; index < w->widget_count; index++) {
/* Go through the widgets and check if we find the widget that the coordinate is inside. */
for (uint index = 0; index < w->widget_count; index++) {
const Widget *wi = &w->widget[index];
if (wi->type == WWT_EMPTY || wi->type == WWT_FRAME) continue;
if (x >= wi->left && x <= wi->right && y >= wi->top && y <= wi->bottom &&
!w->IsWidgetHidden(index)) {
found_index = index;