Commit 161649e3 authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

comctl32/combo: Subscribe to WM_MOUSELEAVE events.

Using WM_MOUSEMOVE events to determine whether the dropdown button is hovered is unreliable and thus the dropdown button may stay in hovered state even if mouse has left the window. Signed-off-by: 's avatarZhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 3c81ca83
...@@ -1632,6 +1632,13 @@ static void COMBO_MouseMove( LPHEADCOMBO lphc, WPARAM wParam, LPARAM lParam ) ...@@ -1632,6 +1632,13 @@ static void COMBO_MouseMove( LPHEADCOMBO lphc, WPARAM wParam, LPARAM lParam )
} }
} }
static LRESULT COMBO_MouseLeave(LPHEADCOMBO lphc)
{
lphc->wState &= ~CBF_HOT;
RedrawWindow(lphc->self, &lphc->buttonRect, 0, RDW_INVALIDATE | RDW_UPDATENOW);
return 0;
}
static LRESULT COMBO_GetComboBoxInfo(const HEADCOMBO *lphc, COMBOBOXINFO *pcbi) static LRESULT COMBO_GetComboBoxInfo(const HEADCOMBO *lphc, COMBOBOXINFO *pcbi)
{ {
if (!pcbi || (pcbi->cbSize < sizeof(COMBOBOXINFO))) if (!pcbi || (pcbi->cbSize < sizeof(COMBOBOXINFO)))
...@@ -1871,6 +1878,7 @@ static LRESULT CALLBACK COMBO_WindowProc( HWND hwnd, UINT message, WPARAM wParam ...@@ -1871,6 +1878,7 @@ static LRESULT CALLBACK COMBO_WindowProc( HWND hwnd, UINT message, WPARAM wParam
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
if (!IsRectEmpty(&lphc->buttonRect)) if (!IsRectEmpty(&lphc->buttonRect))
{ {
TRACKMOUSEEVENT event;
POINT pt; POINT pt;
pt.x = (short)LOWORD(lParam); pt.x = (short)LOWORD(lParam);
...@@ -1882,6 +1890,15 @@ static LRESULT CALLBACK COMBO_WindowProc( HWND hwnd, UINT message, WPARAM wParam ...@@ -1882,6 +1890,15 @@ static LRESULT CALLBACK COMBO_WindowProc( HWND hwnd, UINT message, WPARAM wParam
{ {
lphc->wState |= CBF_HOT; lphc->wState |= CBF_HOT;
RedrawWindow(hwnd, &lphc->buttonRect, 0, RDW_INVALIDATE | RDW_UPDATENOW); RedrawWindow(hwnd, &lphc->buttonRect, 0, RDW_INVALIDATE | RDW_UPDATENOW);
event.cbSize = sizeof(TRACKMOUSEEVENT);
event.dwFlags = TME_QUERY;
if (!TrackMouseEvent(&event) || event.hwndTrack != hwnd || !(event.dwFlags & TME_LEAVE))
{
event.hwndTrack = hwnd;
event.dwFlags = TME_LEAVE;
TrackMouseEvent(&event);
}
} }
} }
else if (lphc->wState & CBF_HOT) else if (lphc->wState & CBF_HOT)
...@@ -1895,6 +1912,9 @@ static LRESULT CALLBACK COMBO_WindowProc( HWND hwnd, UINT message, WPARAM wParam ...@@ -1895,6 +1912,9 @@ static LRESULT CALLBACK COMBO_WindowProc( HWND hwnd, UINT message, WPARAM wParam
COMBO_MouseMove( lphc, wParam, lParam ); COMBO_MouseMove( lphc, wParam, lParam );
return TRUE; return TRUE;
case WM_MOUSELEAVE:
return COMBO_MouseLeave(lphc);
case WM_MOUSEWHEEL: case WM_MOUSEWHEEL:
if (wParam & (MK_SHIFT | MK_CONTROL)) if (wParam & (MK_SHIFT | MK_CONTROL))
return DefWindowProcW(hwnd, message, wParam, lParam); return DefWindowProcW(hwnd, message, wParam, lParam);
......
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