[PATCH 2/2] comctl32/listbox: Implement LBS_NODATA

Huw Davies huw at codeweavers.com
Tue Nov 20 06:03:24 CST 2018


On Tue, Nov 20, 2018 at 01:47:51PM +0200, Gabriel Ivăncescu wrote:
> On Tue, Nov 20, 2018 at 1:35 PM Huw Davies <huw at codeweavers.com> wrote:
> > As a first step, I'd do what Nikolay proposed, and handle the
> > single selection case with a NULL items array.  What does that
> > patch look like?
> 
> Do you mean just testing for LBS_NODATA single-selection and leave
> multi-selection alone for now?

Yes.

> I can't test for NULL because some
> functions, like InsertItem, assume that NULL means "empty listbox" so
> it's not a reliable check -- I still have to specialize for
> LBS_NODATA. If not, please elaborate.
> 
> I can add checks like (excuse email formatting):
> 
> if ((descr->items & LBS_NODATA) && !IS_MULTISELECT(descr))
>     /* do single-selection LBS_NODATA easy stuff */
> else
>     /* leave the current code unchanged */

Sure.  You'd most likely make that test a macro along the lines of
IS_MULTISELECT() (or better yet change the existing macros to
helper functions).

> This will work, but those checks will have to be removed later when
> multi-sel is implemented of course (I was worried they could be
> considered a hack, but if you are okay with them I'll go this route).

Let's see what that looks like.

> Another option is to implement multi-sel listboxes as a byte array and
> iterate 1 item at a time which simplifies it somewhat, as a first
> patch. Then, I'll profile the difference and implement the bit array
> (or something else) in a later patch. Would that be acceptable for a
> first patch at least? (the byte array thing)

That could work too, depends on what it ends up looking like.

Huw.



More information about the wine-devel mailing list