Report position of the mouse to the underlying window. */
| 1982 | |
| 1983 | /** Report position of the mouse to the underlying window. */ |
| 1984 | static void HandleMouseOver() |
| 1985 | { |
| 1986 | Window *w = FindWindowFromPt(_cursor.pos.x, _cursor.pos.y); |
| 1987 | |
| 1988 | /* We changed window, put an OnMouseOver event to the last window */ |
| 1989 | if (_mouseover_last_w != nullptr && _mouseover_last_w != w) { |
| 1990 | /* Reset mouse-over coordinates of previous window */ |
| 1991 | Point pt = { -1, -1 }; |
| 1992 | _mouseover_last_w->OnMouseOver(pt, 0); |
| 1993 | } |
| 1994 | |
| 1995 | /* _mouseover_last_w will get reset when the window is deleted, see DeleteWindow() */ |
| 1996 | _mouseover_last_w = w; |
| 1997 | |
| 1998 | if (w != nullptr) { |
| 1999 | /* send an event in client coordinates. */ |
| 2000 | Point pt = { _cursor.pos.x - w->left, _cursor.pos.y - w->top }; |
| 2001 | const NWidgetCore *widget = w->nested_root->GetWidgetFromPos(pt.x, pt.y); |
| 2002 | if (widget != nullptr) w->OnMouseOver(pt, widget->GetIndex()); |
| 2003 | } |
| 2004 | } |
| 2005 | |
| 2006 | /** Direction for moving the window. */ |
| 2007 | enum PreventHideDirection : uint8_t { |
no test coverage detected