From b8f6d41418982163965dd5beb0b39dbdce1fbe8f Mon Sep 17 00:00:00 2001 From: truelight Date: Sat, 4 Dec 2004 17:54:56 +0000 Subject: (svn r942) -Merged branch/network back into the trunk --- window.c | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'window.c') diff --git a/window.c b/window.c index 2a3bcf16d..01b54becc 100644 --- a/window.c +++ b/window.c @@ -170,6 +170,7 @@ void DrawOverlappedWindow(Window *w, int left, int top, int right, int bottom) void CallWindowEventNP(Window *w, int event) { WindowEvent e; + e.event = event; w->wndproc(w, &e); } @@ -691,7 +692,40 @@ static bool HandlePopupMenu() return false; } -static bool HandleWindowDragging() +bool HandleMouseOver() +{ + Window *w; + WindowEvent e; + static Window *last_w = NULL; + + w = FindWindowFromPt(_cursor.pos.x, _cursor.pos.y); + + // We changed window, put a MOUSEOVER event to the last window + if (last_w && last_w != w) { + e.event = WE_MOUSEOVER; + e.mouseover.pt.x = -1; + e.mouseover.pt.y = -1; + if (last_w->wndproc) + last_w->wndproc(last_w, &e); + } + last_w = w; + + if (w) { + // send an event in client coordinates. + e.event = WE_MOUSEOVER; + e.mouseover.pt.x = _cursor.pos.x - w->left; + e.mouseover.pt.y = _cursor.pos.y - w->top; + if (w->widget != NULL) { + e.mouseover.widget = GetWidgetFromPos(w, e.mouseover.pt.x, e.mouseover.pt.y); + } + w->wndproc(w, &e); + } + + // Mouseover never stops execution + return true; +} + +bool HandleWindowDragging() { Window *w; // Get out immediately if no window is being dragged at all. @@ -1083,6 +1117,9 @@ void MouseLoop() if (!HandleViewportScroll()) return; + if (!HandleMouseOver()) + return; + x = _cursor.pos.x; y = _cursor.pos.y; @@ -1188,6 +1225,7 @@ void UpdateWindows() if (w->viewport != NULL) UpdateViewportPosition(w); } + DrawTextMessage(); // Redraw mouse cursor in case it was hidden DrawMouseCursor(); } -- cgit v1.2.3-54-g00ecf