* Find the window structure that corresponds to the given widget. Note * that this is not the popup widget, nor the viewport, but the child. */
| 251 | * that this is not the popup widget, nor the viewport, but the child. |
| 252 | */ |
| 253 | struct xwindow * |
| 254 | find_widget(Widget w) |
| 255 | { |
| 256 | int windex; |
| 257 | struct xwindow *wp; |
| 258 | |
| 259 | /* |
| 260 | * Search to find the corresponding window. Look at the main widget, |
| 261 | * popup, the parent of the main widget, then parent of the widget. |
| 262 | */ |
| 263 | for (windex = 0, wp = window_list; windex < MAX_WINDOWS; windex++, wp++) |
| 264 | if (wp->type != NHW_NONE && (wp->w == w || wp->popup == w |
| 265 | || (wp->w && (XtParent(wp->w)) == w) |
| 266 | || (wp->popup == XtParent(w)))) |
| 267 | break; |
| 268 | |
| 269 | if (windex == MAX_WINDOWS) |
| 270 | panic("find_widget: can't match widget"); |
| 271 | return wp; |
| 272 | } |
| 273 | |
| 274 | /* |
| 275 | * Find a free window slot for use. |
no test coverage detected