From 9cdd22c53dacd3a605891baa17d5744c71b7882e Mon Sep 17 00:00:00 2001 From: Louis Philippe Gagnon Date: Mon, 27 Nov 2000 22:39:35 +0000 Subject: [PATCH] When processing mouse messages in MENU_TrackMenu, use the coordinates in lParam instead of those in MSG::pt. --- controls/menu.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/controls/menu.c b/controls/menu.c index e8c1153a169..d3b303637e3 100644 --- a/controls/menu.c +++ b/controls/menu.c @@ -2782,8 +2782,18 @@ static INT MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y, fRemove = FALSE; if ((msg.message >= WM_MOUSEFIRST) && (msg.message <= WM_MOUSELAST)) { + /* + * use the mouse coordinates in lParam instead of those in the MSG + * struct to properly handle synthetic messages. lParam coords are + * relative to client area, so they must be converted; since they can + * be negative, we must use SLOWORD/SHIWORD instead of LOWORD/HIWORD. + */ + mt.pt.x = SLOWORD(msg.lParam); + mt.pt.y = SHIWORD(msg.lParam); + ClientToScreen(msg.hwnd,&mt.pt); + /* Find a menu for this mouse event */ - hmenu = MENU_PtMenu( mt.hTopMenu, msg.pt ); + hmenu = MENU_PtMenu( mt.hTopMenu, mt.pt ); switch(msg.message) {