[PATCH 1/4] shell32/autocomplete: Implement the listbox scrollbar manually

Gabriel Ivăncescu gabrielopcode at gmail.com
Fri Apr 12 06:16:10 CDT 2019


On 4/12/19 12:33 PM, Huw Davies wrote:
> On Fri, Apr 05, 2019 at 03:14:24PM +0300, Gabriel Ivăncescu wrote:
>> Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
>> ---
>>
>> This is a no-op patch; its purpose is to keep the next patch smaller and
>> focused only on implementing the resizing grip, because IMO it was a bit
>> large before I split it. Note that to avoid more pointless changes in the
>> next patch, names with "grip" have been used for the scrollbar, I hope
>> that's not a problem.
>>
>> Some of the things are done purposefully to keep the next patch smaller, while
>> they may not make sense by themselves. For example, the WM_WINDOWPOSCHANGED
>> is also useful to that end.
>>
>>   dlls/shell32/autocomplete.c | 132 ++++++++++++++++++++++++++++++++++--
>>   1 file changed, 127 insertions(+), 5 deletions(-)
>>
>> diff --git a/dlls/shell32/autocomplete.c b/dlls/shell32/autocomplete.c
>> index f0777ff..38ca8ca 100644
>> --- a/dlls/shell32/autocomplete.c
>> +++ b/dlls/shell32/autocomplete.c
> 
>> @@ -899,8 +1010,15 @@ static void create_listbox(IAutoCompleteImpl *This)
>>       }
>>   
>>       /* FIXME : The listbox should be resizable with the mouse. WS_THICKFRAME looks ugly */
>> +    This->hwndListBoxGrip = CreateWindowExW(WS_EX_NOACTIVATE, WC_STATICW, NULL,
>> +                                            WS_CHILD | WS_VISIBLE, 0, 0, grip_sz, grip_sz,
>> +                                            This->hwndListBoxOwner, NULL, shell32_hInstance, NULL);
>> +    if (!This->hwndListBoxGrip) goto fail;
>> +
> 
> You should be able to use a SBS_SIZEBOX scrollbar for this, rather
> than re-invent the wheel.
> 
> Huw.
> 

Hi Huw,

You mean for the grip? This scrollbar patch will have to be done, 
regardless, since we can't use the listbox's WS_VSCROLL at all.

I did try with a separate grip window initially, but it actually 
resulted in more code (and more flickering when moved), so it's not 
really a gain in simplicity, because it would be yet another window to 
keep track of and move around, and we'd have to resort to draw the grip 
anyway (because of the last patch which flips it up).

Right now, the only parts that are added due to using the grip in same 
window as scrollbar is just the WM_NCCALCSIZE portion and drawing of the 
grip/scrollbar. Drawing the scrollbar is one DefWindowProc call so it's 
trivial. And drawing the grip has to be done anyway due to flipping it 
up and to show properly (if I'm not wrong, I remember SBS_SIZEBOX being 
different here, visually).

I don't remember exactly why I gave up on the SBS_SIZEBOX idea initially 
after trying it, but it was for something like this definitely.



More information about the wine-devel mailing list