widget.c
changeset 2021 3be628c59488
parent 1938 21bd6ef5f85e
child 2026 02dfa0aa2c2f
--- a/widget.c	Thu Jul 07 22:15:34 2005 +0000
+++ b/widget.c	Fri Jul 08 00:14:19 2005 +0000
@@ -125,14 +125,11 @@
 	SetWindowDirty(w);
 }
 
-/*****************************************************
- * Returns the index for the widget located at the given
- * position relative to the window.
- * Parameters:
- *   w   - Window
- *   x/y - Window client coordinates
- * Returns:
- *   A widget index, or -1 if no widget was found.
+/** Returns the index for the widget located at the given position
+ * relative to the window. It includes all widget-corner pixels as well.
+ * @param *w Window to look inside
+ * @param  x,y Window client coordinates
+ * @return A widget index, or -1 if no widget was found.
  */
 int GetWidgetFromPos(Window *w, int x, int y)
 {
@@ -141,19 +138,16 @@
 
 	// Go through the widgets and check if we find the widget that the coordinate is
 	// inside.
-	for(index=0,wi=w->widget; wi->type != WWT_LAST; index++, wi++) {
+	for (index = 0,wi = w->widget; wi->type != WWT_LAST; index++, wi++) {
 		if (wi->type == WWT_EMPTY || wi->type == WWT_FRAME)
 			continue;
 
-		if (x >= wi->left &&
-		    x < wi->right &&
-				y >= wi->top &&
-				y < wi->bottom && !HASBIT(w->hidden_state,index)) {
+		if (x >= wi->left && x <= wi->right && y >= wi->top &&  y <= wi->bottom &&
+				!HASBIT(w->hidden_state,index)) {
 				found_index = index;
 		}
 	}
 
-	// Return the index
 	return found_index;
 }