Open-Shell / Open-Shell-Menu

Classic Shell Reborn.
MIT License
6.58k stars 417 forks source link

Fix scolling behaviour with network discovery #1886

Open dcoder42 opened 3 months ago

dcoder42 commented 3 months ago

Is your feature request related to a problem? Please describe.

The "FixFolderScroll" setting is fixing a scrolling issue when double clicking an item in the left treeview in Windows Explorer but there is another issue (at least) in Windows 10 that is also causing these unwanted scroll effects. When Samba servers are available on the network and you open Explorer for the first time the Explorer scans for Samba machines on the network and after some time they are added to the Network folder on the bottom. This causes unwanted scrolling behaviour. I fixed this by not allowing items to be added to the Network folder when the Network folder is not being selected.

LRESULT CALLBACK CExplorerBHO::SubclassTreeProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData )
{
    if (GetTlsData()->bho == NULL)
        return DefSubclassProc(hWnd, uMsg, wParam, lParam);

    if (uMsg==TVM_EXPAND)
    {
        HTREEITEM hItem=(HTREEITEM)lParam;

        wchar_t szText[256];
        memset(szText, 0, sizeof(szText));

        TV_ITEM tvi;
        tvi.mask = TVIF_TEXT | TVIF_HANDLE;
        tvi.hItem=hItem;
        tvi.cchTextMax = 256;
        tvi.pszText = szText;
        SendMessage(hWnd, TVM_GETITEM, 0, (WPARAM)&tvi);
        USES_CONVERSION;
        char* pszText = W2A(szText);

        __int64 nParent = (__int64)TreeView_GetParent(hWnd, hItem);
        __int64 nParent2 = (__int64)TreeView_GetParent(hWnd, nParent);

        if ((TVE_EXPAND == wParam) && !((tvi.state & TVIS_SELECTED)&TVIS_SELECTED))
        {
            if ((0 == strcmp(pszText, "Netzwerk")) || (0 == strcmp(pszText, "Network")))
            {
                if (nParent2 == 0)
                    return 0;
            }
        }
    }
    ...

Maybe something like this can be added as an option to Open-Shell. Unfortunately i did not find a translated resource of "Network" so i hardcoded it...

Describe the solution you'd like


Area of issue

Windows Explorer

Alternatives you've considered

No response

Additional context

No response