[PATCH v3 0/1] MR5013: msi: Properly select first feature
We need to select the first feature when all controls are created, otherwise they are not properly updated Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56290 -- v3: msi: Properly select first feature. https://gitlab.winehq.org/wine/wine/-/merge_requests/5013
From: Fabian Maurer <dark.shadow4(a)web.de> We need to select the first feature when all controls are created, otherwise they are not properly updated https://bugs.winehq.org/show_bug.cgi?id=19712 --- dlls/msi/dialog.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/dlls/msi/dialog.c b/dlls/msi/dialog.c index 57c9cc9bc9e..cd520e6f173 100644 --- a/dlls/msi/dialog.c +++ b/dlls/msi/dialog.c @@ -2415,10 +2415,9 @@ static LRESULT WINAPI MSISelectionTree_WndProc(HWND hWnd, UINT msg, WPARAM wPara static void seltree_add_child_features( MSIPACKAGE *package, HWND hwnd, const WCHAR *parent, HTREEITEM hParent ) { - struct msi_selection_tree_info *info = GetPropW( hwnd, L"MSIDATA" ); MSIFEATURE *feature; TVINSERTSTRUCTW tvis; - HTREEITEM hitem, hfirst = NULL; + HTREEITEM hitem; LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry ) { @@ -2446,9 +2445,6 @@ static void seltree_add_child_features( MSIPACKAGE *package, HWND hwnd, const WC if (!hitem) continue; - if (!hfirst) - hfirst = hitem; - seltree_sync_item_state( hwnd, feature, hitem ); seltree_add_child_features( package, hwnd, feature->Feature, hitem ); @@ -2457,10 +2453,6 @@ static void seltree_add_child_features( MSIPACKAGE *package, HWND hwnd, const WC if ( feature->Display % 2 != 0 ) SendMessageW( hwnd, TVM_EXPAND, TVE_EXPAND, (LPARAM) hitem ); } - - /* select the first item */ - SendMessageW( hwnd, TVM_SELECTITEM, TVGN_CARET | TVGN_DROPHILITE, (LPARAM) hfirst ); - info->selected = hfirst; } static void seltree_create_imagelist( HWND hwnd ) @@ -3499,6 +3491,20 @@ static UINT dialog_create_controls( MSIRECORD *rec, void *param ) return ERROR_SUCCESS; } +static void select_first_feature( msi_dialog *dialog ) +{ + struct control *control; + + LIST_FOR_EACH_ENTRY( control, &dialog->controls, struct control, entry ) + { + if (!wcscmp(control->type, L"SelectionTree")) + { + HTREEITEM first_feature = (HTREEITEM)SendMessageW( control->hwnd, TVM_GETNEXTITEM, (WPARAM)TVGN_ROOT, 0 ); + SendMessageW( control->hwnd, TVM_SELECTITEM, TVGN_CARET | TVGN_DROPHILITE, (LPARAM) first_feature ); + } + } +} + static UINT dialog_fill_controls( msi_dialog *dialog ) { UINT r; @@ -3517,6 +3523,8 @@ static UINT dialog_fill_controls( msi_dialog *dialog ) r = MSI_IterateRecords( view, 0, dialog_create_controls, dialog ); msiobj_release( &view->hdr ); + + select_first_feature(dialog); return r; } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/5013
@hans Anything I should change here? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/5013#note_77836
Can someone tell me what I should do here? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/5013#note_81120
participants (2)
-
Fabian Maurer -
Fabian Maurer (@DarkShadow44)