Commit 7cca8563 authored by Alexandre Julliard's avatar Alexandre Julliard

comctl32: Properly handle negative coordinates for mouse events.

parent 11f4fb2d
......@@ -1555,8 +1555,8 @@ HEADER_LButtonDblClk (HWND hwnd, WPARAM wParam, LPARAM lParam)
UINT flags;
INT nItem;
pt.x = (INT)LOWORD(lParam);
pt.y = (INT)HIWORD(lParam);
pt.x = (short)LOWORD(lParam);
pt.y = (short)HIWORD(lParam);
HEADER_InternalHitTest (hwnd, &pt, &flags, &nItem);
if ((GetWindowLongW (hwnd, GWL_STYLE) & HDS_BUTTONS) && (flags == HHT_ONHEADER))
......@@ -1578,8 +1578,8 @@ HEADER_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
INT nItem;
HDC hdc;
pt.x = (INT)LOWORD(lParam);
pt.y = (INT)HIWORD(lParam);
pt.x = (short)LOWORD(lParam);
pt.y = (short)HIWORD(lParam);
HEADER_InternalHitTest (hwnd, &pt, &flags, &nItem);
if ((dwStyle & HDS_BUTTONS) && (flags == HHT_ONHEADER)) {
......@@ -1905,8 +1905,8 @@ HEADER_RButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
BOOL bRet;
POINT pt;
pt.x = LOWORD(lParam);
pt.y = HIWORD(lParam);
pt.x = (short)LOWORD(lParam);
pt.y = (short)HIWORD(lParam);
/* Send a Notify message */
bRet = HEADER_SendSimpleNotify (hwnd, NM_RCLICK);
......
......@@ -1342,8 +1342,8 @@ MONTHCAL_RButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam)
strcpyW(buf, todayW);
}
AppendMenuW(hMenu, MF_STRING|MF_ENABLED,1, buf);
menupoint.x=(INT)LOWORD(lParam);
menupoint.y=(INT)HIWORD(lParam);
menupoint.x=(short)LOWORD(lParam);
menupoint.y=(short)HIWORD(lParam);
ClientToScreen(infoPtr->hwndSelf, &menupoint);
if( TrackPopupMenu(hMenu,TPM_RIGHTBUTTON| TPM_NONOTIFY|TPM_RETURNCMD,
menupoint.x, menupoint.y, 0, infoPtr->hwndSelf, NULL))
......@@ -1387,8 +1387,8 @@ MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam)
InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
}
ht.pt.x = (INT)LOWORD(lParam);
ht.pt.y = (INT)HIWORD(lParam);
ht.pt.x = (short)LOWORD(lParam);
ht.pt.y = (short)HIWORD(lParam);
hit = MONTHCAL_HitTest(infoPtr, (LPARAM)&ht);
/* FIXME: these flags should be checked by */
......@@ -1524,8 +1524,8 @@ MONTHCAL_LButtonUp(MONTHCAL_INFO *infoPtr, LPARAM lParam)
redraw = TRUE;
}
ht.pt.x = (INT)LOWORD(lParam);
ht.pt.y = (INT)HIWORD(lParam);
ht.pt.x = (short)LOWORD(lParam);
ht.pt.y = (short)HIWORD(lParam);
hit = MONTHCAL_HitTest(infoPtr, (LPARAM)&ht);
infoPtr->status = MC_SEL_LBUTUP;
......@@ -1602,8 +1602,8 @@ MONTHCAL_MouseMove(MONTHCAL_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
if(!(infoPtr->status & MC_SEL_LBUTDOWN)) return 0;
ht.pt.x = LOWORD(lParam);
ht.pt.y = HIWORD(lParam);
ht.pt.x = (short)LOWORD(lParam);
ht.pt.y = (short)HIWORD(lParam);
hit = MONTHCAL_HitTest(infoPtr, (LPARAM)&ht);
......
......@@ -3933,8 +3933,8 @@ REBAR_LButtonDown (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
UINT htFlags;
INT iHitBand;
POINT ptMouseDown;
ptMouseDown.x = (INT)LOWORD(lParam);
ptMouseDown.y = (INT)HIWORD(lParam);
ptMouseDown.x = (short)LOWORD(lParam);
ptMouseDown.y = (short)HIWORD(lParam);
REBAR_InternalHitTest(infoPtr, &ptMouseDown, &htFlags, &iHitBand);
lpBand = &infoPtr->bands[iHitBand];
......
......@@ -367,8 +367,8 @@ STATUSBAR_Relay2Tip (STATUS_INFO *infoPtr, UINT uMsg,
msg.wParam = wParam;
msg.lParam = lParam;
msg.time = GetMessageTime ();
msg.pt.x = LOWORD(GetMessagePos ());
msg.pt.y = HIWORD(GetMessagePos ());
msg.pt.x = (short)LOWORD(GetMessagePos ());
msg.pt.y = (short)HIWORD(GetMessagePos ());
return SendMessageW (infoPtr->hwndToolTip, TTM_RELAYEVENT, 0, (LPARAM)&msg);
}
......@@ -1330,8 +1330,8 @@ StatusWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
return STATUSBAR_Relay2Tip (infoPtr, msg, wParam, lParam);
case WM_NCHITTEST:
res = STATUSBAR_WMNCHitTest(infoPtr, (INT)LOWORD(lParam),
(INT)HIWORD(lParam));
res = STATUSBAR_WMNCHitTest(infoPtr, (short)LOWORD(lParam),
(short)HIWORD(lParam));
if (res != HTERROR) return res;
return DefWindowProcW (hwnd, msg, wParam, lParam);
......
......@@ -1580,15 +1580,15 @@ static LRESULT WINAPI SysLinkWindowProc(HWND hwnd, UINT message,
case WM_LBUTTONDOWN:
{
POINT pt;
pt.x = LOWORD(lParam);
pt.y = HIWORD(lParam);
pt.x = (short)LOWORD(lParam);
pt.y = (short)HIWORD(lParam);
return SYSLINK_LButtonDown(infoPtr, wParam, &pt);
}
case WM_LBUTTONUP:
{
POINT pt;
pt.x = LOWORD(lParam);
pt.y = HIWORD(lParam);
pt.x = (short)LOWORD(lParam);
pt.y = (short)HIWORD(lParam);
return SYSLINK_LButtonUp(infoPtr, wParam, &pt);
}
......@@ -1639,8 +1639,8 @@ static LRESULT WINAPI SysLinkWindowProc(HWND hwnd, UINT message,
{
POINT pt;
RECT rc;
pt.x = LOWORD(lParam);
pt.y = HIWORD(lParam);
pt.x = (short)LOWORD(lParam);
pt.y = (short)HIWORD(lParam);
GetClientRect(infoPtr->Self, &rc);
ScreenToClient(infoPtr->Self, &pt);
......
......@@ -193,8 +193,8 @@ TAB_RelayEvent (HWND hwndTip, HWND hwndMsg, UINT uMsg,
msg.wParam = wParam;
msg.lParam = lParam;
msg.time = GetMessageTime ();
msg.pt.x = LOWORD(GetMessagePos ());
msg.pt.y = HIWORD(GetMessagePos ());
msg.pt.x = (short)LOWORD(GetMessagePos ());
msg.pt.y = (short)HIWORD(GetMessagePos ());
SendMessageW (hwndTip, TTM_RELAYEVENT, 0, (LPARAM)&msg);
}
......@@ -589,8 +589,8 @@ TAB_NCHitTest (TAB_INFO *infoPtr, LPARAM lParam)
POINT pt;
UINT dummyflag;
pt.x = LOWORD(lParam);
pt.y = HIWORD(lParam);
pt.x = (short)LOWORD(lParam);
pt.y = (short)HIWORD(lParam);
ScreenToClient(infoPtr->hwnd, &pt);
if (TAB_InternalHitTest(infoPtr, pt, &dummyflag) == -1)
......@@ -618,8 +618,8 @@ TAB_LButtonDown (TAB_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
TAB_RelayEvent (infoPtr->hwndToolTip, infoPtr->hwnd,
WM_LBUTTONDOWN, wParam, lParam);
pt.x = (INT)LOWORD(lParam);
pt.y = (INT)HIWORD(lParam);
pt.x = (short)LOWORD(lParam);
pt.y = (short)HIWORD(lParam);
newItem = TAB_InternalHitTest (infoPtr, pt, &dummy);
......@@ -790,8 +790,8 @@ TAB_RecalcHotTrack
}
else
{
pt.x = LOWORD(*pos);
pt.y = HIWORD(*pos);
pt.x = (short)LOWORD(*pos);
pt.y = (short)HIWORD(*pos);
}
item = TAB_InternalHitTest(infoPtr, pt, &flags);
......
......@@ -280,8 +280,10 @@ LRESULT CALLBACK THEMING_ComboSubclassProc (HWND hwnd, UINT msg,
{
/* Dropdown button hot-tracking */
COMBOBOXINFO cbi;
POINT pt = {LOWORD(lParam), HIWORD(lParam)};
POINT pt;
pt.x = (short)LOWORD(lParam);
pt.y = (short)HIWORD(lParam);
cbi.cbSize = sizeof (cbi);
SendMessageW (hwnd, CB_GETCOMBOBOXINFO, 0, (LPARAM)&cbi);
......
......@@ -1887,8 +1887,8 @@ TOOLBAR_RelayEvent (HWND hwndTip, HWND hwndMsg, UINT uMsg,
msg.wParam = wParam;
msg.lParam = lParam;
msg.time = GetMessageTime ();
msg.pt.x = LOWORD(GetMessagePos ());
msg.pt.y = HIWORD(GetMessagePos ());
msg.pt.x = (short)LOWORD(GetMessagePos ());
msg.pt.y = (short)HIWORD(GetMessagePos ());
SendMessageW (hwndTip, TTM_RELAYEVENT, 0, (LPARAM)&msg);
}
......@@ -4601,7 +4601,7 @@ static LRESULT
TOOLBAR_SetButtonSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
INT cx = LOWORD(lParam), cy = HIWORD(lParam);
INT cx = (short)LOWORD(lParam), cy = (short)HIWORD(lParam);
if ((cx < 0) || (cy < 0))
{
......@@ -4634,16 +4634,16 @@ TOOLBAR_SetButtonWidth (HWND hwnd, WPARAM wParam, LPARAM lParam)
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
/* if setting to current values, ignore */
if ((infoPtr->cxMin == (INT)LOWORD(lParam)) &&
(infoPtr->cxMax == (INT)HIWORD(lParam))) {
if ((infoPtr->cxMin == (short)LOWORD(lParam)) &&
(infoPtr->cxMax == (short)HIWORD(lParam))) {
TRACE("matches current width, min=%d, max=%d, no recalc\n",
infoPtr->cxMin, infoPtr->cxMax);
return TRUE;
}
/* save new values */
infoPtr->cxMin = (INT)LOWORD(lParam);
infoPtr->cxMax = (INT)HIWORD(lParam);
infoPtr->cxMin = (short)LOWORD(lParam);
infoPtr->cxMax = (short)HIWORD(lParam);
/* otherwise we need to recalc the toolbar and in some cases
recalc the bounding rectangle (does DrawText w/ DT_CALCRECT
......@@ -5598,8 +5598,8 @@ TOOLBAR_LButtonDblClk (HWND hwnd, WPARAM wParam, LPARAM lParam)
POINT pt;
INT nHit;
pt.x = (INT)LOWORD(lParam);
pt.y = (INT)HIWORD(lParam);
pt.x = (short)LOWORD(lParam);
pt.y = (short)HIWORD(lParam);
nHit = TOOLBAR_InternalHitTest (hwnd, &pt);
if (nHit >= 0)
......@@ -5633,8 +5633,8 @@ TOOLBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
TOOLBAR_RelayEvent (infoPtr->hwndToolTip, hwnd,
WM_LBUTTONDOWN, wParam, lParam);
pt.x = (INT)LOWORD(lParam);
pt.y = (INT)HIWORD(lParam);
pt.x = (short)LOWORD(lParam);
pt.y = (short)HIWORD(lParam);
nHit = TOOLBAR_InternalHitTest (hwnd, &pt);
btnPtr = &infoPtr->buttons[nHit];
......@@ -5769,8 +5769,8 @@ TOOLBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
TOOLBAR_RelayEvent (infoPtr->hwndToolTip, hwnd,
WM_LBUTTONUP, wParam, lParam);
pt.x = (INT)LOWORD(lParam);
pt.y = (INT)HIWORD(lParam);
pt.x = (short)LOWORD(lParam);
pt.y = (short)HIWORD(lParam);
nHit = TOOLBAR_InternalHitTest (hwnd, &pt);
if (!infoPtr->bAnchor || (nHit >= 0))
......@@ -5922,8 +5922,8 @@ TOOLBAR_RButtonUp( HWND hwnd, WPARAM wParam, LPARAM lParam)
NMMOUSE nmmouse;
POINT pt;
pt.x = LOWORD(lParam);
pt.y = HIWORD(lParam);
pt.x = (short)LOWORD(lParam);
pt.y = (short)HIWORD(lParam);
nHit = TOOLBAR_InternalHitTest(hwnd, &pt);
nmmouse.dwHitInfo = nHit;
......@@ -6059,8 +6059,8 @@ TOOLBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
TOOLBAR_RelayEvent (infoPtr->hwndToolTip, hwnd,
WM_MOUSEMOVE, wParam, lParam);
pt.x = (INT)LOWORD(lParam);
pt.y = (INT)HIWORD(lParam);
pt.x = (short)LOWORD(lParam);
pt.y = (short)HIWORD(lParam);
nHit = TOOLBAR_InternalHitTest (hwnd, &pt);
......
......@@ -1794,8 +1794,8 @@ TOOLTIPS_RelayEvent (HWND hwnd, WPARAM wParam, LPARAM lParam)
break;
case WM_MOUSEMOVE:
pt.x = LOWORD(lpMsg->lParam);
pt.y = HIWORD(lpMsg->lParam);
pt.x = (short)LOWORD(lpMsg->lParam);
pt.y = (short)HIWORD(lpMsg->lParam);
nOldTool = infoPtr->nTool;
infoPtr->nTool = TOOLTIPS_GetToolFromPoint(infoPtr, lpMsg->hwnd,
&pt);
......
......@@ -5203,8 +5203,8 @@ TREEVIEW_MouseMove (TREEVIEW_INFO * infoPtr, WPARAM wParam, LPARAM lParam)
_TrackMouseEvent(&trackinfo);
}
pt.x = (INT)LOWORD(lParam);
pt.y = (INT)HIWORD(lParam);
pt.x = (short)LOWORD(lParam);
pt.y = (short)HIWORD(lParam);
item = TREEVIEW_HitTestPoint(infoPtr, pt);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment