Some code ambiguity in tab control code.

André Hentschel nerv at dawncrow.de
Wed Oct 5 14:11:14 CDT 2016


Am 29.09.2016 um 23:49 schrieb John Found:
> Hi.
> 
> Trying without success to show tooltips for a tabcontrol, I found the following problems in the source code. Notice, that my skills in C++ are poor, so it is very possible the following is a false alarm.
> 
> I am quote https://github.com/wine-mirror/wine/blob/master/dlls/comctl32/tab.c (hope it is the proper source code)
> 
> This seems to be a bug: WM_LBUTTONDOWN is relayed in the WM_MOUSEMOVE handler. But WM_LBUTTONDOWN will always hide the tooltip. WM_MOUSEMOVE instead will set the timer for showing the tooltip.
> 
>> static LRESULT
>> TAB_MouseMove (TAB_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
>> {
>>   int redrawLeave;
>>   int redrawEnter;
>>
>>   if (infoPtr->hwndToolTip)
>>     TAB_RelayEvent (infoPtr->hwndToolTip, infoPtr->hwnd,
>> 		    WM_LBUTTONDOWN, wParam, lParam);
>>
>>   /* Determine which tab to highlight.  Redraw tabs which change highlight
>>   ** status. */
>>   TAB_RecalcHotTrack(infoPtr, &lParam, &redrawLeave, &redrawEnter);
>>
>>   hottrack_refresh (infoPtr, redrawLeave);
>>   hottrack_refresh (infoPtr, redrawEnter);
>>
>>   return 0;
>> }
> 
> 
> The WM_LBUTTONDOWN is relayed twice? Why? It is not exactly a bug, but sub-optimal.
> 
>> static LRESULT
>> TAB_LButtonDown (TAB_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
>> {
>>   POINT pt;
>>   INT newItem;
>>   UINT dummy;
>>
>>   if (infoPtr->hwndToolTip)
>>     TAB_RelayEvent (infoPtr->hwndToolTip, infoPtr->hwnd,
>> 		    WM_LBUTTONDOWN, wParam, lParam);
>>
>>   if (!(infoPtr->dwStyle & TCS_FOCUSNEVER)) {
>>     SetFocus (infoPtr->hwnd);
>>   }
>>
>>   if (infoPtr->hwndToolTip)
>>     TAB_RelayEvent (infoPtr->hwndToolTip, infoPtr->hwnd,
>> 		    WM_LBUTTONDOWN, wParam, lParam);
>>
> 
> 
> 
> 
> 


Hi,
what you found here looks like a copy&paste error to me, what happens to your problem if you make your suggested change?



More information about the wine-devel mailing list